OpenVZのインストール手順
マシン | VMwareServer上の仮想マシン |
プロセッサ | 2プロセッサ |
メモリ | 2GB |
OS | CentOS 5.2 |
yumリポジトリを使用したインストールを行う。
cd /etc/yum.repos.d/ wget http://download.openvz.org/openvz.repo rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
yum search ovzkernel
名称 | 機能 |
ovzkernel.i686 | シングルプロセッサ用(最大メモリ:4GB) |
ovzkernel-devel.i686 | シングルプロセッサ用(最大メモリ:4GB)開発環境 |
ovzkernel-PAE.i686 | シングルプロセッサ用(最大メモリ:64GB) |
ovzkernel-PAE-devel.i686 | シングルプロセッサ用(最大メモリ:64GB)開発環境 |
ovzkernel-ent.i686 | マルチプロセッサ用(最大メモリ:64GB) |
ovzkernel-ent-devel.i686 | マルチプロセッサ用(最大メモリ:64GB)開発環境 |
ovzkernel-xen.i686 | Xen Hypervisor用(Xen Hypervisor配下で動作させる場合に使用) |
ovzkernel-xen-devel.i686 | Xen Hypervisor用開発環境 |
yum -y install ovzkernel-ent.i686 yum -y install ovzkernel-ent-devel.i686
vi /boot/grub/grub.conf以下の箇所を変更
【変更前】Default=1 【変更後】Default=0
OpenVZはホストOSからゲストOSへネットワークのフォワードが必要となるため、/etc/sysctl.conf に以下の設定が必要となる。
vi /etc/sysctl.conf
net.ipv4.ip_forward = 1 net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 net.ipv4.conf.default.proxy_arp = 0 net.ipv4.conf.default.send_redirects = 1 net.ipv4.conf.all.send_redirects = 0 kernel.sysrq = 1
CentOS5.2の場合は以下となる。
【変更前】net.ipv4.ip_forward = 0 【変更後】net.ipv4.ip_forward = 1
net.ipv4.conf.default.proxy_arp = 0 net.ipv4.conf.default.send_redirects = 1 net.ipv4.conf.all.send_redirects = 0
net.ipv4.conf.default.rp_filter = 1 net.ipv4.conf.default.accept_source_route = 0 kernel.sysrq = 1
以下のコマンドでsysctl.confの内容を確認できる。
sysctl -p
仮想環境の保管ディレクトリ(/vz)をlocateの検索対象外とするため、/etc/updatedb.confに除外設定を入れる。
vi /etc/updatedb.conf
PRUNEPATHS行に除外ディレクトリを追記する。
PRUNEPATHS="/tmp /usr/tmp /var/tmp /afs /net /sfs /vz"
OpenVZ管理用のコマンドラインツールをインストールする。
yum -y install vzctl vzctl-lib vzpkg vzquota vzyum vzrpm43 vzrpm43-python vzrpm44 vzrpm44-python
vmware-config-tools.pl
設定完了後に再起動を行い、変更を反映させる。
再起動後、以下のコマンドでOpenVZを起動させる。
/etc/init.d/vz start