Difference between revisions of "Compiling the OpenVZ kernel (the Debian way)"

From OpenVZ Virtuozzo Containers Wiki
Jump to: navigation, search
(New page: === Build your own kernel-image (debian way) === ==== Installing sources ==== To install the kernel-source and the OpenVZ kernel patch, run: # apt-get install kernel-package linux-sourc...)
 
(Installing sources)
 
(11 intermediate revisions by 6 users not shown)
Line 1: Line 1:
=== Build your own kernel-image (debian way) ===
+
== Lenny and above ==
  
==== Installing sources ====
+
Debian Lenny already includes an openvz kernel (linux-image-${version}-openvz-${arch}), so the manual compilation is not necessary in many cases.
  
To install the kernel-source and the OpenVZ kernel patch, run:
+
== Installing sources ==
 +
 
 +
On Etch, to install the kernel-source and the OpenVZ kernel patch, run:
 
  # apt-get install kernel-package linux-source-2.6.18 kernel-patch-openvz libncurses5-dev
 
  # apt-get install kernel-package linux-source-2.6.18 kernel-patch-openvz libncurses5-dev
  
==== Unpacking ====
+
For Lenny running kernels before 2.6.29 run the following:
 +
# apt-get install kernel-package linux-source-2.6.18 linux-patch-openvz libncurses5-dev
 +
Since kernel 2.6.29 the patch is now included in Debian kernel source.  Run only the following and ignore references to the patch further down this page:
 +
# apt-get install kernel-package linux-source-2.6 libncurses5-dev
 +
 
 +
== Unpacking ==
  
 
Unpack the kernel source:
 
Unpack the kernel source:
Line 15: Line 22:
 
</pre>
 
</pre>
  
==== Kernel config ====
+
== Kernel config ==
  
 
You need a kernel config.
 
You need a kernel config.
Line 21: Line 28:
 
  # cp /boot/config-2.6.18-5-686 .config
 
  # cp /boot/config-2.6.18-5-686 .config
  
'''Or''' get a 2.6.18 kernel configuration from  http://download.openvz.org/kernel/branches/2.6.18/current/configs/ (depending on your architecture; the below example is for i686):
+
'''Or''' get a 2.6.18 kernel configuration from   
 +
http://download.openvz.org/kernel/branches/2.6.18/current/configs/ (depending on your architecture; the below example is for i686):
 
  # wget http://download.openvz.org/kernel/branches/2.6.18/current/configs/kernel-2.6.18-i686.config.ovz -O .config
 
  # wget http://download.openvz.org/kernel/branches/2.6.18/current/configs/kernel-2.6.18-i686.config.ovz -O .config
  
==== Patching and configuring ====
+
== Patching and configuring ==
  
 
Now you can apply the openvz kernel patch and modify your kernel-config:
 
Now you can apply the openvz kernel patch and modify your kernel-config:
Line 31: Line 39:
  
 
You need the following OpenVZ kernel config settings:
 
You need the following OpenVZ kernel config settings:
<pre>
 
 
(taken from OpenVZ Kernel 2.6.18-028test010.1 on 686)
 
(taken from OpenVZ Kernel 2.6.18-028test010.1 on 686)
  
 +
<pre>
 
Filesystem
 
Filesystem
 
\_ [*] Second extended fs support (CONFIG_EXT2_FS)
 
\_ [*] Second extended fs support (CONFIG_EXT2_FS)
Line 72: Line 80:
 
See also : "make-kpkg --targets"
 
See also : "make-kpkg --targets"
  
==== Compiling ====
+
== Compiling ==
  
 
Compile your kernel (as user root, or you need the --rootcmd!)
 
Compile your kernel (as user root, or you need the --rootcmd!)
Line 79: Line 87:
 
  # make-kpkg --append_to_version=-1-openvz --added_patches=openvz --revision=1 --initrd --config menuconfig binary-arch
 
  # make-kpkg --append_to_version=-1-openvz --added_patches=openvz --revision=1 --initrd --config menuconfig binary-arch
  
==== Installing ====
+
== Installing ==
 
Install the kernel and update initramfs:
 
Install the kernel and update initramfs:
  
Line 89: Line 97:
 
{{Note|update-grub can be configured by /etc/kernel-img.conf}}
 
{{Note|update-grub can be configured by /etc/kernel-img.conf}}
  
==== Bootloader ====
+
== Bootloader ==
  
 
Update the bootloader (if not done before)
 
Update the bootloader (if not done before)
Line 99: Line 107:
 
{{Note|since the Debian Etch release the location of update-grub is moved from /sbin/update-grub to /usr/sbin/update-grub}}
 
{{Note|since the Debian Etch release the location of update-grub is moved from /sbin/update-grub to /usr/sbin/update-grub}}
  
=== Installing the Tools and Configuring ===
+
LILO:
 +
 
 +
# lilo
 +
 
 +
== Installing the Tools and Configuring ==
 +
 
 +
Continue with [[Installation on Debian#Installing the user-level tools]]
  
Continue from here for Etch (current stable) : [[Installation_on_Debian_%28etch%29#Install_the_toolset]]
+
[[Category: Debian]]
 +
[[Category: Installation]]
 +
[[Category: Kernel]]

Latest revision as of 18:51, 28 January 2010

Lenny and above[edit]

Debian Lenny already includes an openvz kernel (linux-image-${version}-openvz-${arch}), so the manual compilation is not necessary in many cases.

Installing sources[edit]

On Etch, to install the kernel-source and the OpenVZ kernel patch, run:

# apt-get install kernel-package linux-source-2.6.18 kernel-patch-openvz libncurses5-dev

For Lenny running kernels before 2.6.29 run the following:

# apt-get install kernel-package linux-source-2.6.18 linux-patch-openvz libncurses5-dev

Since kernel 2.6.29 the patch is now included in Debian kernel source. Run only the following and ignore references to the patch further down this page:

# apt-get install kernel-package linux-source-2.6 libncurses5-dev

Unpacking[edit]

Unpack the kernel source:

 # cd /usr/src
 # tar xjf linux-source-2.6.18.tar.bz2
 # cd linux-source-2.6.18

Kernel config[edit]

You need a kernel config. You can use the config of the debian-kernel:

# cp /boot/config-2.6.18-5-686 .config

Or get a 2.6.18 kernel configuration from http://download.openvz.org/kernel/branches/2.6.18/current/configs/ (depending on your architecture; the below example is for i686):

# wget http://download.openvz.org/kernel/branches/2.6.18/current/configs/kernel-2.6.18-i686.config.ovz -O .config

Patching and configuring[edit]

Now you can apply the openvz kernel patch and modify your kernel-config:

# ../kernel-patches/all/apply/openvz
# make menuconfig

You need the following OpenVZ kernel config settings: (taken from OpenVZ Kernel 2.6.18-028test010.1 on 686)

Filesystem
\_ [*] Second extended fs support (CONFIG_EXT2_FS)
\_ [*] Ext3 journalling file system support (CONFIG_EXT3_FS)
\_ [M] Quota Support (CONFIG_QUOTA)
	\_ [*] Compatibility with older quotactl interface (CONFIG_QUOTA_COMPAT)
	\_ [*]Quota format v2 support (CONFIG_QFMT_V2)
\_ [*] VPS filesystem (CONFIG_SIM_FS)
\_ [M] Virtuozzo Disk Quota support	(CONFIG_VZ_QUOTA)
	\-> [*] Per-user and per-group quota in Virtuozzo quota partitions (VZ_QUOTA_UGID)

Security
	\->[ ] Enable different security models

OpenVZ ... (what else :-)
\_[*] Virtual Environment support (CONFIG_VE)
	\_ <M> VE calls interface (CONFIG_VE_CALLS)
	\_ <M> VE networking (CONFIG_VE_NETDEV)
	\_ <M> Virtual ethernet device (CONFIG_VE_ETHDEV)
	\_ <M> VE device (CONFIG_VZ_DEV)
	\_ [*] VE netfiltering (CONFIG_VE_IPTABLES)
	\_ <M> VE watchdog module (CONFIG_VZ_WDOG)
	\_ <M> Checkpointing & restoring Virtual Environments (CONFIG_VZ_CHECKPOINT)

User resources ... (User Beancounters)
\_ [*] Enable user resource accounting (CONFIG_USER_RESOURCE)
\_ [*] Account physical memory usage ( CONFIG_USER_RSS_ACCOUNTING)
\_ [*] Account disk IO (CONFIG_UBC_IO_ACCT)
\_ [*] Account swap usage (CONFIG_USER_SWAP_ACCOUNTING)
\_ [*] Report resource usage in /proc (CONFIG_USER_RESOURCE_PROC)
\_ [*] User resources debug features (CONFIG_UBC_DEBUG)
\_ [*] Debug kmemsize with cache counters (CONFIG_UBC_DEBUG_KMEM)
Yellowpin.svg Note: better to build the kernel-headers as well, so afterward other kernel-modules can

be built without whole kernel tree (e.g. drbd -> drbd0.7-module-source)

See also : "make-kpkg --targets"

Compiling[edit]

Compile your kernel (as user root, or you need the --rootcmd!)

# make-kpkg --append_to_version=-1-openvz --added_patches=openvz --revision=1 --initrd binary-arch
or all above with one step 
# make-kpkg --append_to_version=-1-openvz --added_patches=openvz --revision=1 --initrd --config menuconfig binary-arch

Installing[edit]

Install the kernel and update initramfs:

# dpkg -i ../linux-image-2.6.18-1-openvz_1_i386.deb
# update-initramfs -c -k 2.6.18-1-openvz
Yellowpin.svg Note: update-initramfs is done, when make-kpkg is use with --initrd option

http://wiki.openvz.org/Installation_on_Debian_%28etch%29#Install_the_toolset

Yellowpin.svg Note: update-grub can be configured by /etc/kernel-img.conf

Bootloader[edit]

Update the bootloader (if not done before)

GRUB :

# /usr/sbin/update-grub
Yellowpin.svg Note: since the Debian Etch release the location of update-grub is moved from /sbin/update-grub to /usr/sbin/update-grub

LILO:

# lilo

Installing the Tools and Configuring[edit]

Continue with Installation on Debian#Installing the user-level tools