vserver vweb4 build --force -m debootstrap --hostname vweb4.net.caen --netdev eth0 --interface 192.168.0.2/24 -- -d sarge -m http://ftp.fr.debian.org/debian/
Si vous utilisez un proxy apt, cela devient par exemple:
vserver vweb4 build --force -m debootstrap --hostname vweb4.domaine.zar --netdev eth0 --interface 192.168.1.246/24 -- -d lenny -m http://192.168.1.80:9999/debian/
# apt-get install rpm schedutils # mkdir /etc/rpm #cd /usr/local #wget http://people.linux-vserver.org/~dhozac/t/uv-testing/util-vserver-0.30.216-pre2794.tar.bz2 #tar jxvf util-vserver-0.30.216-pre2794.tar.bz2 && mv util-vserver-0.30.216-pre2794.tar.bz2 src #cd util-vserver-0.30.216-pre2794 #./configure --with-vrootdir=/opt/vservers #make #make install #cd /usr/local #wget http://yum.baseurl.org/download/3.2/yum-3.2.1.tar.gz #cp /usr/local/util-vserver-0.30.216-pre2794/contrib/yum-3.2.1-chroot.patch . #tar ztvf yum-3.2.1.tar.gz #cd yum-3.2.1 #patch -p1 < ../yum-3.2.1-chroot.patch #make #make install #vserver vweb2 build --force -m yum --hostname vweb2.dom2.pat --interface eth0:192.168.1.243/24 -- -d centos5 #vyum vserver2 -- install yum wget sqlite #vserver vweb2 pkgmgmt internalize #vserver vweb2 enter
Enjoy :)
A: When you shut down a guest (i.e. vserver foo stop), the IP is brought down on the host also. If this IP happens to be the primary IP of the host, the kernel will not only bring down the primary IP, but also all secondary IP addresses. But in very recent kernels, there is an option settable which prevents that nasty feature. It's called "alias promotion". You may set it via sysctl by adding net.ipv4.conf.all.promote_secondaries=1 in /etc/sysctl.conf or via sysctl command line.
vkill --xid <xid> -s 15; sleep 2; vkill --xid <xid> -s 9
Exemple: j'ai 5 vservers tournant sous debian-etch. Lors d'un apt-get update et install si l'on suit la méthode classique on va se retrouver avec 6 fois (hote+vservers) les mêmes paquets dans /var/cache/apt/archives.
Par contre si l'on monte depuis l'hote le repertoire /var/cache/apt/archives sur /rep_des_vservers/vserver_name/var/cache/apt/archive on aura une et une seule copie des paquets.
Exemple de scripts:
En supposant que les vservers soient configures comme suit :
srvweb:/# vserver-stat CTX PROC VSZ RSS userTIME sysTIME UPTIME NAME 20 55 376.7M 82M 0m53s87 1m01s20 19h08m57 vweb1 (debian) 21 21 584.4M 74.4M 0m06s22 0m02s76 19h08m52 vweb2 (debian) 22 12 167.7M 87.3M 0m18s28 0m10s58 19h08m43 vweb3 (debian) 23 8 39.3M 15.6M 0m03s22 0m01s62 19h08m40 vweb4 (debian) 24 5 47.3M 13M 0m01s20 0m00s72 19h08m39 vweb5 (fedora)
montage depuis l'hôte:
#!/bin/bash vnamespace -e 20 mount --bind /var/cache/apt/archives/ /opt/vservers/vweb1/var/cache/apt/archives/ vnamespace -e 21 mount --bind /var/cache/apt/archives/ /opt/vservers/vweb2/var/cache/apt/archives/ vnamespace -e 22 mount --bind /var/cache/apt/archives/ /opt/vservers/vweb3/var/cache/apt/archives/ vnamespace -e 23 mount --bind /var/cache/apt/archives/ /opt/vservers/vweb4/var/cache/apt/archives/
demontage depuis l'hôte:
#!/bin/bash vnamespace -e 20 umount /opt/vservers/vweb1/var/cache/apt/archives/ vnamespace -e 21 umount /opt/vservers/vweb2/var/cache/apt/archives/ vnamespace -e 22 umount /opt/vservers/vweb3/var/cache/apt/archives/ vnamespace -e 23 umount /opt/vservers/vweb4/var/cache/apt/archives/
Une explication pour configurer un vserver avec une ip publique lorsque l'hôte ne possède qu'une interface
http://ext23.pmenier.net/wiki/index.php?title=reseau-1-ip
http://wiki.linux-vserver.org/Capabilities_and_Flags
The init style should go in a file containing a single word: sysv, plain, etc.
/etc/vservers/<NAME>/apps/init/style
http://linux-vserver.org/util-vserver:InitStyles
Exemple:
srvglus238:~# vattribute --get --xid 40003
bcapabilities: CHOWN,DAC_OVERRIDE,DAC_READ_SEARCH,FOWNER,FSETID,KILL,SETGID,SETUID,SETPCAP,NET_BIND_SERVICE,SYS_CHROOT,SYS_PTRACE,SYS_BOOT,SYS_TTY_CONFIG,LEASE,AUDIT_WRITE ccapabilities: set_utsname,raw_icmp flags: fakeinit,virt_uptime,hide_netif,state_init,state_admin,sc_helper
/usr/local/lib/util-vserver/distributions/debian/initpost:echo ">>> Executing post install script ... "
Les dernieres versions stables sont disponibles sur http://linux-vserver.org
Les versions en cours de développement : http://people.linux-vserver.org/~dhozac/p/uv/experimental/
http://people.linux-vserver.org/~dhozac/t/uv-testing/
Compil : ./configure --enable-apis=NOLEGACY --with-vrootdir=/opt/vservers ou ./configure --with-vrootdir=/opt/vservers
Les dernieres versions stables sont disponibles sur http://linux-vserver.org
Les versions de développement : http://vserver.13thfloor.at/Experimental/
ou
http://people.linux-vserver.org/~dhozac/p/k/
http://www.nongnu.org/util-vserver/doc/conf/configuration.html