Changes between Initial Version and Version 1 of GiB-Implementation


Ignore:
Timestamp:
09/19/12 08:04:32 (9 years ago)
Author:
zbertils@bbn.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GiB-Implementation

    v1 v1  
     1= Installing OpenVZ on Ubuntu 10.04 =
     2
     3These instructions have been taken mostly from https://help.ubuntu.com/community/OpenVZ with some modifications. The instructions on that page are outdated or broken in some areas. The correct installation is below. The original instructions state OpenVZ can be installed from RPM files, but some of the dependencies are broken. The best way to install OpenVZ on Ubuntu 10.04 is to use the set of instructions below. These instructions only apply to the desktop version referred to in step 1.
     4
     5=== Setting up OpenVZ ===
     6
     71. Create a [https://www.virtualbox.org VirtualBox] container, and install Ubuntu 10.04 LTS from http://releases.ubuntu.com/lucid/ubuntu-10.04.4-desktop-i386.iso. For easy use you can optionally install Guest Additions on the Ubuntu VM to copy-paste commands in the terminal from your host machine.
     8
     92. Before getting started make sure the machine is up to date.[[br]]
     10    `sudo apt-get update`[[br]]
     11    `sudo apt-get upgrade`
     12
     133. Reconfigure dash. When the "Configuring dash" screen appears select NO.[[br]]
     14    `sudo dpkg-reconfigure dash`
     15
     164. Install required packages to compile the kernel. This will be needed when the OpenVZ kernel is compiled.[[br]]
     17    `sudo apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 module-assistant debhelper build-essential bridge-utils`
     18
     195. Set the following variables that will be used.[[br]]
     20    `Variant="linux-image-generic"`[[br]]
     21    `VersionAppendix="-openvz"`[[br]]
     22    `MyConfigFile="kernel-2.6.32-i686.config.ovz"`[[br]]
     23
     246. Set the build dependencies for OpenVZ[[br]]
     25    `Package="$(apt-cache showpkg $Variant | grep "^2\.6\.32" | grep "linux-image")"`[[br]]
     26    `Package=$(ReturnWord () { echo $3; }; ReturnWord $Package)`[[br]]
     27    `sudo apt-get build-dep --no-install-recommends $Package`[[br]]
     28
     297. Prepare the linux headers before compiling, and create the configuration for the kernel.[[br]]
     30    `sudo m-a prepare`[[br]]
     31    `sudo kernel-packageconfig`
     32
     339. Set up multi-core support. This step may not be necessary if your VM is only using one core, but it does not hurt to execute this line anyway.[[br]]
     34    `Cores=$(Nr () { echo $#; }; Nr $(grep "processor" /proc/cpuinfo | cut -f2 -d":"))`[[br]]
     35    `echo "CONCURRENCY_LEVEL := $(($Cores + 1))" | sudo tee -a /etc/kernel-pkg.conf`[[br]]
     36
     3710. Download the linux kernel source code.[[br]]
     38    `cd /usr/src`[[br]]
     39    `sudo wget http://archive.ubuntu.com/ubuntu/pool/main/l/linux/linux_2.6.32.orig.tar.gz`
     40
     4111. Get the OpenVZ patch for the linux kernel, and the OpenVZ kernel itself.[[br]]
     42    `sudo wget http://download.openvz.org/kernel/branches/2.6.32/current/patches/patch-feoktistov.1-combined.gz`[[br]]
     43    `sudo wget http://download.openvz.org/kernel/branches/2.6.32/current/configs/$MyConfigFile`
     44
     4512. Unpack the source code.[[br]]
     46    `sudo rm -fR linux-2.6.32`[[br]]
     47    `sudo tar -xpf linux_2.6.32.orig.tar.gz`[[br]]
     48    `sudo rm -fR "linux-2.6.32$VersionAppendix"`[[br]]
     49    `sudo mv linux-2.6.32 "linux-2.6.32$VersionAppendix"`[[br]]
     50    `sudo rm linux`[[br]]
     51    `sudo ln -s "linux-2.6.32$VersionAppendix" linux`
     52
     5313. Apply the OpenVZ patch to the kernel.[[br]]
     54    `cd /usr/src/linux`[[br]]
     55    `sudo gunzip -dc /usr/src/patch-feoktistov.1-combined.gz | sudo patch -p1 --batch`[[br]]
     56    `sudo cp -f "/usr/src/$MyConfigFile" .config`[[br]]
     57    `sudo make oldconfig`
     58
     5914. One of the make files has a bug in it that needs to be fixed.[[br]]
     60    `sudo gedit Documentation/lguest/Makefile`
     61
     62Change the following lines;
     63    `all: lguest`[[br]]
     64
     65    `clean:`[[br]]
     66            `rm -f lguest`
     67
     68To be the following;
     69    `all:`[[br]]
     70
     71    `clean:`[[br]]
     72            `rm -f lguest`
     73
     7415. Now build the OpenVZ kernel. '''WARNING''': This may take some time, upwards of 1 or 2 hours.[[br]]
     75    `cd /usr/src/linux`[[br]]
     76    `sudo make-kpkg --initrd --append-to-version=$VersionAppendix --revision=1 kernel_image kernel_headers`[[br]]
     77
     7816. Install the OpenVZ kernels that were just built.[[br]]
     79    `cd /usr/src`[[br]]
     80    `sudo dpkg -i linux-image-2.6.32.28-openvz_1_i386.deb`[[br]]
     81    `sudo dpkg -i linux-headers-2.6.32.28-openvz_1_i386.deb`[[br]]
     82
     8317. Setup the grub menu to load the OpenVZ kernel at boot.[[br]]
     84    `sudo mkinitramfs -k 2.6.32.28-openvz -o /boot/initrd.img-2.6.32.28-openvz`[[br]]
     85    `sudo update-grub`[[br]]
     86
     8718. Create a new internet configuration.[[br]]
     88    `sudo gedit /etc/sysctl.d/10-openvz.conf`[[br]]
     89
     90Place the following text in the file.
     91
     92    `### Optimized for Ubuntu 10.04`[[br]]
     93    `# vim:ft=sysctl`[[br]]
     94    `# sysctl config for OpenVZ`[[br]]
     95    `#net.ipv4.ip_forward=1`[[br]]
     96
     97    `net.ipv4.conf.default.forwarding = 1`[[br]]
     98    `net.ipv4.conf.default.proxy_arp = 1`[[br]]
     99    `net.ipv4.ip_forward = 1`[[br]]
     100
     101    `# Enables source route verification`[[br]]
     102    `net.ipv4.conf.all.rp_filter = 1`[[br]]
     103
     104    `# Enables the magic-sysrq key`[[br]]
     105    `kernel.sysrq = 1`[[br]]
     106
     107    `# TCP Explict Congestion Notification`[[br]]
     108    `#net.ipv4.tcp_ecn = 0`[[br]]
     109
     110    `# we do not want all our interfaces to send redirects`[[br]]
     111    `net.ipv4.conf.default.send_redirects = 0`[[br]]
     112
     113
     11419. Apply the changes to the network configuration.[[br]]
     115    `sudo sysctl -p /etc/sysctl.d/10-openvz.conf`[[br]]
     116
     11720. Install the tools used by OpenVZ for managing containers.[[br]]
     118    `sudo apt-get install --no-install-recommends vzctl vzquota vzdump`
     119
     12021. Create a symlink to be FHS-compliant and then reboot.[[br]]
     121    `sudo ln -s /var/lib/vz /vz`[[br]]
     122    `sudo reboot`
     123
     12422. Once rebooted, check to make sure the correct kernel was started.
     125    `uname -r`
     126
     127    The result of that command should be something similar to "2.6.32.28-openvz".
     128
     12923. Open a web browser and navigate to a website to make sure the internet configurations were set properly. If there is no internet connection check step 18 and that the text in the file 10-openvz.conf is correct.
     130
     13124. Finally, download the Ubuntu 10.04 OpenVZ container template.[[br]]
     132    `cd /vz/template/cache/`[[br]]
     133    `sudo wget http://download.openvz.org/template/precreated/ubuntu-10.04-x86.tar.gz`
     134
     135
     136=== Testing OpenVZ in Ubuntu 10.04 ===
     137
     1381. From a terminal try to create an OpenVZ container.[[br]]
     139    `sudo vzctl create 101 --ostemplate=ubuntu-10.04-x86`
     140
     141    There should be no errors seen from this command. It will take about a minute to create the container.
     142
     1432. Start the container to make sure it was created properly.[[br]]
     144    `sudo vzctl start 101`
     145
     1463. Stop and destroy the test container.[[br]]
     147    'sudo vzctl stop 101'[[br]]
     148    'sudo vzctl destroy 101'
     149
     150If these commands failed refer to the OpenVZ documentation on vzctl create/start/stop/destroy. If any of the commands cannot be found refer back to step 20 and make sure the packages were installed.
     151
     152If no errors were encountered you have successfully installed OpenVZ on Ubuntu 10.04.