Changes between Version 3 and Version 4 of GIB-Ubuntu-Instructions


Ignore:
Timestamp:
09/28/12 07:54:40 (12 years ago)
Author:
zbertils@bbn.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GIB-Ubuntu-Instructions

    v3 v4  
    11112. Before getting started make sure the machine is up to date.
    1212{{{
    13     sudo apt-get update
    14     sudo apt-get upgrade
     13sudo apt-get update
     14sudo apt-get upgrade
    1515}}}
    1616
    17173. Reconfigure dash. When the "Configuring dash" screen appears select NO.
    1818{{{
    19     sudo dpkg-reconfigure dash
     19sudo dpkg-reconfigure dash
    2020}}}
    2121
    22224. Install required packages to compile the kernel. This will be needed when the OpenVZ kernel is compiled.
    2323{{{
    24     sudo apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 module-assistant debhelper build-essential bridge-utils
     24sudo apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 module-assistant debhelper build-essential bridge-utils
    2525}}}
    2626
    27275. Set the following variables that will be used.
    2828{{{
    29     Variant="linux-image-generic"
    30     VersionAppendix="-openvz"
    31     MyConfigFile="kernel-2.6.32-i686.config.ovz"
     29Variant="linux-image-generic"
     30VersionAppendix="-openvz"
     31MyConfigFile="kernel-2.6.32-i686.config.ovz"
    3232}}}
    3333
    34346. Set the build dependencies for OpenVZ.
    3535{{{
    36     Package="$(apt-cache showpkg $Variant | grep "^2\.6\.32" | grep "linux-image")"
    37     Package=$(ReturnWord () { echo $3; }; ReturnWord $Package)
    38     sudo apt-get build-dep --no-install-recommends $Package
     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
    3939}}}
    4040
    41417. Prepare the linux headers before compiling, and create the configuration for the kernel.
    4242{{{
    43     sudo m-a prepare
    44     sudo kernel-packageconfig
     43sudo m-a prepare
     44sudo kernel-packageconfig
    4545}}}
    4646
    47479. 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.
    4848{{{
    49     Cores=$(Nr () { echo $#; }; Nr $(grep "processor" /proc/cpuinfo | cut -f2 -d":"))
    50     echo "CONCURRENCY_LEVEL := $(($Cores + 1))" | sudo tee -a /etc/kernel-pkg.conf
     49Cores=$(Nr () { echo $#; }; Nr $(grep "processor" /proc/cpuinfo | cut -f2 -d":"))
     50echo "CONCURRENCY_LEVEL := $(($Cores + 1))" | sudo tee -a /etc/kernel-pkg.conf
    5151}}}
    5252
    535310. Download the linux kernel source code.
    5454{{{
    55     cd /usr/src
    56     sudo wget http://archive.ubuntu.com/ubuntu/pool/main/l/linux/linux_2.6.32.orig.tar.gz
     55cd /usr/src
     56sudo wget http://archive.ubuntu.com/ubuntu/pool/main/l/linux/linux_2.6.32.orig.tar.gz
    5757}}}
    5858
    595911. Get the OpenVZ patch for the linux kernel, and the OpenVZ kernel itself.
    6060{{{
    61     sudo wget http://download.openvz.org/kernel/branches/2.6.32/current/patches/patch-feoktistov.1-combined.gz
    62     sudo wget http://download.openvz.org/kernel/branches/2.6.32/current/configs/$MyConfigFile
     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
    6363}}}
    6464
    656512. Unpack the source code.
    6666{{{
    67     sudo rm -fR linux-2.6.32
    68     sudo tar -xpf linux_2.6.32.orig.tar.gz
    69     sudo rm -fR "linux-2.6.32$VersionAppendix"
    70     sudo mv linux-2.6.32 "linux-2.6.32$VersionAppendix"
    71     sudo rm linux
    72     sudo ln -s "linux-2.6.32$VersionAppendix" linux
     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
    7373}}}
    7474
    757513. Apply the OpenVZ patch to the kernel.
    7676{{{
    77     cd /usr/src/linux
    78     sudo gunzip -dc /usr/src/patch-feoktistov.1-combined.gz | sudo patch -p1 --batch
    79     sudo cp -f "/usr/src/$MyConfigFile" .config
    80     sudo make oldconfig
     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
    8181}}}
    8282
    838314. One of the make files has a bug in it that needs to be fixed.
    8484{{{
    85     sudo gedit Documentation/lguest/Makefile
     85sudo gedit Documentation/lguest/Makefile
    8686}}}
    8787
    8888Change the following lines;
    8989{{{
    90     all: lguest
    91 
    92     clean:
    93             rm -f lguest
     90all: lguest
     91
     92clean:
     93        rm -f lguest
    9494}}}
    9595
    9696To be the following;
    9797{{{
    98     all:
    99 
    100     clean:
    101             rm -f lguest
     98all:
     99
     100clean:
     101        rm -f lguest
    102102}}}
    103103
    10410415. Now build the OpenVZ kernel. '''WARNING''': This may take some time, upwards of 1 or 2 hours.
    105105{{{
    106     cd /usr/src/linux
    107     sudo make-kpkg --initrd --append-to-version=$VersionAppendix --revision=1 kernel_image kernel_headers
     106cd /usr/src/linux
     107sudo make-kpkg --initrd --append-to-version=$VersionAppendix --revision=1 kernel_image kernel_headers
    108108}}}
    109109
    11011016. Install the OpenVZ kernels that were just built.
    111111{{{
    112     cd /usr/src
    113     sudo dpkg -i linux-image-2.6.32.28-openvz_1_i386.deb
    114     sudo dpkg -i linux-headers-2.6.32.28-openvz_1_i386.deb
     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
    115115}}}
    116116
    11711717. Setup the grub menu to load the OpenVZ kernel at boot.
    118118{{{
    119     sudo mkinitramfs -k 2.6.32.28-openvz -o /boot/initrd.img-2.6.32.28-openvz
    120     sudo update-grub
     119sudo mkinitramfs -k 2.6.32.28-openvz -o /boot/initrd.img-2.6.32.28-openvz
     120sudo update-grub
    121121}}}
    122122
    12312318. Create a new internet configuration.
    124124{{{
    125     sudo gedit /etc/sysctl.d/10-openvz.conf
     125sudo gedit /etc/sysctl.d/10-openvz.conf
    126126}}}
    127127
    128128Place the following text in the file.
    129129{{{
    130     ### Optimized for Ubuntu 10.04
    131     # vim:ft=sysctl
    132     # sysctl config for OpenVZ
    133     #net.ipv4.ip_forward=1
    134 
    135     net.ipv4.conf.default.forwarding = 1
    136     net.ipv4.conf.default.proxy_arp = 1
    137     net.ipv4.ip_forward = 1
    138 
    139     # Enables source route verification
    140     net.ipv4.conf.all.rp_filter = 1
    141 
    142     # Enables the magic-sysrq key
    143     kernel.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
    149     net.ipv4.conf.default.send_redirects = 0
     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
    150150}}}
    151151
     
    15315319. Apply the changes to the network configuration.
    154154{{{
    155     sudo sysctl -p /etc/sysctl.d/10-openvz.conf
     155sudo sysctl -p /etc/sysctl.d/10-openvz.conf
    156156}}}
    157157
    15815820. Install the tools used by OpenVZ for managing containers.
    159159{{{
    160     sudo apt-get install --no-install-recommends vzctl vzquota vzdump
     160sudo apt-get install --no-install-recommends vzctl vzquota vzdump
    161161}}}
    162162
    16316321. Create a symlink to be FHS-compliant and then reboot.
    164164{{{
    165     sudo ln -s /var/lib/vz /vz
    166     sudo reboot
     165sudo ln -s /var/lib/vz /vz
     166sudo reboot
    167167}}}
    168168
    16916922. Once rebooted, check to make sure the correct kernel was started.
    170170{{{
    171     uname -r
     171uname -r
    172172}}}
    173173
     
    17817824. Finally, download the Ubuntu 10.04 OpenVZ container template.
    179179{{{
    180     cd /vz/template/cache/
    181     sudo wget http://download.openvz.org/template/precreated/ubuntu-10.04-x86.tar.gz
     180cd /vz/template/cache/
     181sudo wget http://download.openvz.org/template/precreated/ubuntu-10.04-x86.tar.gz
    182182}}}
    183183
     
    1871871. From a terminal try to create an OpenVZ container.
    188188{{{
    189     sudo vzctl create 101 --ostemplate=ubuntu-10.04-x86
     189sudo vzctl create 101 --ostemplate=ubuntu-10.04-x86
    190190}}}
    191191
     
    1941942. Start the container to make sure it was created properly.
    195195{{{
    196     sudo vzctl start 101
     196sudo vzctl start 101
    197197}}}
    198198
    1991993. Stop and destroy the test container.
    200200{{{
    201     sudo vzctl stop 101
    202     sudo vzctl destroy 101
     201sudo vzctl stop 101
     202sudo vzctl destroy 101
    203203}}}
    204204