== Openvz cd /etc/yum.repos.d wget http://download.openvz.org/openvz.repo rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ yum install ovzkernel vi /etc/sysctl.conf net.ipv4.ip_forward = 1 net.ipv4.conf.default.proxy_arp = 0 net.ipv4.conf.all.rp_filter = 1 kernel.sysrq = 1 net.ipv4.conf.default.send_redirects = 1 net.ipv4.conf.all.send_redirects = 0 reboot yum install vzctrl vzquota vzpkg service vz start vi /etc/modprobe.conf options ip_conntrack ip_conntrack_enable_ve0=1 yum install vztmpl-centos-4-2.0-2 vzpkgcache vzlist -a 101 vzpkgls = creat guest vzctl create 101 --ostemplate centos-4-i386-default --config vps.basic vzctl set 101 --onboot yes --save vzctl set 101 --ipadd 192.168.20.48 --save vzctl set 101 --hostname host1 --save vzctl set 101 --diskspace 3000000:3000000 --save vzctl start 101 vzctl exec 101 service sshd start vzctl set 101 --userpasswd sakai:password vzctl status 101 vzlist 101 vzctl stop 101 vzctl restart 101 vzlist = yum install on guest vzctl enter 101 rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS4 wget http://ftp.riken.jp/Linux/centos/4/os/i386/CentOS/RPMS/yum-2.4.3-4.el4.centos.noarch.rpm wget http://ftp.riken.jp/Linux/centos/4/os/i386/CentOS/RPMS/python-urlgrabber-2.9.8-2.noarch.rpm wget http://ftp.riken.jp/Linux/centos/4/os/i386/CentOS/RPMS/python-elementtree-1.2.6-5.el4.centos.i386.rpm wget http://ftp.riken.jp/Linux/centos/4/os/i386/CentOS/RPMS/python-sqlite-1.1.7-1.2.1.i386.rpm wget http://ftp.riken.jp/Linux/centos/4/os/i386/CentOS/RPMS/sqlite-3.3.6-2.i386.rpm wget http://ftp.riken.jp/Linux/centos/4/os/i386/CentOS/RPMS/libxml2-2.6.16-12.i386.rpm wget http://ftp.riken.jp/Linux/centos/4/os/i386/CentOS/RPMS/libxml2-python-2.6.16-12.i386.rpm wget http://ftp.riken.jp/Linux/centos/4/os/i386/CentOS/RPMS/rpm-python-4.3.3-26_nonptl.i386.rpm wget http://ftp.riken.jp/Linux/centos/4/os/i386/CentOS/RPMS/python-urlgrabber-2.9.82.noarch.rpm wget http://ftp.riken.jp/Linux/centos/4/os/i386/CentOS/RPMS/yum-metadata-parser-1.0-8.el4.centos.i386.rpm rpm -ivh *.rpm exit = yum from host vzyum 101 -y install gcc = clone vzctl stop 101 mkdir /vz/root/102 cp /etc/vz/conf/101.conf /etc/vz/conf/102.conf mkdir /vz/private/102 pushd /vz/private/101; tar c --numeric-owner * | tar x --numeric-owner -C /vz/private/102; popd vi /etc/vz/conf/102.conf # Change the IP_ADDRESS vzctl start 102; vzctl start 101 = destory vzctl stop 101 vzctl destroy 101 = CPU limmit vzctl set 101 --cpuunits 1500 --cpulimit 4 --save = Memory Limmit vzctl set 101 --vmguarpages $((256 * 256)) --save vzctl set 101 --privvmpages $((256 * 1024)) --save = 64ビットOSへのOpenVZのインストール http://wiki.openvz.org/Install_OpenVZ_on_a_x86_64_system_Centos-Fedora = NIC が2つある場合 NICが2つあり、(eth0 192.168.2.74 eth1 192.168.3.74)、ゲストOSに192.168.2.75と192.168.3.75をアサイン したい場合、以下のコマンドでホストOSのインタフェースで認識される。 vzctl set 100 --ipadd 192.168.2.75 --save vzctl set 100 --ipadd 192.168.3.75 --save [root@gest1 /]# ifconfig | more lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 b) TX bytes:0 (0.0 b) venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:127.0.0.1 P-t-P:127.0.0.1 Bcast:0.0.0.0 Mask:255.255.255.255 UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1 RX packets:1077 errors:0 dropped:0 overruns:0 frame:0 TX packets:928 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:92934 (90.7 KiB) TX bytes:104548 (102.0 KiB) venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:192.168.2.75 P-t-P:192.168.2.75 Bcast:192.168.2.75 Mask:255.255.255.255 UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1 venet0:1 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:192.168.3.75 P-t-P:192.168.3.75 Bcast:192.168.3.75 Mask:255.255.255.255 UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1 ゲストOSから3セグにPINGがでないので、以下スタティックルートで3セグを振ったeth1からパケットがでるようにゲストOSのスタティックルーターを設定。 # cat /etc/sysconfig/static-routes any net 192.168.3.0 netmask 255.255.255.0 gw 192.168.3.75 [root@gest1 /]# route Kernel IP routing table Destination Gateway Genmask Flags Metric Ref Use Iface 192.168.3.0 192.168.3.75 255.255.255.0 UG 0 0 0 venet0 192.0.2.0 * 255.255.255.0 U 0 0 0 venet0 169.254.0.0 * 255.255.0.0 U 0 0 0 venet0 default 192.0.2.1 0.0.0.0 UG 0 0 0 venet0 ゲストOSでネットワークインタフェースを再起動するとエラーがでるので以下コメントアウト。 #kernel.sysrq = 0 #kernel.core_uses_pid = 1