Changes between Initial Version and Version 1 of GIB-Ubuntu-Instructions


Ignore:
Timestamp:
09/20/12 12:42:21 (9 years ago)
Author:
zbertils@bbn.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GIB-Ubuntu-Instructions

    v1 v1  
     1= Setting up GENI-in-a-Box Development Environment for Ubuntu 10.04 =
     2
     3Setting up the environment consists of installing OpenVZ to the Ubuntu OS, and optionally Python 2.7. Since Python 2.6 comes on Ubuntu 10.04 and is enough to satisfy the development requires the instructions for installing Python 2.7 are omitted for the time being. The main development requirement that needs to be installed is OpenVZ.
     4
     5These 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.
     6
     7=== Setting up OpenVZ ===
     8
     91. 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. This first step should have been done before getting to this page, but is mentioned to double check before proceeding.
     10
     112. Before getting started make sure the machine is up to date.[[br]]
     12    `sudo apt-get update`[[br]]
     13    `sudo apt-get upgrade`
     14
     153. Reconfigure dash. When the "Configuring dash" screen appears select NO.[[br]]
     16    `sudo dpkg-reconfigure dash`
     17
     184. Install required packages to compile the kernel. This will be needed when the OpenVZ kernel is compiled.[[br]]
     19    `sudo apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 module-assistant debhelper build-essential bridge-utils`
     20
     215. Set the following variables that will be used.[[br]]
     22    `Variant="linux-image-generic"`[[br]]
     23    `VersionAppendix="-openvz"`[[br]]
     24    `MyConfigFile="kernel-2.6.32-i686.config.ovz"`[[br]]
     25
     266. Set the build dependencies for OpenVZ[[br]]
     27    `Package="$(apt-cache showpkg $Variant | grep "^2\.6\.32" | grep "linux-image")"`[[br]]
     28    `Package=$(ReturnWord () { echo $3; }; ReturnWord $Package)`[[br]]
     29    `sudo apt-get build-dep --no-install-recommends $Package`[[br]]
     30
     317. Prepare the linux headers before compiling, and create the configuration for the kernel.[[br]]
     32    `sudo m-a prepare`[[br]]
     33    `sudo kernel-packageconfig`
     34
     359. 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]]
     36    `Cores=$(Nr () { echo $#; }; Nr $(grep "processor" /proc/cpuinfo | cut -f2 -d":"))`[[br]]
     37    `echo "CONCURRENCY_LEVEL := $(($Cores + 1))" | sudo tee -a /etc/kernel-pkg.conf`[[br]]
     38
     3910. Download the linux kernel source code.[[br]]
     40    `cd /usr/src`[[br]]
     41    `sudo wget http://archive.ubuntu.com/ubuntu/pool/main/l/linux/linux_2.6.32.orig.tar.gz`
     42
     4311. Get the OpenVZ patch for the linux kernel, and the OpenVZ kernel itself.[[br]]
     44    `sudo wget http://download.openvz.org/kernel/branches/2.6.32/current/patches/patch-feoktistov.1-combined.gz`[[br]]
     45    `sudo wget http://download.openvz.org/kernel/branches/2.6.32/current/configs/$MyConfigFile`
     46
     4712. Unpack the source code.[[br]]
     48    `sudo rm -fR linux-2.6.32`[[br]]
     49    `sudo tar -xpf linux_2.6.32.orig.tar.gz`[[br]]
     50    `sudo rm -fR "linux-2.6.32$VersionAppendix"`[[br]]
     51    `sudo mv linux-2.6.32 "linux-2.6.32$VersionAppendix"`[[br]]
     52    `sudo rm linux`[[br]]
     53    `sudo ln -s "linux-2.6.32$VersionAppendix" linux`
     54
     5513. Apply the OpenVZ patch to the kernel.[[br]]
     56    `cd /usr/src/linux`[[br]]
     57    `sudo gunzip -dc /usr/src/patch-feoktistov.1-combined.gz | sudo patch -p1 --batch`[[br]]
     58    `sudo cp -f "/usr/src/$MyConfigFile" .config`[[br]]
     59    `sudo make oldconfig`
     60
     6114. One of the make files has a bug in it that needs to be fixed.[[br]]
     62    `sudo gedit Documentation/lguest/Makefile`
     63
     64Change the following lines;
     65    `all: lguest`[[br]]
     66
     67    `clean:`[[br]]
     68            `rm -f lguest`
     69
     70To be the following;
     71    `all:`[[br]]
     72
     73    `clean:`[[br]]
     74            `rm -f lguest`
     75
     7615. Now build the OpenVZ kernel. '''WARNING''': This may take some time, upwards of 1 or 2 hours.[[br]]
     77    `cd /usr/src/linux`[[br]]
     78    `sudo make-kpkg --initrd --append-to-version=$VersionAppendix --revision=1 kernel_image kernel_headers`[[br]]
     79
     8016. Install the OpenVZ kernels that were just built.[[br]]
     81    `cd /usr/src`[[br]]
     82    `sudo dpkg -i linux-image-2.6.32.28-openvz_1_i386.deb`[[br]]
     83    `sudo dpkg -i linux-headers-2.6.32.28-openvz_1_i386.deb`[[br]]
     84
     8517. Setup the grub menu to load the OpenVZ kernel at boot.[[br]]
     86    `sudo mkinitramfs -k 2.6.32.28-openvz -o /boot/initrd.img-2.6.32.28-openvz`[[br]]
     87    `sudo update-grub`[[br]]
     88
     8918. Create a new internet configuration.[[br]]
     90    `sudo gedit /etc/sysctl.d/10-openvz.conf`[[br]]
     91
     92Place the following text in the file.
     93
     94    `### Optimized for Ubuntu 10.04`[[br]]
     95    `# vim:ft=sysctl`[[br]]
     96    `# sysctl config for OpenVZ`[[br]]
     97    `#net.ipv4.ip_forward=1`[[br]]
     98
     99    `net.ipv4.conf.default.forwarding = 1`[[br]]
     100    `net.ipv4.conf.default.proxy_arp = 1`[[br]]
     101    `net.ipv4.ip_forward = 1`[[br]]
     102
     103    `# Enables source route verification`[[br]]
     104    `net.ipv4.conf.all.rp_filter = 1`[[br]]
     105
     106    `# Enables the magic-sysrq key`[[br]]
     107    `kernel.sysrq = 1`[[br]]
     108
     109    `# TCP Explict Congestion Notification`[[br]]
     110    `#net.ipv4.tcp_ecn = 0`[[br]]
     111
     112    `# we do not want all our interfaces to send redirects`[[br]]
     113    `net.ipv4.conf.default.send_redirects = 0`[[br]]
     114
     115
     11619. Apply the changes to the network configuration.[[br]]
     117    `sudo sysctl -p /etc/sysctl.d/10-openvz.conf`[[br]]
     118
     11920. Install the tools used by OpenVZ for managing containers.[[br]]
     120    `sudo apt-get install --no-install-recommends vzctl vzquota vzdump`
     121
     12221. Create a symlink to be FHS-compliant and then reboot.[[br]]
     123    `sudo ln -s /var/lib/vz /vz`[[br]]
     124    `sudo reboot`
     125
     12622. Once rebooted, check to make sure the correct kernel was started.
     127    `uname -r`
     128
     129    The result of that command should be something similar to "2.6.32.28-openvz".
     130
     13123. 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.
     132
     13324. Finally, download the Ubuntu 10.04 OpenVZ container template.[[br]]
     134    `cd /vz/template/cache/`[[br]]
     135    `sudo wget http://download.openvz.org/template/precreated/ubuntu-10.04-x86.tar.gz`
     136
     137
     138=== Testing OpenVZ in Ubuntu 10.04 ===
     139
     1401. From a terminal try to create an OpenVZ container.[[br]]
     141    `sudo vzctl create 101 --ostemplate=ubuntu-10.04-x86`
     142
     143    There should be no errors seen from this command. It will take about a minute to create the container.
     144
     1452. Start the container to make sure it was created properly.[[br]]
     146    `sudo vzctl start 101`
     147
     1483. Stop and destroy the test container.[[br]]
     149    `sudo vzctl stop 101`[[br]]
     150    `sudo vzctl destroy 101`
     151
     152If 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.
     153
     154If no errors were encountered you have successfully installed OpenVZ on Ubuntu 10.04.