Parse OPENVZ configuration knowledge in Linux

Source: Internet
Author: User
Tags vps

Many people are learning Linux. We can see that Linux is becoming more and more important. Do you know about Linux? Are you an application of Linux? This article describes how to configure OPENVZ in Linux.

1. Download the Installation File

According to your kernel version here: http://openvz.org/download/kernel/ download.

# Rpm-ihv vzkernel-name *. rpm

2. Modify the grub. conf file

 
 
  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. Modify the etc/sysyctl. conf file:

 
 
  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. If you have run iptables firewall and SELinux, disable and disable it first.

Edit/etc/sysconfig/selinux:

SELINUX = disabled.

Disable the iptables firewall.

5. Install OpenVZ Management Software

Depending on your version here: http://openvz.org/download/utils/ download.

# Rpm-Uhv vzctl *. rpm vzquota *. rpm vzpkg *. rpm

6. Restart VZ

#/Etc/init. d/vz start

7. Install the Template

 
 
  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. Create a non-zero ID for the Virtual Server

 
 
  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. Set the parameter to zero.

 
 
  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. Set the root user password

# Vzctl set 101 -- userpasswd root: test

11. Start the SSH daemon

# Vzctl exec 101 service sshd start

12. Start 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. Load the Firewall

The firewall that was previously disabled must be loaded for security reasons.

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

We hope OPENVZ configuration in Linux will be helpful to you.

  1. Analysis of Open-source Cisco router virtual machines in Linux
  2. 30 Linux releases
  3. Learning Experience: Linux File lock
  4. Linux Extension File System
  5. Easily create a file system in Linux

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.