因为是新技术,就想测试下,按照PETER NILSSONS和openvz wiki的资料试了下,暂时没遇到问题。
这人记录下安装过程,有兴趣的朋友也可玩下,安装没几步,很容易。

先介绍下VSwap:

RHEL6(Redhat6, CentOS6, Fedora 12/13/14)系列系统新支持的内存管理技术,替代了原来的User beancounters。

现在分成了physpages(最大内存)和swappages(最大swap)这两个参数,当最大内存达到后,内存就移入VSwap(替代了原来的burstRAM),
这个VSwap是内存模拟的swap,和普通的swap相比没有硬盘I/O操作,所以比XEN的Swap要快,但模拟swap本身这个过程会使机器变慢。
当母鸡内存短缺后,VSwap会被移入真实的硬盘swap中。

安装步骤:
注意到,这是RHEL6带的技术,所以母鸡不能是常用的CentOS 5,我以CentOS6.0为例:

1)设置yum源

cd /etc/yum.repos.d
wget http://download.openvz.org/openvz.repo
wget http://download.openvz.org/RPM-GPG-Key-OpenVZ
rpm --import RPM-GPG-Key-OpenVZ

2)修改 /etc/yum.repos.d/openvz.repo文件,这文件默认支持rhel5,我们把他改成支持rhel6.

vi /etc/yum.repos.d/openvz.repo

把[openvz-kernel-rhel5]下的 enabled = 0, [openvz-kernel-rhel6]下的 enabled = 1

7486

改好后

yum update

3)安装openvz

yum install vzkernel

4)修改 /etc/sysctl.conf文件

vi /etc/sysctl.conf

改成如下:- # Kernel sysctl configuration file for Red Hat Linux

  • #
  • # For binary values, 0 is disabled, 1 is enabled. See sysctl(8) and
  • # sysctl.conf(5) for more details.
  • - # Controls IP packet forwarding
  • net.ipv4.ip_forward = 1
  • net.ipv4.conf.all.rp_filter = 1
  • net.ipv4.icmp_echo_ignore_broadcasts = 1
  • net.ipv6.conf.default.forwarding = 1
  • net.ipv6.conf.all.forwarding = 1
  • - #disable arp proxy
  • net.ipv4.conf.default.proxy_arp = 0
  • - - # Controls source route verification
  • net.ipv4.conf.default.rp_filter = 1
  • - # Do not accept source routing
  • net.ipv4.conf.default.accept_source_route = 0
  • - # Controls the System Request debugging functionality of the kernel
  • kernel.sysrq = 1
  • - # Controls whether core dumps will append the PID to the core filename.
  • # Useful for debugging multi-threaded applications.
  • kernel.core_uses_pid = 1
  • - # Controls the use of TCP syncookies
  • net.ipv4.tcp_syncookies = 1
  • - # Disable netfilter on bridges.
  • net.bridge.bridge-nf-call-ip6tables = 0
  • net.bridge.bridge-nf-call-iptables = 0
  • net.bridge.bridge-nf-call-arptables = 0
  • - - # We do not want all our interfaces to send redirects
  • net.ipv4.conf.default.send_redirects = 1
  • net.ipv4.conf.all.send_redirects = 0
  • 复制代码应用设置:

sysctl -p

5)禁用SELINUX:

vi /etc/sysconfig/selinux

改参数:
SELINUX=disabled

6)重启主机:

reboot

7)安装OpenVZ管理面板

wget -O - http://ovz-web-panel.googlecode.com/svn/installer/ai.sh | sh

管理面板位于:
http://你的ip:3000
默认用户名/密码:admin/admin

8)建立小鸡
进入网页管理界面后大部分操作都在Physical Servers里进行。
新建服务器,OS Templates里下载模板(点选下载会会自动后台下载,过一会而就好了),
Server Templates里修改VPS方案,Create virtual Server建立VPS。

这个就是建立VPS的界面,需要添ID,选择方案什么的,看看就知道了

7487

9)SHELL下简单命令介绍(101是小鸡的ID)

进入小鸡: vzctl enter 101
退出小鸡:exit
小鸡HOSTNAME: vzctl set 101 --hostname HOSTNAME --save
小鸡IP: vzctl set 101 --ipadd YourIP --save
小鸡DNS: vzctl set 101 --nameserver DNSIP --save
小鸡用户名/密码: vzctl set 101 --userpasswd USERNAME
![](tongue.gif)
ASSWORD
设置随母鸡自动开机: vzctl set 101 --onboot yes --save
开/关/重启小鸡: vzctl start/stop/restart 101
删除小鸡: vzctl destroy 101
更多的命令请看openvz wiki或自行google。

最后这张是小鸡free -m的图,可以看到有了2G的SWAP区:

7488

[ 本帖最后由 znithy 于 2011-8-28 22:16 编辑 ]