Install openvz in centos)

Source: Internet
Author: User
Tags vps
Some people often ask which one is better than OpenVZ and Xen. In fact, OpenVZ and Xen are not at the same level of technology, and OpenVZ is an operation.

Some people often ask which one is better than OpenVZ and Xen. In fact, OpenVZ and Xen are not at the same level. OpenVZ is a virtual product at the Operating system level (Operating system-level virtualization alization) and FreeBSD Jail, solaris Zone and Linux-VServer are similar, while Xen and VMware, KVM, Hyper-V and other products are in the same camp. OpenVZ VPS actually provides a Virtual Environment (Virtual Environment/VE), also known as a Container. Xen VPS provides Virtual machines based on Hypervisor ), this is essentially different. now everyone is used to confusing these two different products and technologies with the name VPS. Compared with Xen's focus on enterprise virtualization and cloud computing, OpenVZ's largest application may be in the low-end VPS market. countless VPS service providers use OpenVZ to provide VPS products of less than 10 USD. The installation and configuration of OpenVZ will also be helpful for using OpenVZ VPS. the following installation and configuration operations are completed on an idle PC and CentOS 5.5 of VPSee. For children's shoes interested in Xen and KVM, see installing and configuring Xen (or http://wiki.centos.org/HowTos/Xen/Xen4QuickStart) and installing and configuring KVM on CentOS.

Install OpenVZ

First, add openvz source, upgrade system, install openvz kernel, vzctl, vzquota, and other tools:

# cd /etc/yum.repos.d# wget http://download.openvz.org/openvz.repo# rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ# yum update# yum install vzkernel# yum install vzctl vzquota
Adjust kernel parameters

In order to allow the VE/VPS to access the external network, we must start the ip forwarding. if the kernel fails or runs slowly, we hope to dump some information to the console with special buttons and combine log troubleshooting, therefore, we recommend that you open the kernel. sysrq:

# vi /etc/sysctl.conf...net.ipv4.ip_forward = 1kernel.sysrq = 1...

To reduce the trouble, it is better to disable selinux. selinux often brings more benefits than the following:

# vi /etc/sysconfig/selinux...SELINUX=disabled...

Check whether the vz service is automatically started and restart the machine to enter the openvz kernel:

# chkconfig --list vz vz             0:off1:off2:on3:on4:on5:on6:off# reboot
Create and install guest

Larry Wall, the father of Perl, said that really good programmers have three excellent qualities: laziness, patience, and arrogance. Therefore, if you can use the fruits of others' work, you should not create your own wheels. We can go to the http://download.openvz.org/template/precreated/ to download installed templates, centos, debian, ubuntu, fedora, suse and other templates can choose from:

# cd /vz/template/cache# wget http://download.openvz.org/template/precreated/ubuntu-10.04-x86.tar.gz

With the ubuntu 10.04 template, you can use this template to create the guest system (VE/VPS, create a Virtual Environment (VE) with the ID of 1 with the downloaded ubuntu-10.04-x86 as the template, and specify the IP address, DNS server address, host name, disk space, etc, after the creation is successful, start VE with ID 1 and modify the root password:

# vzctl create 1 --ostemplate ubuntu-10.04-x86# vzctl set 1 --onboot yes --save# vzctl set 1 --ipadd 172.16.39.110 --save# vzctl set 1 --nameserver 8.8.8.8 --save# vzctl set 1 --hostname vps01.vpsee.com --save# vzctl set 1 --diskspace 10G:10G --save

OK. the VM has been created.

Enable the VM and set the password of the VM.

# vzctl start 1# vzctl exec 1 passwd

VE/VPS with the ID of 1 for startup, restart, shutdown, and power-off:

# vzctl start 1# vzctl restart 1# vzctl stop 1# vzctl destroy 1

View the active VE/VPS:

# vzlist      CTID      NPROC STATUS    IP_ADDR         HOSTNAME         1          8 running   172.16.39.110   vps01.vpsee.com

Resources used for calculation of VE/VPS with ID 1:

# vzcalc -v 1Resource     Current(%)  Promised(%)  Max(%)Low Mem          0.06       1.44       1.44Total RAM        0.19        n/a        n/a Mem + Swap       0.08       1.30        n/aAlloc. Mem       0.11       1.62       3.09Num. Proc        0.01        n/a       0.32--------------------------------------------Memory           0.19       1.62       3.09
Go to guest

After VE is successfully started, you can enter the system, which is equivalent to the xm console of xen. However, you can exit from VE without the need to press the special button to exit directly:

# vzctl enter 1entered into CT 1root@vps01:/# exitlogoutexited from CT 1

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.