Changes between Version 3 and Version 4 of GIB-Ubuntu-Instructions
- Timestamp:
- 09/28/12 07:54:40 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
GIB-Ubuntu-Instructions
v3 v4 11 11 2. Before getting started make sure the machine is up to date. 12 12 {{{ 13 14 13 sudo apt-get update 14 sudo apt-get upgrade 15 15 }}} 16 16 17 17 3. Reconfigure dash. When the "Configuring dash" screen appears select NO. 18 18 {{{ 19 19 sudo dpkg-reconfigure dash 20 20 }}} 21 21 22 22 4. Install required packages to compile the kernel. This will be needed when the OpenVZ kernel is compiled. 23 23 {{{ 24 24 sudo apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 module-assistant debhelper build-essential bridge-utils 25 25 }}} 26 26 27 27 5. Set the following variables that will be used. 28 28 {{{ 29 30 31 29 Variant="linux-image-generic" 30 VersionAppendix="-openvz" 31 MyConfigFile="kernel-2.6.32-i686.config.ovz" 32 32 }}} 33 33 34 34 6. Set the build dependencies for OpenVZ. 35 35 {{{ 36 37 38 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 39 39 }}} 40 40 41 41 7. Prepare the linux headers before compiling, and create the configuration for the kernel. 42 42 {{{ 43 44 43 sudo m-a prepare 44 sudo kernel-packageconfig 45 45 }}} 46 46 47 47 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. 48 48 {{{ 49 50 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 51 51 }}} 52 52 53 53 10. Download the linux kernel source code. 54 54 {{{ 55 56 55 cd /usr/src 56 sudo wget http://archive.ubuntu.com/ubuntu/pool/main/l/linux/linux_2.6.32.orig.tar.gz 57 57 }}} 58 58 59 59 11. Get the OpenVZ patch for the linux kernel, and the OpenVZ kernel itself. 60 60 {{{ 61 62 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 63 63 }}} 64 64 65 65 12. Unpack the source code. 66 66 {{{ 67 68 69 70 71 72 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 73 73 }}} 74 74 75 75 13. Apply the OpenVZ patch to the kernel. 76 76 {{{ 77 78 79 80 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 81 81 }}} 82 82 83 83 14. One of the make files has a bug in it that needs to be fixed. 84 84 {{{ 85 85 sudo gedit Documentation/lguest/Makefile 86 86 }}} 87 87 88 88 Change the following lines; 89 89 {{{ 90 91 92 93 90 all: lguest 91 92 clean: 93 rm -f lguest 94 94 }}} 95 95 96 96 To be the following; 97 97 {{{ 98 99 100 101 98 all: 99 100 clean: 101 rm -f lguest 102 102 }}} 103 103 104 104 15. Now build the OpenVZ kernel. '''WARNING''': This may take some time, upwards of 1 or 2 hours. 105 105 {{{ 106 107 106 cd /usr/src/linux 107 sudo make-kpkg --initrd --append-to-version=$VersionAppendix --revision=1 kernel_image kernel_headers 108 108 }}} 109 109 110 110 16. Install the OpenVZ kernels that were just built. 111 111 {{{ 112 113 114 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 115 115 }}} 116 116 117 117 17. Setup the grub menu to load the OpenVZ kernel at boot. 118 118 {{{ 119 120 119 sudo mkinitramfs -k 2.6.32.28-openvz -o /boot/initrd.img-2.6.32.28-openvz 120 sudo update-grub 121 121 }}} 122 122 123 123 18. Create a new internet configuration. 124 124 {{{ 125 125 sudo gedit /etc/sysctl.d/10-openvz.conf 126 126 }}} 127 127 128 128 Place the following text in the file. 129 129 {{{ 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 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 150 150 }}} 151 151 … … 153 153 19. Apply the changes to the network configuration. 154 154 {{{ 155 155 sudo sysctl -p /etc/sysctl.d/10-openvz.conf 156 156 }}} 157 157 158 158 20. Install the tools used by OpenVZ for managing containers. 159 159 {{{ 160 160 sudo apt-get install --no-install-recommends vzctl vzquota vzdump 161 161 }}} 162 162 163 163 21. Create a symlink to be FHS-compliant and then reboot. 164 164 {{{ 165 166 165 sudo ln -s /var/lib/vz /vz 166 sudo reboot 167 167 }}} 168 168 169 169 22. Once rebooted, check to make sure the correct kernel was started. 170 170 {{{ 171 171 uname -r 172 172 }}} 173 173 … … 178 178 24. Finally, download the Ubuntu 10.04 OpenVZ container template. 179 179 {{{ 180 181 180 cd /vz/template/cache/ 181 sudo wget http://download.openvz.org/template/precreated/ubuntu-10.04-x86.tar.gz 182 182 }}} 183 183 … … 187 187 1. From a terminal try to create an OpenVZ container. 188 188 {{{ 189 189 sudo vzctl create 101 --ostemplate=ubuntu-10.04-x86 190 190 }}} 191 191 … … 194 194 2. Start the container to make sure it was created properly. 195 195 {{{ 196 196 sudo vzctl start 101 197 197 }}} 198 198 199 199 3. Stop and destroy the test container. 200 200 {{{ 201 202 201 sudo vzctl stop 101 202 sudo vzctl destroy 101 203 203 }}} 204 204