第 30 章 OpenVZ

本文详细介绍如何在Linux系统上安装OpenVZ虚拟化环境,包括获取安装源、安装核心及头文件、设置默认启动内核、配置网络参数、禁用SELinux以及安装管理工具等关键步骤。

目录

30.1. 安装OpenVZ 30.2. 使用OpenVZ & 建立VPS
30.2.1. 安装操作系统模板 30.2.2. 创建OpenVZ操作系统节点(VPS)
30.3. 设置VPS参数

30.1. 安装OpenVZ

过程 30.1. OpenVZ 安装步骤

  1. 获得OpenVZ yum安装源

    # cd /etc/yum.repos.d
    # wget http://download.openvz.org/openvz.repo
    # rpm --import  http://download.openvz.org/RPM-GPG-Key-OpenVZ
    				
  2. 安装OpenVZ核心以及头文件

    # yum install ovzkernel[-flavor]
    				
  3. 修改启动所使用的内核为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开始

  4. 修改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 #添加
    				
  5. 关闭SELinux

    # lokkit --selinux=disabled
    				
    SELINUX=disabled
    				
  6. 重启LINUX

    # reboot
    				
  7. 安装OpenVZ管理工具

    # yum install vzctl
    # yum install vzquota
    # yum install vzyum
    				

    用到什么工具就安装什么工具,具体可以使用# yum search vz*搜索一下

  8. 启动OpenVZ服务

    # /sbin/service vz start
    				

Please enable JavaScript to view the <a href="http://disqus.com/?ref_noscript">comments powered by Disqus.</a>comments powered by Disqus





原文出处:Netkiller 系列 手札
本文作者:陈景峯
转载请与作者联系,同时请务必标明文章原始出处和作者信息及本声明。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值