Configure OPENVZ Virtual Machine in Linux

Source: Internet
Author: User
In Linux, configure OPENVZ Virtual Machine-Linux Enterprise Application-Linux server application information. The following is a detailed description. 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 disabled
Net. ipv4.ip _ forward = 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
# Net. ipv4.tcp _ ecn = 0
# We do not want all our interfaces to send redirects
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

# Rpm? Ihv vztmpl-fedora-core-3-1.0-2.noarch.rpm
# Vzpkgcache
Creating cache for fedora-core-3 OS template
Setting up install process
Packing cache file fedora-core-3.tar.gz...
Cache file fedora-core-3.tar.gz [130 M] created.

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

# Vzctl create 101
Creating VPS private area:/vz/private/101
VPS is mounted
Postcreate action done
VPS is unmounted
VPS private area was created

9. Set the parameter to zero.

# Vzctl set 101 -- hostname test101.my.org -- save
Hostname for VPS set: test101.my.org
Saved parameters for VPS 101
# Vzctl set 101 -- ipadd 10.0.186.1 -- save
Adding IP address (es): 10.0.186.1
Saved parameters for VPS 101
# Vzctl set 101 -- nameserver 192.168.1.165 -- save
File resolv. conf was modified
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

# Vzctl start 101
Starting VPS...
VPS is mounted
Adding IP address (es): 10.0.186.101 Hostname for VPS 101 set: test.my.org
VPS 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

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.