Sunday, August 28, 2011

OpenVZ on Ubuntu 8.10

ther OpenVZ Ubuntu 8.10 guides that I’ve seen have you use the old lenny repository; since this no longer exists let’s try another way!
I used a 64-bit machine; steps will be the same for 32-bit. If you have 64-bit and just want to download the kernel I used:
Now let’s build the kernel.
cd /usr/src
tar xjf linux-2.6.27.tar.bz2
cd linux-2.6.27
gunzip patch-briullov.1-combined.gz
cp kernel-2.6.27-*.config.ovz .config
patch -p1 < patch*
make oldconfig
make modules_install install
cd /boot
mkinitramfs -o /boot/initrd.img-2.6.27 2.6.27
vi /boot/grub/menu.lst
#Replace uuid entries with your disks uuid
title           Ubuntu 8.10 OpenVZ 2.6.27
uuid            2d5b2466-4bdf-44c7-b8e5-4d46a9f927c8
kernel          /boot/vmlinuz-2.6.27 root=UUID=2d5b2466-4bdf-44c7-b8e5-4d46a9f927c8 ro quiet splash
initrd          /boot/initrd.img-2.6.27
grub-install /dev/sda
apt-get install vzctl vzquota
If everything went according to plan, you’ll boot into your new kernel. If you get a kernel panic, or things are not working as expected, you may have to
make menuconfig
Once the kernel is working, let’s create a container.
cd /var/lib/vz/private
mkdir 1
debootstrap hardy 1
When you see:
#I: Base system installed successfully.
You can continue.
vi /etc/vz/dists/default
#Change redhat to debian OR copy ubuntu.conf to default
Create the container and set an IP
vzctl set 1 –applyconfig vps.basic –save
vzctl set 1 –ipadd –save
vzctl set 1 –nameserver –save
vzctl start 1
At this time you cannot enter the container. You will receive the error
Unable to open pty: No such file or directory
To fix this:
vzctl exec 1 update-rc.d -f udev remove
Restart and enter the container
vzctl restart 1
vzctl enter 1
If network doesn’t work add to /etc/sysctl.conf on server (not container):

No comments: