インストールメモ

サーバはVMware上にCentOS4.6で作成。FirewallSELinuxは無(にしないと面倒そう)。

# cd /etc/yum.repos.d
# wget http://download.openvz.org/openvz.repo
# rpm --import  http://download.openvz.org/RPM-GPG-Key-OpenVZ
# yum install ovzkaernel

をするも、
Error: lksctp-tools conflicts with kernel >= 2.6.10
と表示され先に進まない。
CentOS5にすると解決するらしいけど、悔しいので4のまま進める方向で
# yum remove lksctp-tools
で、もういっちょ。
# yum install ovzkaernel
 (中略)
Complete!

できた〜。

sysctl.confの必要個所を編集。
# vi /etc/sysctl.conf

"/etc/sysctl.conf" 20L, 604C# Kernel sysctl configuration file for Red Hat Linux
#
# For binary values, 0 is disabled, 1 is enabled.  See sysctl(8) and
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
net.ipv4.ip_forward = 0

# Controls source route verification
net.ipv4.conf.default.rp_filter = 1

# Do not accept source routing
net.ipv4.conf.default.accept_source_route = 0

# Controls the System Request debugging functionality of the kernel
kernel.sysrq = 0

# Controls whether core dumps will append the PID to the core filename.
# Useful for debugging multi-threaded applications.
kernel.core_uses_pid = 1

net.ipv4.ip_forward = 1
kernel.sysrq = 1
だけ修正。
起動時のカーネル選択を見やすくするためにgrub.conf修正
# vi /boot/grub/grub.conf

"/boot/grub/grub.conf" 33L, 1214C# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE:  You do not have a /boot partition.  This means that
#all kernel and initrd paths are relative to /, eg.
#root (hd0,0)
#kernel /boot/vmlinuz-version ro root=/dev/sda1
#initrd /boot/initrd-version.img
#boot=/dev/sda
default=0
timeout=5
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-53.1.13.el5.028stab053.10)root (hd0,0)kernel /boot/vmlinuz-2.6.18-53.1.13.el5.028stab053.10 ro root=LABEL=/initrd /boot/initrd-2.6.18-53.1.13.el5.028stab053.10.img
title CentOS (2.6.9-67.0.7.ELsmp)root (hd0,0)kernel /boot/vmlinuz-2.6.9-67.0.7.ELsmp ro root=LABEL=/initrd /boot/initrd-2.6.9-67.0.7.ELsmp.img
title CentOS (2.6.9-67.0.7.EL)root (hd0,0)kernel /boot/vmlinuz-2.6.9-67.0.7.EL ro root=LABEL=/initrd /boot/initrd-2.6.9-67.0.7.EL.img
title CentOS-4 i386 (2.6.9-67.ELsmp)root (hd0,0)kernel /boot/vmlinuz-2.6.9-67.ELsmp ro root=LABEL=/initrd /boot/initrd-2.6.9-67.ELsmp.img
title CentOS-4 i386-up (2.6.9-67.EL)root (hd0,0)kernel /boot/vmlinuz-2.6.9-67.EL ro root=LABEL=/initrd /boot/initrd-2.6.9-67.EL.img
~

"title CentOS (2.6.18-53.1.13.el5.028stab053.10)"の「CentOS」を「OpenVZ」にして再起動。

OpenVZのカーネルで起動してから、vzctlとvzquotaを入れて、vzを起動。

# yum install vzctl vzquota
# /sbin/service vz start

参照したもの

とりあえずここまで。後は寝て起きてから。