过程 30.1. OpenVZ 安装步骤
获得OpenVZ yum安装源
# cd /etc/yum.repos.d # wget http://download.openvz.org/openvz.repo # rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
安装OpenVZ核心以及头文件
# yum install ovzkernel[-flavor]
修改启动所使用的内核为OpenVZ内核,使OpenVZ内核为默认启动内核
# vim /etc/grub.conf
将类似下面的内容
title Fedora Core (2.6.8-022stab029.1) root (hd0,0) kernel /vmlinuz-2.6.8-022stab029.1 ro root=/dev/sda5 quiet rhgb vga=0x31B initrd /initrd-2.6.8-022stab029.1.img
修改为类似这样
title OpenVZ (2.6.8-022stab029.1) root (hd0,0) kernel /vmlinuz-2.6.8-022stab029.1 ro root=/dev/sda5 initrd /initrd-2.6.8-022stab029.1.img
或直接在里面寻找类似开头为
title CentOS (2.6.18-194.3.1.el5.028stab069.6)
的项目,并且把default改为他的下标,下标从0开始
修改LINUX网络配置文件
/etc/sysctl.conf # On Hardware Node we generally need # packet forwarding enabled and proxy arp disabled net.ipv4.ip_forward = 1 #修改 net.ipv6.conf.default.forwarding = 1 #添加 net.ipv6.conf.all.forwarding = 1 #添加 net.ipv4.conf.default.proxy_arp = 0 #添加 # Enables source route verification net.ipv4.conf.all.rp_filter = 1 #修改 # Enables the magic-sysrq key kernel.sysrq = 1 #修改 # We do not want all our interfaces to send redirects net.ipv4.conf.default.send_redirects = 1 #添加 net.ipv4.conf.all.send_redirects = 0 #添加
关闭SELinux
# lokkit --selinux=disabled
SELINUX=disabled
重启LINUX
# reboot
安装OpenVZ管理工具
# yum install vzctl # yum install vzquota # yum install vzyum
用到什么工具就安装什么工具,具体可以使用# yum search vz*搜索一下
启动OpenVZ服务
# /sbin/service vz start