1. Please make sure latest VMware server first at Vmware's site and get latest version of it. Furthermore, register serial number first on the page on VMware, it's necessary to input during installation.
[root@ns ~]# wget http://download3.vmware.com/software/vmserver/VMware-server-2.0.1-156745.x86_64.rpm
[root@ns ~]# rpm -Uvh VMware-server-2.0.1-156745.x86_64.rpm
Preparing...################################# [100%]
1:VMware-server################################# [100%]
The installation of VMware Server 2.0.1 for Linux completed successfully.
You can decide to remove this software from your system at any time by
invoking the following command: "rpm -e VMware-server".
Showing posts with label Virtualization. Show all posts
Showing posts with label Virtualization. Show all posts
3/03/2011
2/25/2011
Create and configure VPS on Linux OpenVZ
1.Create VPS. VPS means Virtual Private Server, it's the GuestOS in short. I installed CentOS 4 for VPS because there is no template of CentOS 5 for VPS.
[root@ns ~]# yum -y vztmpl-centos-4-2.0-2 # tempalte for CentOS 4
Loading "installonlyn" plugin
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
Loading mirror speeds from cached hostfile
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vztmpl-centos-4 to pack into transaction set.
[root@ns ~]# yum -y vztmpl-centos-4-2.0-2 # tempalte for CentOS 4
Loading "installonlyn" plugin
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
Loading mirror speeds from cached hostfile
Reading repository metadata in from local files
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vztmpl-centos-4 to pack into transaction set.
2/16/2011
Install and configure OpenVZ.
[1] Install Operation Commands for OpenVZ.
[root@ns ~]# yum -y install vzctrl vzquota vzpkg
Loading "installonlyn" plugin
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
openvz-kernel-rhel5 100% |=========================| 951 B 00:00
openvz-utils 100% |=========================|951 B 00:00
Loading mirror speeds from cached hostfile
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 31 kB 00:00
openvz-ker: ######################################### 14/14
Added 14 new packages, deleted 0 old in 0.26 seconds
primary.xml.gz 100% |=========================| 5.3 kB 00:00
openvz-uti: ######################################### 21/21
Added 21 new packages, deleted 0 old in 0.13 seconds
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vzpkg to pack into transaction set.
vzpkg-2.7.0-18.noarch.rpm 100% |====================| 4.2 kB 00:00
---> Package vzpkg.noarch 0:2.7.0-18 set to be updated
---> Downloading header for vzquota to pack into transaction set.
vzquota-3.0.9-1.i386.rpm 100% |====================| 3.5 kB 00:00
---> Package vzquota.i386 0:3.0.9-1 set to be updated
--> Running transaction check
--> Processing Dependency: vzyum >= 2.4.0-5 for package: vzpkg
--> Processing Dependency: vzctl >= 2.7.0-23 for package: vzpkg
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vzctl to pack into transaction set.
vzctl-3.0.16-1.i386.rpm 100% |====================| 16 kB 00:00
---> Package vzctl.i386 0:3.0.16-1 set to be updated
---> Downloading header for vzyum to pack into transaction set.
vzyum-2.4.0-11.noarch.rpm 100% |====================| 18 kB 00:00
---> Package vzyum.noarch 0:2.4.0-11 set to be updated
--> Running transaction check
--> Processing Dependency: libvzctl-0.0.2.so for package: vzctl
--> Processing Dependency: vzctl-lib = 3.0.16-1 for package: vzctl
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vzctl-lib to pack into transaction set.
vzctl-lib-3.0.16-1.i386.r 100% |====================| 2.5 kB 00:00
---> Package vzctl-lib.i386 0:3.0.16-1 set to be updated
--> Running transaction check
Dependencies Resolved
===================================================================
Package Arch Version Repository Size
===================================================================
Installing:
vzpkg noarch 2.7.0-18 openvz-utils 39 k
vzquota i386 3.0.9-1 openvz-utils 47 k
Installing for dependencies:
vzctl i386 3.0.16-1 openvz-utils 132 k
vzctl-lib i386 3.0.16-1 openvz-utils 168 k
vzyum noarch 2.4.0-11 openvz-utils 361 k
Transaction Summary
===================================================================
Install 5 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 747 k
Downloading Packages:
(1/5): vzctl-3.0.16-1.i38 100% |====================| 132 kB 00:00
(2/5): vzpkg-2.7.0-18.noa 100% |====================| 39 kB 00:00
(3/5): vzquota-3.0.9-1.i3 100% |====================| 47 kB 00:00
(4/5): vzctl-lib-3.0.16-1 100% |====================| 168 kB 00:00
(5/5): vzyum-2.4.0-11.noa 100% |====================| 361 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: vzyum#################################### [1/5]
Installing: vzctl-lib#################################### [2/5]
Installing: vzquota#################################### [3/5]
Installing: vzctl#################################### [4/5]
Installing: vzpkg#################################### [5/5]
Installed: vzpkg.noarch 0:2.7.0-18 vzquota.i386 0:3.0.9-1
Dependency Installed: vzctl.i386 0:3.0.16-1 vzctl-lib.i386 0:3.0.16-1 vzyum.noarch 0:2.4.0-11
Complete!
[root@ns ~]# /etc/rc.d/init.d/vz start# start OpenVZ
Starting OpenVZ:[ OK ]
Bringing up interface venet0:[ OK ]
Configuring interface venet0:[ OK ]
From (server-world.info)
[root@ns ~]# yum -y install vzctrl vzquota vzpkg
Loading "installonlyn" plugin
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
openvz-kernel-rhel5 100% |=========================| 951 B 00:00
openvz-utils 100% |=========================|951 B 00:00
Loading mirror speeds from cached hostfile
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 31 kB 00:00
openvz-ker: ######################################### 14/14
Added 14 new packages, deleted 0 old in 0.26 seconds
primary.xml.gz 100% |=========================| 5.3 kB 00:00
openvz-uti: ######################################### 21/21
Added 21 new packages, deleted 0 old in 0.13 seconds
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vzpkg to pack into transaction set.
vzpkg-2.7.0-18.noarch.rpm 100% |====================| 4.2 kB 00:00
---> Package vzpkg.noarch 0:2.7.0-18 set to be updated
---> Downloading header for vzquota to pack into transaction set.
vzquota-3.0.9-1.i386.rpm 100% |====================| 3.5 kB 00:00
---> Package vzquota.i386 0:3.0.9-1 set to be updated
--> Running transaction check
--> Processing Dependency: vzyum >= 2.4.0-5 for package: vzpkg
--> Processing Dependency: vzctl >= 2.7.0-23 for package: vzpkg
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vzctl to pack into transaction set.
vzctl-3.0.16-1.i386.rpm 100% |====================| 16 kB 00:00
---> Package vzctl.i386 0:3.0.16-1 set to be updated
---> Downloading header for vzyum to pack into transaction set.
vzyum-2.4.0-11.noarch.rpm 100% |====================| 18 kB 00:00
---> Package vzyum.noarch 0:2.4.0-11 set to be updated
--> Running transaction check
--> Processing Dependency: libvzctl-0.0.2.so for package: vzctl
--> Processing Dependency: vzctl-lib = 3.0.16-1 for package: vzctl
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vzctl-lib to pack into transaction set.
vzctl-lib-3.0.16-1.i386.r 100% |====================| 2.5 kB 00:00
---> Package vzctl-lib.i386 0:3.0.16-1 set to be updated
--> Running transaction check
Dependencies Resolved
===================================================================
Package Arch Version Repository Size
===================================================================
Installing:
vzpkg noarch 2.7.0-18 openvz-utils 39 k
vzquota i386 3.0.9-1 openvz-utils 47 k
Installing for dependencies:
vzctl i386 3.0.16-1 openvz-utils 132 k
vzctl-lib i386 3.0.16-1 openvz-utils 168 k
vzyum noarch 2.4.0-11 openvz-utils 361 k
Transaction Summary
===================================================================
Install 5 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 747 k
Downloading Packages:
(1/5): vzctl-3.0.16-1.i38 100% |====================| 132 kB 00:00
(2/5): vzpkg-2.7.0-18.noa 100% |====================| 39 kB 00:00
(3/5): vzquota-3.0.9-1.i3 100% |====================| 47 kB 00:00
(4/5): vzctl-lib-3.0.16-1 100% |====================| 168 kB 00:00
(5/5): vzyum-2.4.0-11.noa 100% |====================| 361 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: vzyum#################################### [1/5]
Installing: vzctl-lib#################################### [2/5]
Installing: vzquota#################################### [3/5]
Installing: vzctl#################################### [4/5]
Installing: vzpkg#################################### [5/5]
Installed: vzpkg.noarch 0:2.7.0-18 vzquota.i386 0:3.0.9-1
Dependency Installed: vzctl.i386 0:3.0.16-1 vzctl-lib.i386 0:3.0.16-1 vzyum.noarch 0:2.4.0-11
Complete!
[root@ns ~]# /etc/rc.d/init.d/vz start# start OpenVZ
Starting OpenVZ:[ OK ]
Bringing up interface venet0:[ OK ]
Configuring interface venet0:[ OK ]
From (server-world.info)
2/15/2011
Install Kernel for OpenVZ
[root@ns ~]# yum -y install vzctrl vzquota vzpkg
Loading "installonlyn" plugin
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
openvz-kernel-rhel5 100% |=========================| 951 B 00:00
openvz-utils 100% |=========================|951 B 00:00
Loading mirror speeds from cached hostfile
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 31 kB 00:00
openvz-ker: ######################################### 14/14
Added 14 new packages, deleted 0 old in 0.26 seconds
primary.xml.gz 100% |=========================| 5.3 kB 00:00
openvz-uti: ######################################### 21/21
Added 21 new packages, deleted 0 old in 0.13 seconds
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vzpkg to pack into transaction set.
vzpkg-2.7.0-18.noarch.rpm 100% |====================| 4.2 kB 00:00
---> Package vzpkg.noarch 0:2.7.0-18 set to be updated
---> Downloading header for vzquota to pack into transaction set.
vzquota-3.0.9-1.i386.rpm 100% |====================| 3.5 kB 00:00
---> Package vzquota.i386 0:3.0.9-1 set to be updated
--> Running transaction check
--> Processing Dependency: vzyum >= 2.4.0-5 for package: vzpkg
--> Processing Dependency: vzctl >= 2.7.0-23 for package: vzpkg
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vzctl to pack into transaction set.
vzctl-3.0.16-1.i386.rpm 100% |====================| 16 kB 00:00
---> Package vzctl.i386 0:3.0.16-1 set to be updated
---> Downloading header for vzyum to pack into transaction set.
vzyum-2.4.0-11.noarch.rpm 100% |====================| 18 kB 00:00
---> Package vzyum.noarch 0:2.4.0-11 set to be updated
--> Running transaction check
--> Processing Dependency: libvzctl-0.0.2.so for package: vzctl
--> Processing Dependency: vzctl-lib = 3.0.16-1 for package: vzctl
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vzctl-lib to pack into transaction set.
vzctl-lib-3.0.16-1.i386.r 100% |====================| 2.5 kB 00:00
---> Package vzctl-lib.i386 0:3.0.16-1 set to be updated
--> Running transaction check
Dependencies Resolved
===================================================================
Package Arch Version Repository Size
===================================================================
Installing:
vzpkg noarch 2.7.0-18 openvz-utils 39 k
vzquota i386 3.0.9-1 openvz-utils 47 k
Installing for dependencies:
vzctl i386 3.0.16-1 openvz-utils 132 k
vzctl-lib i386 3.0.16-1 openvz-utils 168 k
vzyum noarch 2.4.0-11 openvz-utils 361 k
Transaction Summary
===================================================================
Install 5 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 747 k
Downloading Packages:
(1/5): vzctl-3.0.16-1.i38 100% |====================| 132 kB 00:00
(2/5): vzpkg-2.7.0-18.noa 100% |====================| 39 kB 00:00
(3/5): vzquota-3.0.9-1.i3 100% |====================| 47 kB 00:00
(4/5): vzctl-lib-3.0.16-1 100% |====================| 168 kB 00:00
(5/5): vzyum-2.4.0-11.noa 100% |====================| 361 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: vzyum#################################### [1/5]
Installing: vzctl-lib#################################### [2/5]
Installing: vzquota#################################### [3/5]
Installing: vzctl#################################### [4/5]
Installing: vzpkg#################################### [5/5]
Installed: vzpkg.noarch 0:2.7.0-18 vzquota.i386 0:3.0.9-1
Dependency Installed: vzctl.i386 0:3.0.16-1 vzctl-lib.i386 0:3.0.16-1 vzyum.noarch 0:2.4.0-11
Complete!
[root@ns ~]# /etc/rc.d/init.d/vz start # start OpenVZ
Starting OpenVZ:[ OK ]
Bringing up interface venet0:[ OK ]
Configuring interface venet0:[ OK ]
Loading "installonlyn" plugin
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
openvz-kernel-rhel5 100% |=========================| 951 B 00:00
openvz-utils 100% |=========================|951 B 00:00
Loading mirror speeds from cached hostfile
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 31 kB 00:00
openvz-ker: ######################################### 14/14
Added 14 new packages, deleted 0 old in 0.26 seconds
primary.xml.gz 100% |=========================| 5.3 kB 00:00
openvz-uti: ######################################### 21/21
Added 21 new packages, deleted 0 old in 0.13 seconds
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vzpkg to pack into transaction set.
vzpkg-2.7.0-18.noarch.rpm 100% |====================| 4.2 kB 00:00
---> Package vzpkg.noarch 0:2.7.0-18 set to be updated
---> Downloading header for vzquota to pack into transaction set.
vzquota-3.0.9-1.i386.rpm 100% |====================| 3.5 kB 00:00
---> Package vzquota.i386 0:3.0.9-1 set to be updated
--> Running transaction check
--> Processing Dependency: vzyum >= 2.4.0-5 for package: vzpkg
--> Processing Dependency: vzctl >= 2.7.0-23 for package: vzpkg
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vzctl to pack into transaction set.
vzctl-3.0.16-1.i386.rpm 100% |====================| 16 kB 00:00
---> Package vzctl.i386 0:3.0.16-1 set to be updated
---> Downloading header for vzyum to pack into transaction set.
vzyum-2.4.0-11.noarch.rpm 100% |====================| 18 kB 00:00
---> Package vzyum.noarch 0:2.4.0-11 set to be updated
--> Running transaction check
--> Processing Dependency: libvzctl-0.0.2.so for package: vzctl
--> Processing Dependency: vzctl-lib = 3.0.16-1 for package: vzctl
--> Restarting Dependency Resolution with new changes.
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for vzctl-lib to pack into transaction set.
vzctl-lib-3.0.16-1.i386.r 100% |====================| 2.5 kB 00:00
---> Package vzctl-lib.i386 0:3.0.16-1 set to be updated
--> Running transaction check
Dependencies Resolved
===================================================================
Package Arch Version Repository Size
===================================================================
Installing:
vzpkg noarch 2.7.0-18 openvz-utils 39 k
vzquota i386 3.0.9-1 openvz-utils 47 k
Installing for dependencies:
vzctl i386 3.0.16-1 openvz-utils 132 k
vzctl-lib i386 3.0.16-1 openvz-utils 168 k
vzyum noarch 2.4.0-11 openvz-utils 361 k
Transaction Summary
===================================================================
Install 5 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 747 k
Downloading Packages:
(1/5): vzctl-3.0.16-1.i38 100% |====================| 132 kB 00:00
(2/5): vzpkg-2.7.0-18.noa 100% |====================| 39 kB 00:00
(3/5): vzquota-3.0.9-1.i3 100% |====================| 47 kB 00:00
(4/5): vzctl-lib-3.0.16-1 100% |====================| 168 kB 00:00
(5/5): vzyum-2.4.0-11.noa 100% |====================| 361 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: vzyum#################################### [1/5]
Installing: vzctl-lib#################################### [2/5]
Installing: vzquota#################################### [3/5]
Installing: vzctl#################################### [4/5]
Installing: vzpkg#################################### [5/5]
Installed: vzpkg.noarch 0:2.7.0-18 vzquota.i386 0:3.0.9-1
Dependency Installed: vzctl.i386 0:3.0.16-1 vzctl-lib.i386 0:3.0.16-1 vzyum.noarch 0:2.4.0-11
Complete!
[root@ns ~]# /etc/rc.d/init.d/vz start # start OpenVZ
Starting OpenVZ:[ OK ]
Bringing up interface venet0:[ OK ]
Configuring interface venet0:[ OK ]
1/10/2011
Linux CentOS 5 On VMWare Server: Installing VMWare Tools
A few weeks ago I’ve made a few posts on installing Linux CentOS 5 on a VMware Server. Well today I realized I didn’t post the part about installing the VMware Tools. These tools allow you to increase your virtual machine’s performance and capabilities.
Prior to installing the VMware Tools, there are a few things you want to do. The first step would be to install the kernel header files and a C compiler:
# yum install gcc gcc-c++ kernel-devel
The second thing would be to create a symbolic link pointing to your kernel header files:
# ln –s /usr/src/kernels/[your kernel version] /usr/src/linux
Now you’re ready to install the VMware Tools. From the VMware Server Console (with your virtual machine running), click on “VM => Install VMware Tools…”. Nothing is supposed to be happening at this point, it’s just like you inserted a virtual CD. From the command line, mount the cdrom drive, copy the installation files to a directory on your virtual hard drive and untar them:
# mount /dev/cdrom /mnt/cdrom
# cd /mnt/cdrom
# cp VMwareTools-[version].tar.gz /tmp
# cd /tmp
# umount /mnt/cdrom
# tar zxf VMwareTools-[version].tar.gz
Execute the VMware Tools installation script:
# cd /tmp/vmware-tools-distrib
# ./vmware-install.pl
Go through the installation and answer all the questions. I’ve left every settings to its default value.
When you’re done, simply reboot your virtual machine. I’ve had a little problem with X as it wouldn’t start upon reboot. I just used the X configuration wizard (which launched automatically) to make some adjustments, rebooted the VM again and everything worked fine.
1/06/2011
Install Kernel for OpenVZ
This section is the virtualization with OpenVZ.
[1] Install Kernel for OpenVZ first and reboot system with it.
[root@ns ~]# cd /etc/yum.repos.d
[root@ns yum.repos.d]# wget http://download.openvz.org/openvz.repo
[root@ns yum.repos.d]# cd
[root@ns ~]# yum -y install ovzkernel
Loading "installonlyn" plugin
Loading "fastestmirror" plugin
Setting up Install Process
Setting up repositories
openvz-kernel-rhel5 100% |=========================| 951 B 00:00
openvz-utils 100% |=========================|951 B 00:00
Loading mirror speeds from cached hostfile
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 31 kB 00:00
openvz-ker: ######################################### 14/14
Added 14 new packages, deleted 0 old in 0.26 seconds
primary.xml.gz 100% |=========================| 5.3 kB 00:00
openvz-uti: ######################################### 21/21
Added 21 new packages, deleted 0 old in 0.13 seconds
Parsing package install arguments
Resolving Dependencies
--> Populating transaction set with selected packages. Please wait.
---> Downloading header for ovzkernel to pack into transaction set.
ovzkernel-2.6.18-8.el5.02 100% |====================| 255 kB 00:00
---> Package Package ovzkernel.i686 0:2.6.18-8.el5.028stab031.1 set to be installed
--> Running transaction check
Dependencies Resolved
===================================================================
Package Arch Version Repository Size
===================================================================
Installing:
ovzkernel i686 2.6.18-8.el5.
028stab031.1 openvz-kernel
-rhel5 15 M
Transaction Summary
===================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)
Total download size: 15 M
Downloading Packages:
(1/1): ovzkernel-2.6.18-8 100% |====================| 15 MB 00:38
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: ovzkernel#################################### [1/1]
Installed: ovzkernel.i686 0:2.6.18-8.el5.028stab031.1
Complete!
[root@ns ~]#
[root@ns ~]# vi /etc/sysctl.conf
# line 7: change
net.ipv4.ip_forward = 1
# line 16: change
kernel.sysrq = 1
# add at the bottom
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0
[root@ns ~]# vi /boot/grub/grub.conf
# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You have a /boot partition. This means that
#all kernel and initrd paths are relative to /boot/, eg.
#root (hd0,0)
#kernel /vmlinuz-version ro root=/dev/Host/LogVol01
#initrd /initrd-version.img
#boot=/dev/sda
# change default kernel
default=0
timeout=5
splashimage=(hd0,0)/grub/splash.xpm.gz
hiddenmenu
title CentOS (2.6.18-8.el5.028stab031.1)
root (hd0,0)
kernel /vmlinuz-2.6.18-8.el5.028stab031.1 ro root=/dev/VZ/Host00 console=tty0
initrd /initrd-2.6.18-8.el5.028stab031.1.img
title CentOS (2.6.18-8.1.4.el5xen)
root (hd0,0)
kernel /xen.gz-2.6.18-8.1.4.el5 dom0_mem=512M
module /vmlinuz-2.6.18-8.1.4.el5xen ro root=/dev/Xen/Host00
module /initrd-2.6.18-8.1.4.el5xen.img
title CentOS (2.6.18-8.1.1.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-8.1.1.el5 ro root=/dev/Xen/Host00
initrd /initrd-2.6.18-8.1.1.el5.img
title CentOS (2.6.18-8.el5)
root (hd0,0)
kernel /vmlinuz-2.6.18-8.el5 ro root=/dev/Xen/Host00
initrd /initrd-2.6.18-8.el5.img
[root@ns ~]# shutdown -r now
[root@ns ~]# uname -r
2.6.18-8.el5.028stab031.1# OpenVZ kerne
From (server-world)
1/05/2011
OpenVZ On CentOS 5.4 installation and configuration
This article will describe how to create OpenVZ container in CentOS 5.4. With OpenVZ you can create multiple Virtual Private Servers (VPS) on same hardware machine and running them simultaneously and efficiently.
OpenVZ is the open-source branch of Virtuozzo, a commercial virtualization solution widely used by hosting providers. The OpenVZ kernel patch is licensed under GPL license, and the user-level tools are under the QPL license.
As there are many ways of achieving this goal, I’d keep this howto as smart as possible. In the following days, I’d create similar posts on Xen / Vserver, please keep a close eye on my planet.
As there are many ways of achieving this goal, I’d keep this howto as smart as possible. In the following days, I’d create similar posts on Xen / Vserver, please keep a close eye on my planet.
1, Install OpenVZ
In order to install OpenVZ, we need to add the OpenVZ repository to yum, this would also help us keep the kernel up-to-date:
cd /etc/yum.repos.d wget http://download.openvz.org/openvz.repo rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ
The repository contains a few different OpenVZ kernels (you can find more details here: http://wiki.openvz.org/Kernel_flavors), or with this command “yum search ovzkernel“.
Pick one of them and install it as follows:
yum install ovzkernel
This should automatically update the GRUB bootloader as well. An example is listed below”
cat /boot/grub/menu.lst # grub.conf generated by anaconda # # Note that you do not have to rerun grub after making changes to this file # NOTICE: You have a /boot partition. This means that # all kernel and initrd paths are relative to /boot/, eg. # root (hd0,0) # kernel /vmlinuz-version ro root=/dev/VolGroup00/LogVol00 # initrd /initrd-version.img #boot=/dev/sda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title CentOS (2.6.18-128.2.1.el5.028stab064.7) root (hd0,0) kernel /vmlinuz-2.6.18-128.2.1.el5.028stab064.7 ro root=LABEL=/ initrd /initrd-2.6.18-128.2.1.el5.028stab064.7.img
2, Pre-adjustings before the installation
Now we install some OpenVZ user tools:
yum install vzctl vzquota
Open /etc/sysctl.conf and make sure that you have the following settings in it:
cat /etc/sysctl.conf net.ipv4.ip_forward = 1 net.ipv4.conf.default.proxy_arp = 0 net.ipv4.conf.all.rp_filter = 1 kernel.sysrq = 1 net.ipv4.conf.default.send_redirects = 1 net.ipv4.conf.all.send_redirects = 0 net.ipv4.icmp_echo_ignore_broadcasts=1 net.ipv4.conf.default.forwarding=1
The following step is important if the IP addresses of your virtual machines are from a different subnet than the host system’s IP address. If you don’t do this, networking will not work in the virtual machines!
Open /etc/vz/vz.conf and set NEIGHBOUR_DEVS to all, the modified entry is like this “NEIGHBOUR_DEVS=all“. SELinux needs to be disabled, you can do it by making changes on its config file /etc/sysconfig/selinux. Finally, reboot the system, and then your new OpenVZ kernel should show up:
[root@server1 ~]# uname -r 2.6.18-128.2.1.el5.028stab064.7
3, Create a Virutal Server
Before we can create virtual machines with OpenVZ, we need to have a template for the distribution that we want to use in the virtual machines in the /vz/template/cache by default. New virtual machines will be created from these templates. A list of precreated templates is available here.
I want to use CentOS 5 in my virtual machines, so I download a CentOS 5 template:
cd /vz/template/cache wget http://download.openvz.org/template/precreated/contrib/centos-5-i386-default.tar.gz
To set up a VPS from the default CentOS 5 template, run:
vzctl create 211 --ostemplate centos-5-i386-default --config vps.basic
The 211 must be uniqe and each virtual machine must have its own ID. You can use the last part of the VPS’s IP address for it. For example, if the virtual machine’s IP address is 192.168.0.211, you use 211 as the ID.
4, Common controls on OpenVZ
If you want to have the vm started at boot, run:
vzctl set 211 --onboot yes --save
To set a hostname and IP address for the vm, run:
vzctl set 211 --hostname test.example.com --save vzctl set 211 --ipadd 192.168.0.211 --save
Next we set the number of sockets to 120 and assign a few nameservers to the vm:
vzctl set 211 --numothersock 120 --save vzctl set 211 --nameserver 85.17.150.123 --nameserver 83.149.80.123 --nameserver 145.253.2.75 --save
Instead of using the vzctl set commands, you can directly edit vm’s configuration file which is stored in the directory/etc/vz/conf. If the ID of the vm is 211, then the configuration file is /etc/vz/conf/211.conf.
In order to start the vm, run “vzctl start 211″, to set a root password for the vm, run “vzctl exec 211 passwd”. Now You can either connect to the vm via SSH (e.g. with PuTTY), or login through console directly as follows:
vzctl enter 211
To leave the vm’s console, type “exit”, to stop a vm, run “vzctl stop 211“, to restart a vm, run “vzctl restart 211“.
To delete a vm from the hard drive (it must be stopped before you can do this), run “vzctl destroy 211“.
5, Check VM Status
To get a list of your vms and their statuses, run “vzlist -a” like this:
[root@server1 cache]# vzlist -a
VEID NPROC STATUS IP_ADDR HOSTNAME
211 18 running 192.168.0.211 test.example.comTo find out about the resources allocated to a vm, run like follows:
[root@server1 cache]# vzctl exec 211 cat /proc/user_beancounters
Version: 2.5
uid resource held maxheld barrier limit failcnt
211: kmemsize 1508202 1661695 11055923 11377049 0
lockedpages 0 0 256 256 0
privvmpages 5430 7102 65536 69632 0
shmpages 381 381 21504 21504 0
dummy 0 0 0 0 0
numproc 19 21 240 240 0
physpages 2489 2775 0 2147483647 0
vmguarpages 0 0 33792 2147483647 0
oomguarpages 2489 2775 26112 2147483647 0
numtcpsock 5 5 360 360 0
numflock 3 4 188 206 0
numpty 0 1 16 16 0
numsiginfo 0 2 256 256 0
tcpsndbuf 44720 0 1720320 2703360 0
tcprcvbuf 81920 0 1720320 2703360 0
othersockbuf 13144 14356 1126080 2097152 0
dgramrcvbuf 0 8380 262144 262144 0
numothersock 11 13 120 120 0
dcachesize 0 0 3409920 3624960 0
numfile 503 531 9312 9312 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
dummy 0 0 0 0 0
numiptent 10 10 128 128 0The failcnt column is very important, it should be only zeros; if not, means that the vm needs more resources than currently allocated. Open the vm’s configuration file in /etc/vz/conf and raise the appropriate resource, then restart it.
To find out more about the vzctl command, run “man vzctl”. If you faced any issues during the installation, please create a thread and show your errors in the sub forum virtualization at admon community.
From (planet.admon.org)
Subscribe to:
Posts (Atom)