Instalación OpenVZ es un virtualizador de sistemas operativos, más hacia el lado de servidores que desktop (asi que si queres montar una vm para instalar ubuntu, windows u otra cosa con desktop, segui de largo) La verdad que instalar OpenVZ es una papa Necesitamos agregar el repositorio de OpenVZ a yum cd /etc/yum.repos.d wget http://download.openvz.org/openvz.repo rpm --import http://download.openvz.org/RPM-GPG-Key-OpenVZ Luego, habilitar el repositorio de nuestro sistema (5.5 o 6.2) Editamos vi openvz.repo Y vemos en el ejemplo, que el repo para CentOS 5.5 está deshabilitado y habilitado para 6.2 [openvz-kernel-rhel5] name=OpenVZ RHEL5-based kernel #baseurl=http://download.openvz.org/kernel/branches/rhel5-2.6.18/current/ mirrorlist=http://download.openvz.org/kernel/mirrors-rhel5-2.6.18 enabled=0 gpgcheck=1 gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ [...] [openvz-kernel-rhel6] name=OpenVZ RHEL6-based kernel #baseurl=http://download.openvz.org/kernel/branches/rhel6-2.6.32/current/ mirrorlist=http://download.openvz.org/kernel/mirrors-rhel6-2.6.32 enabled=1 gpgcheck=1 gpgkey=http://download.openvz.org/RPM-GPG-Key-OpenVZ [...] Listo, ahora, instalamos el kernel de OpenVZ, correspondiente a nuestra arquitectura [root@server1 yum.repos.d]# yum search vzkernel [...] vzkernel.i686 : The Linux kernel vzkernel.x86_64 : The Linux kernel vzkernel-debug.i686 : The Linux kernel compiled with extra debugging enabled vzkernel-debug.x86_64 : The Linux kernel compiled with extra debugging enabled vzkernel-debug-devel.i686 : Development package for building kernel modules to match the debug kernel vzkernel-debug-devel.x86_64 : Development package for building kernel modules to match the debug kernel vzkernel-devel.i686 : Development package for building kernel modules to match the kernel vzkernel-devel.x86_64 : Development package for building kernel modules to match the kernel vzkernel-firmware.noarch : Firmware files used by the Linux kernel vzkernel-headers.i686 : Header files for the Linux kernel for use by glibc vzkernel-headers.x86_64 : Header files for the Linux kernel for use by glibc [root@server1 yum.repos.d]#yum install vzkernel Bien, ahora tenemos que estar seguros que está agregado en menu.lst como default less /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/mapper/vg_server1-lv_root # initrd /initrd-[generic-]version.img #boot=/dev/sda default=0 timeout=5 splashimage=(hd0,0)/grub/splash.xpm.gz hiddenmenu title CentOS Linux OpenVZ (2.6.32-042stab020.1) root (hd0,0) kernel /vmlinuz-2.6.32-042stab020.1 ro root=/dev/mapper/vg_server1-lv_root rd_LVM_LV=vg_server1/lv_root rd_LVM_LV=vg_server1/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=de crashkernel=auto rhgb quiet initrd /initramfs-2.6.32-042stab020.1.img title CentOS (2.6.32-71.el6.x86_64) root (hd0,0) kernel /vmlinuz-2.6.32-71.el6.x86_64 ro root=/dev/mapper/vg_server1-lv_root rd_LVM_LV=vg_server1/lv_root rd_LVM_LV=vg_server1/lv_swap rd_NO_LUKS rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=de crashkernel=auto rhgb quiet initrd /initramfs-2.6.32-71.el6.x86_64.img Bien, ahora, algunas herramientas: yum install vzctl vzquota ( Ya casi casi, terminamos ) Configurar sysctl.conf con los siguientes parámetros: vi /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 [...] sysctl -p #para releer sysctl Ahora, esto es importante: si la direccion IP de las maquinas virtuales estan en distintas subnets que el host, hay que realizar el paso siguiente, o no se habrá conectividad!! vi /etc/vz/vz.conf [...] NEIGHBOUR_DEVS=all [...] Listo! Eso es todo!! Por cierto, deshabilita SElinux y reinicia para bootear con el kernel de OpenVZ Creación de una VM desde la shell Ahora, vamos a crear nuestra primer vm con OpenVZ En mi caso, en el ambiente de testing, elegí descargar un template desde el sitio original (http://wiki.openvz.org/Download/template/precreated) . En el ejemplo, vamos a virtualizar un Debian6 sobre un Centos6 Bajemos el template: cd /vz/template/cache wget http://download.openvz.org/template/precreated/debian-6.0-x86.tar.gz Configuremos la VM: vzctl create 101 --ostemplate debian-6.0-x86 --config basic # creamos el template vzctl set 101 --onboot yes --save # al inicio del SO host vzctl set 101 --hostname test.example.com --save # le ponemos un nombre fqdn vzctl set 101 --ipadd 192.168.0.101 --save # asignamos la ip vzctl set 101 --nameserver 8.8.8.8 --nameserver 8.8.4.4 --nameserver 145.253.2.75 --save # y ahora los DNS a utilizar vzctl exec 101 passwd # especificamos un password para root vzctl start 101 #levantamos la instancia 101 representa un ID unico para cada instancia. Yo uso el ultimo octeto de la IP Bueno, ahora podemos entrar directamente con vzctl enter 101 o con ssh [email protected] En caso de necesitar eliminar una vm, antes tenemos que pararla y luego, proceder al borrado: vzctl stop 101 vzctl destroy 101 ¿Cúantas VM tengo en el sistema? # vzlist -a CTID NPROC STATUS IP_ADDR HOSTNAME 101 16 running 10.0.0.101 test.example.com Qué recursos está utilizando la VM ? # vzctl exec 101 cat /proc/user_beancounters (si pego el texto, no se ve como corresponde) Importante:: si algun valor de la columna failcnt es distinto de 0, significa que habrá que ampliar algun recurso Instalación del Panel de Control La instalación del Panel, es la parte más complicada: wget -O - http://ovz-web-panel.googlecode.com/svn/installer/ai.sh | sh Solito se encarga de instalar las dependencias de ruby Una vez terminado, hay que ingresar a http://:3000 con usuario y clave default, de admin/admin Agregamos el servidor local Bajamos un template de servidor (plantilla) (esperamos un rato, segun la velocidad de descarga) y creamos una VM
Datos archivados del Taringa! original
6puntos
0visitas
0comentarios
Actividad nueva en Posteamelo
0puntos
5visitas
0comentarios
Dar puntos: