{"id":297,"date":"2018-12-26T11:55:28","date_gmt":"2018-12-26T14:55:28","guid":{"rendered":"http:\/\/pessoal.ect.ufrn.br\/~rafaelprazeres\/?p=297"},"modified":"2022-05-09T12:45:21","modified_gmt":"2022-05-09T15:45:21","slug":"configurando-no-de-hardware-openvz-no-debian-7","status":"publish","type":"post","link":"https:\/\/pessoal.ect.ufrn.br\/~rafaelprazeres\/index.php\/2018\/12\/26\/configurando-no-de-hardware-openvz-no-debian-7\/","title":{"rendered":"Configurando n\u00f3 de hardware OpenVZ no Debian 7"},"content":{"rendered":"<p>1 &#8211; Instala\u00e7\u00e3o do Debian 7 &#8220;wheezy&#8221;:<\/p>\n<p>* Obter o Debian 7:<\/p>\n<p>https:\/\/www.debian.org\/releases\/oldstable\/debian-installer\/<\/p>\n<p>* Configurar a m\u00eddia de instala\u00e7\u00e3o:<\/p>\n<p>http:\/\/askubuntu.com\/questions\/59551\/how-to-burn-a-iso-to-a-usb-device<\/p>\n<p><!--more--><\/p>\n<p>2 &#8211; Instalar OpenVZ no Debian:<\/p>\n<p>* Seguir guia de instala\u00e7\u00e3o do OpenVZ no Debian 7:<\/p>\n<p>https:\/\/openvz.org\/Installation_on_Debian<\/p>\n<p>* Remover todos os kernels n\u00e3o OpenVZ<\/p>\n<p>* Instalar pacote bridge-utils para configura\u00e7\u00e3o da bridge no n\u00f3 de hardware<\/p>\n<pre>root@hn1:~# apt-get install bridge-utils<\/pre>\n<p>3 &#8211; Download dos templates de SO desejados<\/p>\n<p>* Obter templates em:<\/p>\n<p>http:\/\/openvz.org\/Download\/template\/precreated<\/p>\n<p>* Os templates devem ser colocados como est\u00e3o (n\u00e3o \u00e9 necess\u00e1rio extra\u00ed-los) em \/var\/lib\/vz\/template\/cache<\/p>\n<pre>root@hn1:\/var\/lib\/vz\/template\/cache# wget -c http:\/\/download.openvz.org\/template\/precreated\/ubuntu-14.04-x86_64.tar.gz<\/pre>\n<p>4 &#8211; Configurar rede no n\u00f3 de hardware:<\/p>\n<p>* Criar \/etc\/vz\/vznet.conf com o seguinte conte\u00fado:<\/p>\n<pre>#!\/bin\/sh\n EXTERNAL_SCRIPT=\"\/usr\/local\/bin\/vznetaddbr\"<\/pre>\n<p>* Criar \/usr\/local\/bin\/vznetaddbr com o seguinte conte\u00fado:<\/p>\n<pre>#!\/bin\/sh\n#\n# Add virtual network interfaces (veth's) in a container to a bridge on CT0\n\nCONFIGFILE=\/etc\/vz\/conf\/$VEID.conf\n. $CONFIGFILE\n\nNETIFLIST=$(printf %s \"$NETIF\" |tr ';' '\\n')\n\nif [ -z \"$NETIFLIST\" ]; then\n&nbsp;&nbsp; echo &gt;&amp;2 \"According to $CONFIGFILE, CT$VEID has no veth interface configured.\"\n&nbsp;&nbsp; exit 1\nfi\n\nfor iface in $NETIFLIST; do\n&nbsp;&nbsp;&nbsp; bridge=\n&nbsp;&nbsp;&nbsp; host_ifname=\n\n&nbsp;&nbsp;&nbsp; for str in $(printf %s \"$iface\" |tr ',' '\\n'); do\n&nbsp;&nbsp; &nbsp;case \"$str\" in\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; bridge=*|host_ifname=*)\n&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;eval \"${str%%=*}=\\${str#*=}\" ;;\n&nbsp;&nbsp; &nbsp;esac\n&nbsp;&nbsp;&nbsp; done\n\n&nbsp;&nbsp;&nbsp; [ \"$host_ifname\" = \"$3\" ] ||\n&nbsp;&nbsp; &nbsp;continue\n\n&nbsp;&nbsp;&nbsp; [ -n \"$bridge\" ] ||\n&nbsp;&nbsp; &nbsp;bridge=vmbr0\n\n&nbsp;&nbsp;&nbsp; echo \"Adding interface $host_ifname to bridge $bridge on CT0 for CT$VEID\"\n&nbsp;&nbsp;&nbsp; ip link set dev \"$host_ifname\" up\n&nbsp;&nbsp;&nbsp; ip addr add 0.0.0.0\/0 dev \"$host_ifname\"\n&nbsp;&nbsp;&nbsp; echo 1 &gt;\"\/proc\/sys\/net\/ipv4\/conf\/$host_ifname\/proxy_arp\"\n&nbsp;&nbsp;&nbsp; echo 1 &gt;\"\/proc\/sys\/net\/ipv4\/conf\/$host_ifname\/forwarding\"\n&nbsp;&nbsp;&nbsp; brctl addif \"$bridge\" \"$host_ifname\"\n\n&nbsp;&nbsp;&nbsp; break\ndone\n\nexit 0<\/pre>\n<p>* Tornar \/usr\/local\/bin\/vznetaddbr execut\u00e1vel:<\/p>\n<pre>root@hn1:\/usr\/local\/bin# chmod 755 vznetaddbr<\/pre>\n<p>* Adicionar estas duas linhas no arquivo \/etc\/vz\/conf\/ve-vswap-256m.conf-sample, que \u00e9 o arquivo de configura\u00e7\u00e3o modelo definido em \/etc\/vz\/vz.conf atrav\u00e9s da vari\u00e1vel CONFIGFILE.<\/p>\n<pre>CONFIG_CUSTOMIZED=\"yes\"\n VZHOSTBR=\"br0\"<\/pre>\n<p>* Adicionar a bridge no arquivo \/etc\/network\/interfaces (substituir eth0 pela designa\u00e7\u00e3o da interface LAN do n\u00f3 de hardware):<\/p>\n<pre>&nbsp;&nbsp;&nbsp; # The first network bridge\n&nbsp;&nbsp; &nbsp;auto br0\n&nbsp;&nbsp; &nbsp;iface br0 inet static\n&nbsp;&nbsp; &nbsp; address w.x.y.z\n&nbsp;&nbsp; &nbsp; netmask a.b.c.d\n&nbsp;&nbsp; &nbsp; pre-up brctl addbr br0 &amp;&amp; brctl addif br0 eth0\n&nbsp;&nbsp; &nbsp; post-down brctl delbr br0\n\n<\/pre>\n<p>* Configurar a interface LAN do n\u00f3 de hardware para ser &#8220;inet manual&#8221; in \/etc\/network\/interfaces<\/p>\n<pre>auto eth0\niface eth0 inet manual\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; pre-up ifconfig $IFACE up\n&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; post-down ifconfig $IFACE down<\/pre>\n<p>* Adicionar estas duas linhas ao arquivo \/etc\/rc.local:<\/p>\n<pre>echo 1 &gt; \/proc\/sys\/net\/ipv4\/ip_forward\n iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE<\/pre>\n<p>* Reiniciar servidor e verificar se est\u00e1 tudo funcionando<\/p>\n<p>5 &#8211; Instalar OpenVZ Web Panel:<\/p>\n<p>* Fonte:<\/p>\n<p>http:\/\/owp.softunity.com.ru\/<\/p>\n<p>* Fatal error: Panel requires Ruby 1.8 (Ruby 1.9 is not supported)<\/p>\n<p>https:\/\/github.com\/sibprogrammer\/owp\/issues\/30<\/p>\n<p>6 &#8211; Habilitar o uso de m\u00eddias remov\u00edveis nos terminais leves<\/p>\n<p>* Esta p\u00e1gina descreve como configurar FUSE (filesystem in userspace) dentro de um container<\/p>\n<p>https:\/\/openvz.org\/FUSE<\/p>\n<p>* Debian\/Ubuntu: Voc\u00ea pode alternativamente adicionar a linha fuse dentro de \/etc\/modules, e aplicar imediatamente com o comando:<\/p>\n<pre>modprobe --first-time fuse<\/pre>\n<p>7 &#8211; Checkpointing and live migration<\/p>\n<p>* Fonte:<\/p>\n<p>https:\/\/openvz.org\/Checkpointing_and_live_migration<\/p>\n<p>* Online migration:<\/p>\n<p>vzmigrate &#8211;online &lt;host&gt; VEID<\/p>\n<p>* ssh keys<\/p>\n<p>https:\/\/openvz.org\/Ssh_keys<\/p>\n<p>* Online migration and checkpointing limitations for Linux Containers<\/p>\n<p>http:\/\/kb.odin.com\/en\/113781<\/p>\n","protected":false},"excerpt":{"rendered":"<p>1 &#8211; Instala\u00e7\u00e3o do Debian 7 &#8220;wheezy&#8221;: * Obter o Debian 7: https:\/\/www.debian.org\/releases\/oldstable\/debian-installer\/ * Configurar a m\u00eddia de instala\u00e7\u00e3o: http:\/\/askubuntu.com\/questions\/59551\/how-to-burn-a-iso-to-a-usb-device<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[1],"tags":[],"_links":{"self":[{"href":"https:\/\/pessoal.ect.ufrn.br\/~rafaelprazeres\/index.php\/wp-json\/wp\/v2\/posts\/297"}],"collection":[{"href":"https:\/\/pessoal.ect.ufrn.br\/~rafaelprazeres\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pessoal.ect.ufrn.br\/~rafaelprazeres\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pessoal.ect.ufrn.br\/~rafaelprazeres\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pessoal.ect.ufrn.br\/~rafaelprazeres\/index.php\/wp-json\/wp\/v2\/comments?post=297"}],"version-history":[{"count":6,"href":"https:\/\/pessoal.ect.ufrn.br\/~rafaelprazeres\/index.php\/wp-json\/wp\/v2\/posts\/297\/revisions"}],"predecessor-version":[{"id":411,"href":"https:\/\/pessoal.ect.ufrn.br\/~rafaelprazeres\/index.php\/wp-json\/wp\/v2\/posts\/297\/revisions\/411"}],"wp:attachment":[{"href":"https:\/\/pessoal.ect.ufrn.br\/~rafaelprazeres\/index.php\/wp-json\/wp\/v2\/media?parent=297"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pessoal.ect.ufrn.br\/~rafaelprazeres\/index.php\/wp-json\/wp\/v2\/categories?post=297"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pessoal.ect.ufrn.br\/~rafaelprazeres\/index.php\/wp-json\/wp\/v2\/tags?post=297"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}