Home | 简体中文 | 繁体中文 | 杂文 | Search | ITEYE 博客 | OSChina 博客 | Facebook | Linkedin | 作品与服务 | Email

第 30 章 OpenVZ

目录

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
    				
comments powered by Disqus