📜 ⬆️ ⬇️

Installing and configuring Debian Linux under Hyper-V

Let's continue our exercises in Linux virtualization systems under Hyper-V. Today we will install and configure Debian 6 for Hyper-V. All that I will write below can be applied not only to Debian 6, but also to Debian 5 and to other distributions based on Debian such as Ubuntu, Kubuntu, Xubuntu, Ebuntu.

Debian is not included in the list of officially supported Microsoft Linux systems to run under Hyper-V. Despite this, it works very well in a virtual environment. Due to the fact that there is no official package of Hyper-V integration components for Debian, we will use the Hyper-V drivers built into the latest Linux kernels.

Installing Debian 6 under Hyper-V is pretty trite. The only thing that needs to be done at the stage of creating a virtual machine is to add the Legacy network interface to the system that is being emulated. We will need it for the initial system upgrade and the installation of the latest Linux kernel.
')
image

After the installation of Debian 6 is complete, we will have a 2.6.32 kernel. Of course, it does not shine with novelty, but at the same time it is quite normal with multiprocessor virtual machines.

Debian6_4

In order for the virtual machine to run faster and take full advantage of Hyper-V, you need to upgrade the kernel to at least 2.6.36. Before building a new kernel, update the system, install the source code of the current kernel and all the necessary tools to compile the new one.

# apt-get update
# apt-get install build-essential ncurses-dev kernel-package fakeroot install linux-headers-2.6 linux-source-2.6.32


Now we are going to build a new 2.6.36 kernel taken from kernel.org

# cd /usr/src
# wget -c www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.36.tar.bz2
# bzip2 -d linux-2.6.36.tar.bz2
# tar xf linux-2.6.36.tar
# cd linux-2.6.36
# cp /boot/config* ./.config
# make menuconfig


In the menu, select Device Drivers -> Stagging Drivers -> Microsoft Hyper-V Client Drivers

image

At this stage, you can also remove unnecessary drivers for devices that will never be in a virtual machine, such as wi-fi, sound cards, USB, PCI. However, this is not necessary, if you do not want, you can not do.

After that, we can start building deb packages for the kernel. In order to better distinguish the kernel, we add hyper-v symbols to the name.

# make-kpkg clean
# fakeroot make-kpkg --initrd --append-to-version=-hyper-v kernel_image kernel_headers


Compiling the kernel takes quite a long time. After that, two deb packages will appear in / usr / src which can be installed into the system with the dpkg –i command.

Also, these packages can be transferred and installed into other virtual machines with Debian in order not to repeat the compilation process.

We edit / etc / initramfs-tools / modules and add the following lines indicating to load the required modules at system startup:

hv_vmbus
hv_storvsc
hv_blkvsc
hv_netvsc


Update initramfs:

# update-initramfs –u –k 2.6.36-hyper-v


Turn off the virtual machine, remove the Legacy network adapter, add a synthetic network adapter, and boot the machine with the new kernel.

image

After that check with lsmod | grep hv that all modules needed for Hyper-V to work.

Debian6_big_scsi_hdd

Note that in newer versions of Linux kernels, the Hyper-V network synthetic interface has been renamed from seth to eth. This can be misleading.

Debian_synthetic_network

As usual, I tested the resilience of a virtual machine pumping through it for several days with scp almost a hundred gigabytes of traffic. Virtual hard drives are also quite fast.

Debian6_12

The virtual machine works stably in 4 processor configurations with 44 gigabytes of RAM. In general, we can conclude that Debian and distributions based on it can work perfectly under Hyper-V and can be used to implement infrastructure elements that work with a heavy load.

Source: https://habr.com/ru/post/115630/


All Articles