Changes between Version 2 and Version 3 of GiB-Implementation


Ignore:
Timestamp:
09/20/12 12:47:19 (7 years ago)
Author:
zbertils@bbn.com
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • GiB-Implementation

    v2 v3  
    1 = Installing OpenVZ on Ubuntu 10.04 =
     1= Getting Started =
    22
    3 These 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.
     3To get started there are a couple things that need to be done prior to development. The steps for setting up the development environment are below. If you have any questions or suggestions about the set up process don't hesitate to send an email to [mailto:help@geni.net].
    44
    5 === Setting up OpenVZ ===
     5== Installing and Setting Up !VirtualBox ==
    66
    7 1. 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.
     71. !VirtualBox can be downloaded from https://www.virtualbox.org/wiki/Downloads. Please make sure you install version 4.1.16 or newer.
    88
    9 2. Before getting started make sure the machine is up to date.[[br]]
    10     `sudo apt-get update`[[br]]
    11     `sudo apt-get upgrade`
     92. Once installed you will need to create a !VirtualBox container with a minimum disc space of 40 GB. Instructions on how to set up a virtual disk image can be found at http://www.virtualbox.org/manual/ch01.html#gui-createvm. Choosing a fixed disk image is recommended.
    1210
    13 3. Reconfigure dash. When the "Configuring dash" screen appears select NO.[[br]]
    14     `sudo dpkg-reconfigure dash`
     113. After the virtual disk is set up, choose the OS that you want to develop in. The currently supported versions are Fedora 15 and Ubuntu 10.04.4 LTS Lucid Lynx.
     12   A download for Fedora 15 can be found at http://download.fedoraproject.org/pub/fedora/linux/releases/15/Fedora/i386/iso/Fedora-15-i386-DVD.iso. [[br]]
     13   Like-wise, a download for Ubuntu 10.04 can be found at http://releases.ubuntu.com/lucid/ubuntu-10.04.4-desktop-i386.iso.
    1514
    16 4. 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`
     154. Instructions for installing the OS to the virtual disk for the first time can be found at http://www.virtualbox.org/manual/ch01.html#idp13614032.
    1816
    19 5. 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]]
     17Once the OS of your choice is installed to the virtual disk you are ready to start setting up the development environment.
    2318
    24 6. 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]]
     19== Setting up the Development Environment ==
    2820
    29 7. Prepare the linux headers before compiling, and create the configuration for the kernel.[[br]]
    30     `sudo m-a prepare`[[br]]
    31     `sudo kernel-packageconfig`
     21Depending on the OS you chose to develop in, Fedora or Ubuntu as listed above, you will need to follow separate instructions.
    3222
    33 9. 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 
    37 10. 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 
    41 11. 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 
    45 12. 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 
    53 13. 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 
    59 14. One of the make files has a bug in it that needs to be fixed.[[br]]
    60     `sudo gedit Documentation/lguest/Makefile`
    61 
    62 Change the following lines;
    63     `all: lguest`[[br]]
    64 
    65     `clean:`[[br]]
    66             `rm -f lguest`
    67 
    68 To be the following;
    69     `all:`[[br]]
    70 
    71     `clean:`[[br]]
    72             `rm -f lguest`
    73 
    74 15. 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 
    78 16. 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 
    83 17. 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 
    87 18. Create a new internet configuration.[[br]]
    88     `sudo gedit /etc/sysctl.d/10-openvz.conf`[[br]]
    89 
    90 Place 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]]
     23[wiki:GIB-Fedora-Instructions Fedora Environment Setup Instructions] [[br]] [[br]]
     24[wiki:GIB-Ubuntu-Instructions Ubuntu Environment Setup Instructions]
    11225
    11326
    114 19. Apply the changes to the network configuration.[[br]]
    115     `sudo sysctl -p /etc/sysctl.d/10-openvz.conf`[[br]]
    116 
    117 20. Install the tools used by OpenVZ for managing containers.[[br]]
    118     `sudo apt-get install --no-install-recommends vzctl vzquota vzdump`
    119 
    120 21. Create a symlink to be FHS-compliant and then reboot.[[br]]
    121     `sudo ln -s /var/lib/vz /vz`[[br]]
    122     `sudo reboot`
    123 
    124 22. 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 
    129 23. 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 
    131 24. 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 
    138 1. 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 
    143 2. Start the container to make sure it was created properly.[[br]]
    144     `sudo vzctl start 101`
    145 
    146 3. Stop and destroy the test container.[[br]]
    147     `sudo vzctl stop 101`[[br]]
    148     `sudo vzctl destroy 101`
    149 
    150 If 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 
    152 If no errors were encountered you have successfully installed OpenVZ on Ubuntu 10.04.