作者:书友49916066 | 来源:互联网 | 2014-05-27 21:18
官方有一个详细的安装文档,按照文档说明一步步安装就可以。这里只记录命令,不加说明,仅供以后快速安装使用。准备#cd/etc/yum.repos.d#wgethttp://download.openvz.org/openvz.repo#rpm--importhttp://download.openvz.org/RPM-G
官方有一个详细的安装文档,按照文档说明一步步安装就可以。
这里只记录命令,不加说明,仅供以后快速安装使用。
准备
# cd /etc/yum.repos.d
# wget http://download.openvz.org/openvz.repo
# rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
kernel安装
Refer to kernel flavors for more info.
# yum install ovzkernel[-flavor] #[-flavor] is optional, and can be -smp or -enterprise.
Configuring the bootloader
直接上说明,这个安装时并必需改动
In case GRUB is used as the boot loader, it will be configured
automatically: lines similar to these will be added to the
/boot/grub/grub.conf file:
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
Change Fedora Core to OpenVZ (just for clarity reasons, so the
OpenVZ kernels will not be mixed up with non-OpenVZ ones). Remove
extra arguments from the kernel line, leaving only the root=…
parameter. The modifed portion of /etc/grub.conf should look like
this:
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
Configuring
/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
/etc/sysconfig/selinux
<pre class=”prettyprint”>
SELINUX=disabled
重启系统
# yum install vzctl vzquota #安装工具包
# /sbin/service vz start #启动服务
下载系统模板
http://openvz.org/download/template/cache
http://download.openvz.org/template/precreated/
http://wiki.openvz.org/Download_mirrors
创建客户机
# vzctl create 1 --ostemplate 模板名字(不需要后缀,下载的文件不需要解压)
# vzctl set 1 --onboot yes ?save
# vzctl set 1 --ipadd 192.168.11.12 --save
# vzctl set 1 --nameserver 8.8.8.8 --save
# vzctl set 1 --hostname xx.tianjiaguo.com --save
# vzctl set 1 --diskspace 6G:6G --save
# vzctl start 1
#vzctl exec 1 passwd #配置密码
# vzctl start 1
# vzctl restart 1
# vzctl stop 1
# vzctl destroy 1 #删除
# vzlist #查看运行中的主机
#vzcalc -v 1 #查看主机占用资源
#vzctl enter 1 # 进入主机
#exit #退出主机
准备安装管理软件
yum install expect
下载并安装vzpkg
http://download.openvz.org/template/utils/vzpkg/current/
开始安装管理软件
wget
http://mesh.dl.sourceforge.net/sourceforge/vtonf/vtonfinstaller.1.0-beta1.tar.gz
tar xvfz vtonfinstaller.1.0-beta1.tar.gz
cd vtonfinstaller.1.0-beta1
./install
成功后访问:
http://localhost:8001