OpenVZ install on Debian 6.0

mkdir /var/openvz-dl
cd /var/openvz-dl

86
wget http://download.openvz.org/kernel/branches/rhel6-2.6.32/042stab062.2/vzkernel-2.6.32-042stab062.2.i686.rpm
wget http://download.openvz.org/kernel/branches/rhel6-2.6.32/042stab062.2/vzkernel-devel-2.6.32-042stab062.2.i686.rpm
wget http://download.openvz.org/utils/vzctl/4.0/vzctl-4.0-1.i386.rpm
wget http://download.openvz.org/utils/vzctl/4.0/vzctl-core-4.0-1.i386.rpm
wget http://download.openvz.org/utils/ploop/1.5/ploop-1.5-1.i386.rpm
wget http://download.openvz.org/utils/ploop/1.5/ploop-lib-1.5-1.x86_64.rpm
wget http://download.openvz.org/utils/vzquota/3.1/vzquota-3.1-1.i386.rpm

64
wget http://download.openvz.org/kernel/branches/rhel6-2.6.32/042stab062.2/vzkernel-2.6.32-042stab062.2.x86_64.rpm
wget http://download.openvz.org/kernel/branches/rhel6-2.6.32/042stab062.2/vzkernel-devel-2.6.32-042stab062.2.x86_64.rpm
wget http://download.openvz.org/utils/vzctl/4.0/vzctl-4.0-1.x86_64.rpm
wget http://download.openvz.org/utils/vzctl/4.0/vzctl-core-4.0-1.x86_64.rpm
wget http://download.openvz.org/utils/ploop/1.5/ploop-1.5-1.x86_64.rpm
wget http://download.openvz.org/utils/ploop/1.5/ploop-lib-1.5-1.x86_64.rpm
wget http://download.openvz.org/utils/vzquota/3.1/vzquota-3.1-1.x86_64.rpm

apt-get install fakeroot alien
fakeroot alien --to-deb --scripts --keep-version vz*.rpm ploop*.rpm
dpkg -i vz*.deb ploop*.deb --force-overwrite
update-grub

update-rc.d vz defaults
update-rc.d vzeventd defaults

reboot

cd /vz/template/cache
wget http://download.openvz.org/template/precreated/debian-6.0-x86_64.tar.gz
---More pre-mades at http://wiki.openvz.org/Download/template/precreated

cp /usr/lib64/libvzctl-4.0.so /usr/lib/libvzctl-4.0.so
apt-get install libcgroup1

#Make new box (with ID 1)
vzctl create 1 --ostemplate debian-6.0-x86_64

#Static IP networking:
vzctl set 1 --nameserver 192.168.1.1 --save
vzctl set 1 --ipadd 192.168.1.103 --save

#Start box
vzctl start 1

Bridged networking

NOT WORKING YET

aptitude install bridge-utils
ifdown eth0
brctl addbr br0
brctl addif br0 eth0
ifconfig eth0 0
dhclient br0

vzctl set 1 --netif_add eth0,,,,br0 --save
----OR----
-----
ifconfig eth0
*write down mac address*
easymac.sh -R
*write down new address*
vzctl set 1 --veth_add veth1.0,08:00:27:42:1e:15,eth0,00:0C:29:22:D7:C1 --save
-----

ifconfig veth1.0 0
brctl addif br0 veth1.0
vzctl enter 1
dhcpcd eth0
dhclient eth0

Copy openvz container to new template

Close the openvz container first!

#Create a file /tmp/excludes.excl with these contents:

.bash_history
/dev/*
/mnt/*
/tmp/*
/proc/*
/sys/*
/usr/src/*

#Then create the tar. But remember, when the system is 'not' using udev, you have to look into /proc/ after creating your container because some devices might not exist. (/dev/ptmx or others)

tar --numeric-owner -cjpf /var/mysystem.tar.bz2 / -X /tmp/excludes.excl

Leave a Reply

Your email address will not be published. Required fields are marked *