· [Java论坛][安全论坛][数据库论坛][操作系统论坛]
· [访谈] 网银安全系列访谈之:惊心动魄网银故事
· [热点专题] 网银安全系列 3G上网卡巡礼
· [订阅IT技术周刊][IT资源下载专区][病毒求助专区]
· [热点] 跨站脚本十二问 四步防范Conficker
· [热点] Windows 7 RC版公开下载 憾缺中文版

Linux系统下配置OPENVZ虚拟机的过程解析

发布时间:2008.03.07 06:27     来源:赛迪网    作者:sixth

在Linux 下配置OPENVZ 实例

推荐使用Fedora Core 4/5/3 或者RHEL/CentOS 4。

1. 下载安装文件

根据您的内核版本在这里:http://openvz.org/download/kernel/ 下载。

# rpm -ihv vzkernel-name*.rpm

2.修改grub.conf 文件

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

3.修改、etc/sysyctl.conf文件:

/etc/sysctl.conf:
# On Hardware Node we generally need
# packet forwarding enabled and proxy arp disabled
net.ipv4.ip_forward = 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
#net.ipv4.tcp_ecn = 0
# we do not want all our interfaces to send redirects
net.ipv4.conf.default.send_redirects = 1

4. 如果你运行了iptables防火墙和SELinux,先关闭和禁止。

编辑/etc/sysconfig/selinux:

SELINUX=disabled。

另外还要关闭iptables防火墙。

5.安装OpenVZ管理软件

根据您的版本在这里:http://openvz.org/download/utils/ 下载。

# rpm –Uhv vzctl*.rpm vzquota*.rpm vzpkg*.rpm

6.重新启动VZ

# /etc/init.d/vz start

7.安装模板

# rpm –ihv vztmpl-fedora-core-3-1.0-2.noarch.rpm
# vzpkgcache
Creating cache for fedora-core-3 OS template
Setting up install process
Packing cache file fedora-core-3.tar.gz ...
Cache file fedora-core-3.tar.gz [130M] created.

8.为虚拟服务器创建一个非零ID

# vzctl create 101
Creating VPS private area: /vz/private/101
VPS is mounted
Postcreate action done
VPS is unmounted
VPS private area was created

9.设置为零参数

# vzctl set 101 --hostname test101.my.org --save
Hostname for VPS set: test101.my.org
Saved parameters for VPS 101
# vzctl set 101 --ipadd 10.0.186.1 --save
Adding IP address(es): 10.0.186.1
Saved parameters for VPS 101
# vzctl set 101 --nameserver 192.168.1.165 --save
File resolv.conf was modified
Saved parameters for VPS 101

10.设置root用户口令

# vzctl set 101 --userpasswd root:test

11.启动SSH守护进程

# vzctl exec 101 service sshd start

12.启动VPS

# vzctl start 101
Starting VPS ...
VPS is mounted
Adding IP address(es): 10.0.186.101 Hostname for VPS 101 set: test.my.org
VPS start in progress...

13.加载防火墙

前面关闭的防火墙,出于安全考虑这里还要加载

# vzctl set 101 --iptables iptable_filter 
--iptables ipt_length --iptables ipt_limit 
--iptables iptable_mangle --iptables ipt_REJECT --save

(责任编辑:云子)


[ 发表评论 ] 字体[  ] [ 打印 ] [ 进入博客 ] [ 进入论坛 ]  [ 推荐给朋友 ]
  相关文章
· 配置记录FTP传输情况的Linux FTP服务器 (03-06) · 新手学堂:Linux系统挂载UFS分区的方法 (03-06)
· 在Linux系统下Mldonkey的配置和使用方法 (03-06) · VM共享文件夹在Linux系统下如何正确使用 (03-06)
· Mozilla和GNOME合作 共同促进桌面Linux (03-06) · OpenSUSE系统下使用SAMBA建立文件服务器 (03-05)
· 在Ubuntu系统下播放rmvb等视频格式文件 (03-05) · Ubuntu下允许Root用户直接登录图形界面 (03-05)
· 在Ubuntu 7.10 Linux下搭建J2EE开发环境 (03-05) · Ubuntu Linux显示器屏幕偏移的解决办法 (03-05)
  客户需求反馈表
* 姓  名:
更多资料  了解方案  认识厂商
* 单位名称:
* 联系电话:
* 电子邮件:
资讯 通信 IT产品 IT技术 信息化
2009第七届中国电脑商年会直播
·创业投资系列访谈:产业..
·特别策划:视频网站系列..
·专题:网游虚拟货币新规..
专题:6月上市手机新品回顾及7月新机展望
·2009年中国电信业信息化..
·专题:把iPhone 3GS“解..
·WAPI重启国际标准进程 ..
专题:09年中盘点-联想春季打印机新品回顾
·InfoComm 2009 视听与集..
·网游背后的故事 网游服..
·[专题]联想ThinkPad T40..
BizSpark:微软为技术创业企业点燃火花
·社区活动:我的IT求知生..
·访谈:内网安全2009系列..
·安全访谈:网银安全之Sa..