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] |
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. |