Changes between Initial Version and Version 1 of GENI-in-a-Box/GiB-Implementation/Ubuntu-Instructions


Ignore:
Timestamp:
10/17/12 09:00:24 (12 years ago)
Author:
lnevers@bbn.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GENI-in-a-Box/GiB-Implementation/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 requirements 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.
     12{{{
     13sudo apt-get update
     14sudo apt-get upgrade
     15}}}
     16
     173. Reconfigure dash. When the "Configuring dash" screen appears select NO.
     18{{{
     19sudo dpkg-reconfigure dash
     20}}}
     21
     224. Install required packages to compile the kernel. This will be needed when the OpenVZ kernel is compiled.
     23{{{
     24sudo apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 module-assistant debhelper build-essential bridge-utils
     25}}}
     26
     275. Set the following variables that will be used.
     28{{{
     29Variant="linux-image-generic"
     30VersionAppendix="-openvz"
     31MyConfigFile="kernel-2.6.32-i686.config.ovz"
     32}}}
     33
     346. Set the build dependencies for OpenVZ.
     35{{{
     36Package="$(apt-cache showpkg $Variant | grep "^2\.6\.32" | grep "linux-image")"
     37Package=$(ReturnWord () { echo $3; }; ReturnWord $Package)
     38sudo apt-get build-dep --no-install-recommends $Package
     39}}}
     40
     417. Prepare the linux headers before compiling, and create the configuration for the kernel.
     42{{{
     43sudo m-a prepare
     44sudo kernel-packageconfig
     45}}}
     46
     479. 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.
     48{{{
     49Cores=$(Nr () { echo $#; }; Nr $(grep "processor" /proc/cpuinfo | cut -f2 -d":"))
     50echo "CONCURRENCY_LEVEL := $(($Cores + 1))" | sudo tee -a /etc/kernel-pkg.conf
     51}}}
     52
     5310. Download the linux kernel source code.
     54{{{
     55cd /usr/src
     56sudo wget http://archive.ubuntu.com/ubuntu/pool/main/l/linux/linux_2.6.32.orig.tar.gz
     57}}}
     58
     5911. Get the OpenVZ patch for the linux kernel, and the OpenVZ kernel itself.
     60{{{
     61sudo wget http://download.openvz.org/kernel/branches/2.6.32/current/patches/patch-feoktistov.1-combined.gz
     62sudo wget http://download.openvz.org/kernel/branches/2.6.32/current/configs/$MyConfigFile
     63}}}
     64
     6512. Unpack the source code.
     66{{{
     67sudo rm -fR linux-2.6.32
     68sudo tar -xpf linux_2.6.32.orig.tar.gz
     69sudo rm -fR "linux-2.6.32$VersionAppendix"
     70sudo mv linux-2.6.32 "linux-2.6.32$VersionAppendix"
     71sudo rm linux
     72sudo ln -s "linux-2.6.32$VersionAppendix" linux
     73}}}
     74
     7513. Apply the OpenVZ patch to the kernel.
     76{{{
     77cd /usr/src/linux
     78sudo gunzip -dc /usr/src/patch-feoktistov.1-combined.gz | sudo patch -p1 --batch
     79sudo cp -f "/usr/src/$MyConfigFile" .config
     80sudo make oldconfig
     81}}}
     82
     8314. One of the make files has a bug in it that needs to be fixed.
     84{{{
     85sudo gedit Documentation/lguest/Makefile
     86}}}
     87
     88Change the following lines;
     89{{{
     90all: lguest
     91
     92clean:
     93        rm -f lguest
     94}}}
     95
     96To be the following;
     97{{{
     98all:
     99
     100clean:
     101        rm -f lguest
     102}}}
     103
     10415. Now build the OpenVZ kernel. '''WARNING''': This may take some time, upwards of 1 or 2 hours.
     105{{{
     106cd /usr/src/linux
     107sudo make-kpkg --initrd --append-to-version=$VersionAppendix --revision=1 kernel_image kernel_headers
     108}}}
     109
     11016. Install the OpenVZ kernels that were just built.
     111{{{
     112cd /usr/src
     113sudo dpkg -i linux-image-2.6.32.28-openvz_1_i386.deb
     114sudo dpkg -i linux-headers-2.6.32.28-openvz_1_i386.deb
     115}}}
     116
     11717. Setup the grub menu to load the OpenVZ kernel at boot.
     118{{{
     119sudo mkinitramfs -k 2.6.32.28-openvz -o /boot/initrd.img-2.6.32.28-openvz
     120sudo update-grub
     121}}}
     122
     12318. Create a new internet configuration.
     124{{{
     125sudo gedit /etc/sysctl.d/10-openvz.conf
     126}}}
     127
     128Place the following text in the file.
     129{{{
     130### Optimized for Ubuntu 10.04
     131# vim:ft=sysctl
     132# sysctl config for OpenVZ
     133#net.ipv4.ip_forward=1
     134
     135net.ipv4.conf.default.forwarding = 1
     136net.ipv4.conf.default.proxy_arp = 1
     137net.ipv4.ip_forward = 1
     138
     139# Enables source route verification
     140net.ipv4.conf.all.rp_filter = 1
     141
     142# Enables the magic-sysrq key
     143kernel.sysrq = 1
     144
     145# TCP Explict Congestion Notification
     146#net.ipv4.tcp_ecn = 0
     147
     148# we do not want all our interfaces to send redirects
     149net.ipv4.conf.default.send_redirects = 0
     150}}}
     151
     152
     15319. Apply the changes to the network configuration.
     154{{{
     155sudo sysctl -p /etc/sysctl.d/10-openvz.conf
     156}}}
     157
     15820. Install the tools used by OpenVZ for managing containers.
     159{{{
     160sudo apt-get install --no-install-recommends vzctl vzquota vzdump
     161}}}
     162
     16321. Create a symlink to be FHS-compliant and then reboot.
     164{{{
     165sudo ln -s /var/lib/vz /vz
     166sudo reboot
     167}}}
     168
     16922. Once rebooted, check to make sure the correct kernel was started.
     170{{{
     171uname -r
     172}}}
     173
     174    The result of that command should be something similar to "2.6.32.28-openvz".
     175
     17623. 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.
     177
     17824. Finally, download the Ubuntu 10.04 OpenVZ container template.
     179{{{
     180cd /vz/template/cache/
     181sudo wget http://download.openvz.org/template/precreated/ubuntu-10.04-x86.tar.gz
     182}}}
     183
     184
     185=== Testing OpenVZ in Ubuntu 10.04 ===
     186
     1871. From a terminal try to create an OpenVZ container.
     188{{{
     189sudo vzctl create 101 --ostemplate=ubuntu-10.04-x86
     190}}}
     191
     192    There should be no errors seen from this command. It will take about a minute to create the container.
     193
     1942. Start the container to make sure it was created properly.
     195{{{
     196sudo vzctl start 101
     197}}}
     198
     1993. Stop and destroy the test container.
     200{{{
     201sudo vzctl stop 101
     202sudo vzctl destroy 101
     203}}}
     204
     205If 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.
     206
     207If no errors were encountered you have successfully installed OpenVZ on Ubuntu 10.04.