解析Linux配置OPENVZ的知识

运维 系统运维
很多人在学习Linux,可以看出Linux现在的地位越来越重要,你了解Linux系统么?你是Linux系统的应用者么?本文为你详细介绍Linux配置OPENVZ ,为你在学习Linux配置OPENVZ 时起一定的作用。

很多人在学习Linux,可以看出Linux现在的地位越来越重要,你了解Linux系统么?你是Linux系统的应用者么?本文为你详细介绍Linux配置OPENVZ ,为你在学习Linux配置OPENVZ 时起一定的作用。

1. 下载安装文件

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

# rpm -ihv vzkernel-name*.rpm

2.修改grub.conf 文件

  1. title OpenVZ (2.6.8-022stab029.1) root (hd0,0) kernel   
  2. /vmlinuz-2.6.8-022stab029.1 ro root=/dev/sda5 initrd /initrd-2.6.8-022stab029.1.img 

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

  1. /etc/sysctl.conf:  
  2. # On Hardware Node we generally need  
  3. # packet forwarding enabled and proxy arp disabled  
  4. net.ipv4.ip_forward = 1 
  5. net.ipv4.conf.default.proxy_arp = 0 
  6. # Enables source route verification  
  7. net.ipv4.conf.all.rp_filter = 1 
  8. # Enables the magic-sysrq  
  9. key kernel.sysrq = 1 
  10. #net.ipv4.tcp_ecn = 0 
  11. # we do not want all our interfaces to send redirects  
  12. 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.安装模板

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

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

  1. # vzctl create 101  
  2. Creating VPS private area: /vz/private/101  
  3. VPS is mounted  
  4. Postcreate action done  
  5. VPS is unmounted  
  6. VPS private area was created 

9.设置为零参数

  1. # vzctl set 101 --hostname test101.my.org --save  
  2. Hostname for VPS set: test101.my.org  
  3. Saved parameters for VPS 101  
  4. # vzctl set 101 --ipadd 10.0.186.1 --save  
  5. Adding IP address(es): 10.0.186.1  
  6. Saved parameters for VPS 101  
  7. # vzctl set 101 --nameserver 192.168.1.165 --save  
  8. File resolv.conf was modified  
  9. Saved parameters for VPS 101 

10.设置root用户口令

# vzctl set 101 --userpasswd root:test

11.启动SSH守护进程

# vzctl exec 101 service sshd start

12.启动VPS

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

13.加载防火墙

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

  1. # vzctl set 101 --iptables iptable_filter   
  2. --iptables ipt_length --iptables ipt_limit   
  3. --iptables iptable_mangle --iptables ipt_REJECT --save 

希望Linux配置OPENVZ 对你有所能够帮助。

【编辑推荐】

  1. 浅析Linux操作系统中开源Cisco路由虚拟机
  2. 详解三十种Linux发行版本
  3. 学习心得:Linux系统文件锁
  4. 阐述Linux扩展文件系统
  5. 轻松的完成Linux创建文件系统
责任编辑:小霞 来源: CSDN
相关推荐

2011-01-20 10:27:39

2009-09-08 08:05:31

虚拟化产品OpenVZ

2011-11-07 10:42:57

PPTPVPN

2010-03-10 17:18:17

Linux磁盘阵列

2009-12-17 09:02:00

路由器配置

2009-01-18 09:21:00

VMware网络配置

2009-02-12 18:21:19

VMwareLinux虚拟化

2010-09-29 15:20:29

2012-09-24 09:59:24

Linux操作系统

2019-12-04 10:55:53

KVMXENOpenVZ

2012-03-18 22:43:40

centosopenvz

2016-05-20 09:58:58

Java内存限制LXC

2013-04-07 15:14:41

2011-03-10 13:22:26

2009-03-16 15:47:16

Java线程多线程

2018-07-31 14:57:54

VPS虚拟化KVM

2010-11-01 00:56:27

2010-08-30 17:22:35

DHCP中继

2009-12-21 14:33:11

2009-12-11 15:10:22

点赞
收藏

51CTO技术栈公众号