INSTALLATION OPENVZ (pour Debian 7 wheezy) …n.grassa.free.fr/TP/OpenVZ.pdf · TP OPENVZ RSI...

4
TP OPENVZ RSI GRASSA Noureddine INSTALLATION OPENVZ (pour Debian 7 wheezy) REMARQUE : Utiliser pour ce TP la version DebianWheezy. Je trouve divers problèmes avec la version Debian Jessie. generic@openvz:~$ su Mot de passe : root@openvz:~# apt-get update root@openvz:~# apt-get install apt-transport-https root@openvz:~# echo "deb https://download.openvz.org/debian wheezy main" >> /etc/apt/sources.list root@openvz:~# wget https://download.openvz.org/debian/archive.key root@openvz:~# apt-key add archive.key root@openvz:~# apt-get update root@openvz:~# apt-get install linux-image-openvz-amd64 Puis éditez le fichier /etc/sysctl.conf Et Ajouter les valeurs suivantes: # On Hardware Node we generally need # packet forwarding enabled and proxy arp disabled net.ipv4.ip_forward = 1 # Enables source route verification net.ipv4.conf.all.rp_filter = 1 # Enables the magic-sysrq key kernel.sysrq = 1 # We do not want all our interfaces to send redirects net.ipv4.conf.default.send_redirects = 1 net.ipv4.conf.all.send_redirects = 0 root@openvz:~# apt-get install vzctl vzquota ploop vzstats Puis rebooter et choisissez le noyau à base de OpenVZ : #Téléchargement du template root@openvz:~# cd /var/lib/vz/template/cache root@openvz:~# wget http://download.openvz.org/template/precreated/ ubuntu-12.04- x86.tar.gz #Création du VPS root@openvz:~# vzctl create 101 --ostemplate ubuntu-12.04-x86 Creating image: /var/lib/vz/private/101.tmp/root.hdd/root.hdd size=2306867K Creating delta /var/lib/vz/private/101.tmp/root.hdd/root.hdd bs=2048 size=4614144 sectors v2 Storing /var/lib/vz/private/101.tmp/root.hdd/DiskDescriptor.xml Opening delta /var/lib/vz/private/101.tmp/root.hdd/root.hdd Adding delta dev=/dev/ploop28765 .......... CT configuration saved to /etc/vz/conf/101.conf Container private area was created

Transcript of INSTALLATION OPENVZ (pour Debian 7 wheezy) …n.grassa.free.fr/TP/OpenVZ.pdf · TP OPENVZ RSI...

Page 1: INSTALLATION OPENVZ (pour Debian 7 wheezy) …n.grassa.free.fr/TP/OpenVZ.pdf · TP OPENVZ RSI GRASSA ... Utiliser pour ce TP la version DebianWheezy. Je trouve divers problèmes avec

TP OPENVZ RSI GRASSA Noureddine

INSTALLATION OPENVZ (pour Debian 7 wheezy) REMARQUE : Utiliser pour ce TP la version DebianWheezy. Je trouve divers problèmes avec la version Debian Jessie. generic@openvz:~$ su Mot de passe : root@openvz:~# apt-get update root@openvz:~# apt-get install apt-transport-https root@openvz:~# echo "deb https://download.openvz.org/debian wheezy main" >> /etc/apt/sources.list root@openvz:~# wget https://download.openvz.org/debian/archive.key root@openvz:~# apt-key add archive.key root@openvz:~# apt-get update root@openvz:~# apt-get install linux-image-openvz-amd64 Puis éditez le fichier /etc/sysctl.conf Et Ajouter les valeurs suivantes: # On Hardware Node we generally need # packet forwarding enabled and proxy arp disabled net.ipv4.ip_forward = 1 # Enables source route verification net.ipv4.conf.all.rp_filter = 1 # Enables the magic-sysrq key kernel.sysrq = 1 # We do not want all our interfaces to send redirects net.ipv4.conf.default.send_redirects = 1 net.ipv4.conf.all.send_redirects = 0 root@openvz:~# apt-get install vzctl vzquota ploop vzstats Puis rebooter et choisissez le noyau à base de OpenVZ : #Téléchargement du template root@openvz:~# cd /var/lib/vz/template/cache root@openvz:~# wget http://download.openvz.org/template/precreated/ ubuntu-12.04-x86.tar.gz #Création du VPS root@openvz:~# vzctl create 101 --ostemplate ubuntu-12.04-x86 Creating image: /var/lib/vz/private/101.tmp/root.hdd/root.hdd size=2306867K Creating delta /var/lib/vz/private/101.tmp/root.hdd/root.hdd bs=2048 size=4614144 sectors v2 Storing /var/lib/vz/private/101.tmp/root.hdd/DiskDescriptor.xml Opening delta /var/lib/vz/private/101.tmp/root.hdd/root.hdd Adding delta dev=/dev/ploop28765 .......... CT configuration saved to /etc/vz/conf/101.conf Container private area was created

Page 2: INSTALLATION OPENVZ (pour Debian 7 wheezy) …n.grassa.free.fr/TP/OpenVZ.pdf · TP OPENVZ RSI GRASSA ... Utiliser pour ce TP la version DebianWheezy. Je trouve divers problèmes avec

TP OPENVZ RSI GRASSA Noureddine

root@openvz:~# vzctl set 101 --ipadd 10.0.2.16 --save CT configuration saved to /etc/vz/conf/101.conf root@openvz:~# vzctl set 101 --nameserver 8.8.8.8 --save CT configuration saved to /etc/vz/conf/101.conf root@openvz:~# vzctl set 101 --hostname ubuntu12 --save CT configuration saved to /etc/vz/conf/101.conf root@openvz:~# vzctl set 101 --userpasswd root:system --save Starting container... Opening delta /var/lib/vz/private/101/root.hdd/root.hdd Adding delta dev=/dev/ploop28765 img=/var/lib/vz/private/101/root.hdd/root.hdd (rw) Mounting /dev/ploop28765p1 at /var/lib/vz/root/101 fstype=ext4 data='balloon_ino=12,' Container is mounted Container start in progress... Killing container ... Container was stopped Unmounting file system at /var/lib/vz/root/101 Unmounting device /dev/ploop28765 Container is unmounted CT configuration saved to /etc/vz/conf/101.conf root@openvz:~# vzctl set 101 --diskspace 3G:3G --save Opening delta /var/lib/vz/private/101/root.hdd/root.hdd Adding delta dev=/dev/ploop28765 img=/var/lib/vz/private/101/root.hdd/root.hdd (rw) Mounting /dev/ploop28765p1 at /var/lib/vz/private/101/root.hdd/root.hdd.mnt fstype=ext4 data='balloon_ino=12,' Storing /var/lib/vz/private/101/root.hdd/DiskDescriptor.xml.tmp Growing dev=/dev/ploop28765 size=4614144 sectors (new size=6291456) resize2fs 1.42.5 (29-Jul-2012) Le système de fichiers de /dev/ploop28765p1 est monté sur /var/lib/vz/private/101/root.hdd/root.hdd.mnt ; le changement de taille doit être effectué en ligne old_desc_blocks = 1, new_desc_blocks = 1 Le système de fichiers /dev/ploop28765p1 a maintenant une taille de 785920 blocs. Unmounting file system at /var/lib/vz/private/101/root.hdd/root.hdd.mnt Unmounting device /dev/ploop28765 CT configuration saved to /etc/vz/conf/101.conf root@openvz:~# vzctl start 101 Starting container... Opening delta /var/lib/vz/private/101/root.hdd/root.hdd Adding delta dev=/dev/ploop28765 img=/var/lib/vz/private/101/root.hdd/root.hdd (rw) Mounting /dev/ploop28765p1 at /var/lib/vz/root/101 fstype=ext4 data='balloon_ino=12,' Container is mounted Adding IP address(es): 10.0.2.16 vps-net_add WARNING: Device list is empty vps-net_add WARNING: Device list is empty Setting CPU units: 1000 Container start in progress... root@openvz:~# vzctl enter 101 entered into CT 101 root@ubuntu12:/# pwd

Page 3: INSTALLATION OPENVZ (pour Debian 7 wheezy) …n.grassa.free.fr/TP/OpenVZ.pdf · TP OPENVZ RSI GRASSA ... Utiliser pour ce TP la version DebianWheezy. Je trouve divers problèmes avec

TP OPENVZ RSI GRASSA Noureddine

/ root@ubuntu12:/# ifconfig lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) venet0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:127.0.0.2 P-t-P:127.0.0.2 Bcast:0.0.0.0 Mask:255.255.255.255 UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1 RX packets:8 errors:0 dropped:0 overruns:0 frame:0 TX packets:8 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:656 (656.0 B) TX bytes:432 (432.0 B) venet0:0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 inet addr:10.0.2.16 P-t-P:10.0.2.16 Bcast:0.0.0.0 Mask:255.255.255.255 UP BROADCAST POINTOPOINT RUNNING NOARP MTU:1500 Metric:1 SUR UN AUTRE TREMINAL root@openvz:~# vzlist CTID NPROC STATUS IP_ADDR HOSTNAME 101 20 running 10.0.2.16 ubuntu12 root@openvz:~# vzctl stop 101 Stopping container ... Container was stopped vps-net_del WARNING: Device list is empty Unmounting file system at /var/lib/vz/root/101 Unmounting device /dev/ploop28765 Container is unmounted root@openvz:~# vzlist Container(s) not found root@openvz:~# vzctl destroy 101 Destroying container private area: /var/lib/vz/private/101 Container private area was destroyed root@openvz:~#

Installation de OpenVZ Web Panel root@openvz:~# wget -O - http://ovz-web-panel.googlecode.com/svn/installer/ai.sh | sh

L’ors de l’installation il se peut que vous obtenez une erreur liée à Ruby. Il suffit simplement de changer la version de Ruby de 1.9 à 1.8 avec les commandes suivantes: root@openvz:~# apt-get install ruby-switch

Page 4: INSTALLATION OPENVZ (pour Debian 7 wheezy) …n.grassa.free.fr/TP/OpenVZ.pdf · TP OPENVZ RSI GRASSA ... Utiliser pour ce TP la version DebianWheezy. Je trouve divers problèmes avec

TP OPENVZ RSI GRASSA Noureddine

root@openvz:~# ruby-switch --set ruby1.8 root@openvz:~# apt-get install ruby-net-ssh

Et maintenant vous pouvez relancer l’installation de OpenVZ Web Panel: root@openvz:~# wget -O - http://ovz-web-panel.googlecode.com/svn/installer/ai.sh | sh root@openvz:~# /etc/init.d/owp restart Une fois l’installation d’OpenVZ Web Panel terminée vous pouvez y accéder via votre navigateur internet préféré via l’IP de votre serveur OpenVZ et en utilisant le port 3000. Utilisez les logins admin/admin pour vous connecter à l’Interface web. Vous accéder alors au dashboard de OpenVZ.

Annexe : Si problème d'@ip pour le noyau openVZ. entrez dans /etc/network/interfaces ajouter : auto eth0 iface eth0 inet dhcp et sauvegarder puis #ifup eth0