Configurando nó de hardware OpenVZ no Debian 7


1 – Instalação do Debian 7 “wheezy”:

* Obter o Debian 7:

https://www.debian.org/releases/oldstable/debian-installer/

* Configurar a mídia de instalação:

http://askubuntu.com/questions/59551/how-to-burn-a-iso-to-a-usb-device

2 – Instalar OpenVZ no Debian:

* Seguir guia de instalação do OpenVZ no Debian 7:

https://openvz.org/Installation_on_Debian

* Remover todos os kernels não OpenVZ

* Instalar pacote bridge-utils para configuração da bridge no nó de hardware

root@hn1:~# apt-get install bridge-utils

3 – Download dos templates de SO desejados

* Obter templates em:

http://openvz.org/Download/template/precreated

* Os templates devem ser colocados como estão (não é necessário extraí-los) em /var/lib/vz/template/cache

root@hn1:/var/lib/vz/template/cache# wget -c http://download.openvz.org/template/precreated/ubuntu-14.04-x86_64.tar.gz

4 – Configurar rede no nó de hardware:

* Criar /etc/vz/vznet.conf com o seguinte conteúdo:

#!/bin/sh
 EXTERNAL_SCRIPT="/usr/local/bin/vznetaddbr"

* Criar /usr/local/bin/vznetaddbr com o seguinte conteúdo:

#!/bin/sh
#
# Add virtual network interfaces (veth's) in a container to a bridge on CT0

CONFIGFILE=/etc/vz/conf/$VEID.conf
. $CONFIGFILE

NETIFLIST=$(printf %s "$NETIF" |tr ';' '\n')

if [ -z "$NETIFLIST" ]; then
   echo >&2 "According to $CONFIGFILE, CT$VEID has no veth interface configured."
   exit 1
fi

for iface in $NETIFLIST; do
    bridge=
    host_ifname=

    for str in $(printf %s "$iface" |tr ',' '\n'); do
    case "$str" in
        bridge=*|host_ifname=*)
        eval "${str%%=*}=\${str#*=}" ;;
    esac
    done

    [ "$host_ifname" = "$3" ] ||
    continue

    [ -n "$bridge" ] ||
    bridge=vmbr0

    echo "Adding interface $host_ifname to bridge $bridge on CT0 for CT$VEID"
    ip link set dev "$host_ifname" up
    ip addr add 0.0.0.0/0 dev "$host_ifname"
    echo 1 >"/proc/sys/net/ipv4/conf/$host_ifname/proxy_arp"
    echo 1 >"/proc/sys/net/ipv4/conf/$host_ifname/forwarding"
    brctl addif "$bridge" "$host_ifname"

    break
done

exit 0

* Tornar /usr/local/bin/vznetaddbr executável:

root@hn1:/usr/local/bin# chmod 755 vznetaddbr

* Adicionar estas duas linhas no arquivo /etc/vz/conf/ve-vswap-256m.conf-sample, que é o arquivo de configuração modelo definido em /etc/vz/vz.conf através da variável CONFIGFILE.

CONFIG_CUSTOMIZED="yes"
 VZHOSTBR="br0"

* Adicionar a bridge no arquivo /etc/network/interfaces (substituir eth0 pela designação da interface LAN do nó de hardware):

    # The first network bridge
    auto br0
    iface br0 inet static
     address w.x.y.z
     netmask a.b.c.d
     pre-up brctl addbr br0 && brctl addif br0 eth0
     post-down brctl delbr br0

* Configurar a interface LAN do nó de hardware para ser “inet manual” in /etc/network/interfaces

auto eth0
iface eth0 inet manual
      pre-up ifconfig $IFACE up
      post-down ifconfig $IFACE down

* Adicionar estas duas linhas ao arquivo /etc/rc.local:

echo 1 > /proc/sys/net/ipv4/ip_forward
 iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE

* Reiniciar servidor e verificar se está tudo funcionando

5 – Instalar OpenVZ Web Panel:

* Fonte:

http://owp.softunity.com.ru/

* Fatal error: Panel requires Ruby 1.8 (Ruby 1.9 is not supported)

https://github.com/sibprogrammer/owp/issues/30

6 – Habilitar o uso de mídias removíveis nos terminais leves

* Esta página descreve como configurar FUSE (filesystem in userspace) dentro de um container

https://openvz.org/FUSE

* Debian/Ubuntu: Você pode alternativamente adicionar a linha fuse dentro de /etc/modules, e aplicar imediatamente com o comando:

modprobe --first-time fuse

7 – Checkpointing and live migration

* Fonte:

https://openvz.org/Checkpointing_and_live_migration

* Online migration:

vzmigrate –online <host> VEID

* ssh keys

https://openvz.org/Ssh_keys

* Online migration and checkpointing limitations for Linux Containers

http://kb.odin.com/en/113781


Leave a Reply

Your email address will not be published.