Parsing the process of configuring OPENVZ Virtual Machine in Linux

Source: Internet
Author: User
Article Title: how to configure the OPENVZ Virtual Machine in Linux. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.

Configure OPENVZ instances in Linux

We recommend that you use Fedora Core 4/5/3 or RHEL/CentOS 4.

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

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

        
         /etc/sysctl.conf:# On Hardware Node we generally need# packet forwarding enabled and proxy arp disablednet.ipv4.ip_forward = 1net.ipv4.conf.default.proxy_arp = 0# Enables source route verificationnet.ipv4.conf.all.rp_filter = 1# Enables the magic-sysrqkey kernel.sysrq = 1#net.ipv4.tcp_ecn = 0# we do not want all our interfaces to send redirectsnet.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

        
         # rpm ?ihv vztmpl-fedora-core-3-1.0-2.noarch.rpm# vzpkgcacheCreating cache for fedora-core-3 OS templateSetting up install processPacking cache file fedora-core-3.tar.gz ...Cache file fedora-core-3.tar.gz [130M] created.
        

8. Create a non-zero ID for the Virtual Server

        
         # vzctl create 101Creating VPS private area: /vz/private/101VPS is mountedPostcreate action doneVPS is unmountedVPS private area was created
        

9. Set the parameter to zero.

        
         # vzctl set 101 --hostname test101.my.org --saveHostname for VPS set: test101.my.orgSaved parameters for VPS 101# vzctl set 101 --ipadd 10.0.186.1 --saveAdding IP address(es): 10.0.186.1Saved parameters for VPS 101# vzctl set 101 --nameserver 192.168.1.165 --saveFile resolv.conf was modifiedSaved 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

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

13. Load the Firewall

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

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

 

Related Article

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.