hnakamur’s blog

ものすごい勢いで忘れる私のために未整理でもいいからとりあえずメモ

2008-12-16

OpenVZを試す、が、まだうまくいかない



Linux-VServerはバニラカーネルへのパッチとして提供されていて、パッチあたりまくりのCentOSだとうまく当たらないし、そうかといってバニラカーネル+Linux-VServerにしてしまうとCentOSとは別物になってしまってCentOSの検証環境としては使えないなあと悩んでいて以下のページを見つけました。



そうかOpenVZならCentOSのカーネルにも対応していたのか(もっと早く気付けよ>私)。ということでトライしてみました。



# 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
# yum install ovzkernel.x86_64
# vi /etc/sysctl.conf
===================================================================
RCS file: /etc/sysctl.conf,v
retrieving revision 1.1
diff -u -r1.1 /etc/sysctl.conf
--- /etc/sysctl.conf 2008/12/16 16:13:56 1.1
+++ /etc/sysctl.conf 2008/12/16 16:15:34
@@ -4,15 +4,19 @@
# sysctl.conf(5) for more details.

# Controls IP packet forwarding
-net.ipv4.ip_forward = 0
+net.ipv4.ip_forward = 1
+net.ipv4.conf.default.proxy_arp = 0

# Controls source route verification
+net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
+net.ipv4.conf.default.send_redirects = 1
+net.ipv4.conf.all.send_redirects = 0

# Do not accept source routing

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

# Controls whether core dumps will append the PID to the core filename
# Useful for debugging multi-threaded applications
===================================================================
# sysctl -p
net.ipv4.ip_forward = 1
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.all.rp_filter = 1
net.ipv4.conf.default.rp_filter = 1
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
kernel.sysrq = 1
kernel.core_uses_pid = 1
kernel.msgmnb = 65536
kernel.msgmax = 65536
kernel.shmmax = 68719476736
kernel.shmall = 4294967296
net.ipv4.tcp_syncookies = 1
net.ipv4.icmp_echo_ignore_broadcasts = 1
net.ipv4.conf.all.accept_redirects = 0
net.ipv4.conf.default.accept_redirects = 0
net.ipv4.conf.eth0.accept_redirects = 0
net.ipv4.conf.lo.accept_redirects = 0
net.ipv4.conf.all.accept_source_route = 0
net.ipv4.conf.default.accept_source_route = 0
net.ipv4.conf.eth0.accept_source_route = 0
net.ipv4.conf.lo.accept_source_route = 0

# reboot
uname -r
2.6.18-92.1.13.el5.028stab059.6
# yum install vzctl vzctl-lib vzpkg vzquota vzyum vzrpm43 vzrpm43-python vzrpm44 vzrpm44-python
oading "fastestmirror" plugin
Loading mirror speeds from cached hostfile
* addons: ftp2.riken.jp
* extras: ftp2.riken.jp
* base: ftp2.riken.jp
* openvz-kernel-rhel5: ftp.iij.ad.jp
* openvz-utils: ftp.iij.ad.jp
* updates: ftp2.riken.jp
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
--> Running transaction check
---> Package vzctl.i386 0:3.0.23-1 set to be updated
---> Package vzpkg.noarch 0:2.7.0-18 set to be updated
---> Package vzrpm44-python.i386 0:4.4.1-22.5 set to be updated
---> Package vzquota.i386 0:3.0.12-1 set to be updated
---> Package vzyum.noarch 0:2.4.0-11 set to be updated
--> Processing Dependency: cElementTree.so for package: vzyum
---> Package vzrpm43-python.i386 0:4.3.3-7_nonptl.6 set to be updated
---> Package vzrpm44.i386 0:4.4.1-22.5 set to be updated
---> Package vzctl.x86_64 0:3.0.23-1 set to be updated
---> Package vzquota.x86_64 0:3.0.12-1 set to be updated
---> Package vzrpm43.i386 0:4.3.3-7_nonptl.6 set to be updated
---> Package vzctl-lib.i386 0:3.0.23-1 set to be updated
---> Package vzctl-lib.x86_64 0:3.0.23-1 set to be updated
--> Finished Dependency Resolution
Error: Missing Dependency: cElementTree.so is needed by package vzyum


おおっとなんかエラーが。


で、検索したら本家のドキュメントに行き着く(最初からこちらを見ようね>私)。



というわけで続き。



# yum install vzctl vzquota
# /sbin/service vz start
# /sbin/chkconfig --list vz
# wget http://linux.carreira.com.pt/ovzutils/setx86_64-0.3.tar.gz
# tar zxf setx86_64-0.3.tar.gz
# sh setx86_64
# vi /vz/template/centos/5/x86_64/config/.rpmmacros
===================================================================
RCS file: /vz/template/centos/5/x86_64/config/.rpmmacros,v
retrieving revision 1.1
diff -u -r1.1 /vz/template/centos/5/x86_64/config/.rpmmacros
--- /vz/template/centos/5/x86_64/config/.rpmmacros 2008/12/16 16:34:18 1.1
+++ /vz/template/centos/5/x86_64/config/.rpmmacros 2008/12/16 16:34:35
@@ -1 +1 @@
-%_install_langs C
+%_install_langs C:ja_JP.UTF-8
===================================================================

# vzpkgls | grep x86_64
fedora-7-x86_64-small
fedora-7-x86_64-default
fedora-7-x86_64-minimal
fedora-core-5-x86_64-default
fedora-core-5-x86_64-minimal
fedora-core-3-x86_64-default
fedora-core-3-x86_64-minimal
fedora-core-6-x86_64-default
fedora-core-6-x86_64-minimal
fedora-core-4-x86_64-default
fedora-core-4-x86_64-minimal
centos-5-x86_64-default
centos-5-x86_64-minimal
centos-4-x86_64-default
centos-4-x86_64-minimal
# vzpkgcache -f centos-5-x86_64-minimal
...
Installing: libgcc ####################### [ 1/87]
could not open ts_done file: [Errno 2] No such file or directory: '/vz/root/100001/var/lib/yum/transaction-done.2008-12-17.01:43.38'
Installing: setup ####################### [ 2/87]
could not open ts_done file: [Errno 2] No such file or directory: '/vz/root/100001/var/lib/yum/transaction-done.2008-12-17.01:43.38'
...
Complete!
sed: can't read /etc/init.d/syslog: No such file or directory
ERROR: Script install-post failed


途中で/vz/root/100001/var/lib/yum/というディレクトリが無いっぽいエラー連発。最後にもエラーが。なんか間違えたかな。


調べてみると/vz/root/まではあるがその下はないようだ。/etc/init.d/syslogのほうはあるんだけどな。続きはまた今度。





ブログ アーカイブ