Install Kernel for OpenVZ

OpenVZ está hecho para un ambiente homogéneo (por ahora) debido a que sólo podemos implementar núcleos de Linux para todas las VM’s, por ende, distribuciones de Linux. El rendimiento de ejecución es completamente nativo, por lo cual no tenemos pérdida de performance.
Se los recomiendo y aquí el howto.

[[email protected] ~]#cd /etc/yum.repos.d

[[email protected] yum.repos.d]#wget http://download.openvz.org/openvz.repo
[[email protected] yum.repos.d]#cd
[[email protected] ~]#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!
[[email protected] ~]#
[[email protected] ~]# vi /etc/sysctl.conf

# ir a la linea 7: cambiar
net.ipv4.ip_forward = 1

# ir a la linea 16: cambiar
kernel.sysrq = 1

# añadir
net.ipv4.conf.default.proxy_arp = 0
net.ipv4.conf.default.send_redirects = 1
net.ipv4.conf.all.send_redirects = 0

[[email protected] ~]# 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
# cambiar el 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

[[email protected] ~]# shutdown -r now

[[email protected] ~]# uname -r
2.6.18-8.el5.028stab031.1

Usando templates de OpenVZ
[[email protected] ~]#cd /vz/template/cache
[[email protected] ~]#wget http://download.openvz.org/template/precreated/contrib/centos-5-i386-default.tar.gz
[[email protected] ~]#vzctl create 101 –ostemplate centos-5-i386-default –config vps.basic
#new VM
[[email protected] ~]#vzctl set 101 –onboot yes –save
#auto boot
[[email protected] ~]#vzctl set 101 –hostname test.example.linux –save
#set hostname
[[email protected] ~]#vzctl set 101 –ipadd 192.168.0.101 –save
#set IP
[[email protected] ~]#vzctl set 101 –numothersock 120 –save
#set sockets
[[email protected] ~]#vzctl set 101 –nameserver 200.14.241.36 –nameserver 200.14.241.38
#set DNS
[[email protected] ~]#vzctl set 101 –diskspace 30G:30G –cpuunits 33000 –save
#set disk
[[email protected] ~]#vzctl set 101 –cpuunits 33000 –save
#set cpu
[[email protected] ~]#vzctl start 101
#booting VM
[[email protected] ~]#vzctl exec 101 passwd
#set passwd root

Deja un comentario

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *