How to install Kali Linux on Hyper-V 3.x – Windows Server 2012/R2 or Windows 8.x
Note: This post has been updated on 10/01/2014 (dd/mm/yyyy) to reflect the changes of Kali Linux 1.0.6 and the fix for the bug 575 I’ve submitted (ext4 file system issues with Hyper-V).
Greetings everyone,
Backtrack was a wonderful Pentest distro, you already should be aware that Backtrack R3 was the last release and it became deprecated. Kali Linux is the new Pentest distro from the same team, more details about the changes between BackTrack and Kali Linux go here:
http://www.kali.org/news/kali-linux-whats-new/
Following the blog post How to Install BackTrack 5 R3 on Hyper-V 3.0 – Windows Server 2012 and Window 8 it is about time to come up with Kali Linux installation process on Hyper-V, as said on my previous post and as the same as Backtrack, installing Kali on VMware or Vbox is a no brainer and you can either download a pre-installed VMware VM, doing the installation on Hyper-V has some special considerations which I will cover in detail here.
You may ask, why do I care with Hyper-V. The world is changing and Hyper-V became the most reliable Hypervisor in the market since Windows 8 and Windows Server 2012, comparing feature by feature with VMWare some features are almost equal, some others are better and there’s a few that are a way too much better (almost double the specs). Windows 8.1 and Windows Server 2012 R2 are already RTM and I am running them on my environments, I can tell you that if Hyper-V was already a top technology, on the new OS versions it became even better, if you are running Windows it’s a free ride so worth’s the try.
[Before you start]
– I will show you how to install Kali Linux on Hyper-V with LVM encryption partition to protect your data. There was a bug (see below bug 443) with LVM Encryption on Kali Linux that was fixed on the release 1.05, so make sure that you download the latest release or else you will be unable to boot your Machine without fixing GRUB.
http://bugs.kali.org/view.php?id=443
– Kali Linux installation process will configure by default the ext4 file system. If you are still using Kali 1.0.5 and below on ext4 file system the installation process of Kali Linux will hang while copying the OS installation files to the HDD, this was caused by a regression on the Storvsc driver that uses the method “WRITE_SAME” which is not supported on Hyper-V, the behavior is described on the following bug entry.
http://bugs.kali.org/view.php?id=223
There was a patch for the Storvsc driver that fixes this issue to Disable and blacklist the “WRITE_SAME” method: https://patchwork.kernel.org/patch/2172871/
During the Kali Linux 1.0.5 I’ve submitted the bug 575 which is now fixed on Kali Linux 1.0.6, you can see the details here:
http://bugs.kali.org/view.php?id=575
Hopefully this bug was brought to the attention of Kali’s team and now the ext4 file system is fully supported on Hyper-V.
For the purpose and success of this installation you need to download and install Kali Linux 1.0.6 and beyond, the installation is now reflecting the full compatibility of ext4 file system.
[Installation process]
1. Install the Hyper-V role on your machine, follow these links if you are not familiar yet with the process:
Windows Server 2008 R2 Hyper-V Getting Started Guide
http://technet.microsoft.com/en-us/library/cc732470(v=WS.10).aspxWindows Server 2012 Install the Hyper-V Role and Configure a Virtual Machine
http://technet.microsoft.com/en-us/library/hh846766.aspx
2. Go to the Kali website Download section and download the Kali Linux ISO file 1.05 or higher. I prefer Kali Linux 64 bit so this Wizard is focused on this distribution installation.
Kali Linux Download section:
http://www.kali.org/downloads/
3. On the Hyper-V Manager create a new Virtual Machine and Virtual Hard Disk:
On the right pane Click “New” –>Virtual Machine
On the New Virtual Machine Wizard –> Next
Define the Machine Machine Name and the location of the Virtual Machine configuration files
If your are running a Windows 8.1 or Windows Server 2012 R2 host Select the Virtual Machine “Generation 1”
Set the Memory size “2048” MB (depending on your needs, this is my setup memory)
Select your Internal or External Virtual Switch Network created on Step 3.
Create a Virtual Hard Disk (default: differential) with 30GB (depending on your needs)
Select “Install Operating System from a Boot CD/DVD” and Select the “image file (ISO)” downloaded on Step 2.
Review the VM configuration ao click “Finish” to complete the VM setup.
4. Start the Kali Linux Virtual Machine and from the Boot Menu select the “Graphical Install” option as shown in the pic
5. On the Language screen select your preferred language, e.g. “English – English” and your Location, e.g. “Other –> Europe –> Portugal”
6. Select your Locals, e.g. “United States – en_US.UTF-8” and your Keyboard type, e.g. “Portuguese”
7. On the Network Configuration Screen select “ Configure Network Manually” (if you have a DHCP Server available on the same network you may use the automatic configuration, on my lab I’ll do a manual network config)
8. Define your IP address and network mask, e.g. “10.0.0.100/24” and your gateway, e.g. “10.0.0.254”
9. Configure your name server, e.g. “192.168.0.1” and your hosname, e.g. “kalim3r0”
10. Define the domain name, e.g. “lab.local”
11. Define the root user password
12. Configure the clock, e.g. “Lisbon”
13. On the Partition Disks setup window select “Guided – Use entire disk and set up encrypted LVM”
Select the appropriate partition disk and click continue, e.g. “SCSI 3 (0,0,0) (sda) – 32,2 GB Msft Virtual Disk”
14. On the Partition Disks partitioning window select “All files in one partition (recommended for new users)”, for the purpose of this demo this is the simplest option, you can define separate partitions for /home, /usr, /var, etc, etc
15. Confirm the Logical Volume Manager configuration, on “Write the changes to disks and configure LVM” Select “Yes”
16. Define a Passphrase for the Encryption, don’t forget this passphrase because you will need to type it every time you boot up Kali Linux
17. On the Partition disks window with the Logical Volume Manager, partitions and mount point details, keep the default file system configuration (Kali 1.0.6 and above you can use ext4 file system) and click on the “Continue” button.
18. Confirm the changes and configuration of the Partition Disk on “Write the changes to disks” and select “Yes”
19. On the Configure the package manager window on “Use a network mirror” select “Yes”.
The intent of this process is to update the Kali Linux packages during the OS install, so make sure that you have Internet connectivity to accomplish this task
20. When you go ahead with the packages updates with the last step you may configure a proxy server ip address. For the purpose of this lab I have NAT and access to the internet, so I don’t need a proxy server and I will leave it blank
21. On the Install the Grub boot loader on a hard disk on “Install the GRUB boot loader to the master boot record?” select “Yes”
After GRUB boot loader installation the Kali Linux installation is complete and you should see the Finish Installation window, click on “Continue” to boot up Kali Linux
22. When you boot Kali Linux you will be prompted with the GRUB boot loader option and it will automatically boot in normal mode
23. After the boot you will be prompted for the Encryption Passphrase you defined on step 21
24. After
boot you will be prompted for credentials to Log in:
Username: root
Password: The password you defined on step 15
25. Finally you will have access to the so waited Kali Linux desktop
[EXTRAS]
No matter if you are a Linux newbie or you had forgotten the appropriate syntax for some of the common Linux commands, here are some helpful terminal commands:
1. Define a new password
passwd
2. Configure network settings:
Temporary configuration (will disappear after reboot):
ifconfig
(to verify which network interface is available, possibly “eth0”)Ifconfig eth0 10.0.0.100 netmask 255.255.255.0 up
route add default gw 10.0.0.254 eth0
Static configuration:
ifconfig
(to verify which network interface is available, possibly “eth0”)sudo nano /etc/network/interfaces
On the appropriate interface line (e.g. confirmed in ifconfig “eth0″) edit and append as follow:
auto eth0
iface eth0 inet static
address 10.0.0.100
gateway 10.0.0.254
netmask 255.255.255.0
network 10.0.0.0
broadcast 10.0.0.255
3 . Configure the DNS resolver
sudo nano /etc/resolv.conf
On the resolv.conf file insert the following entry:
nameserver 192.168.0.1
(IP of your nameserver)
4. Reload the new network configuration by restarting the network daemon
sudo /etc/init.d/networking restart
5. Download the list of the updated packages
apt-get update
6. Compare and update installed packages
apt-get upgrade
7. Install a new package
apt-get install <packagename>
R-Tape Loading error,
Luís Rato
Thanks for sharing this information!
nice job, thanks a bunch 🙂
Hello,
I followed your post and was able to successfully install Kali 1.0.9. However, a couple problems. I did not have an option to do a ‘graphical install’, it was just install. After installing the mouse is jittery and the scroll wheel function does not work. And finally, I was trying to enlarge my screen which I could not do within the display system settings. It only had one resolution which I guess is the default for either hyper v or the kali install. I have numerous selection under vmware workstation or player. As I use the Kali distro for most of my computing; do you know how to resolve these issues I’ve mentioned? Thanks!
Hi Nadee,
check this blog post to fix the Screen resolution issue.
http://luisrato.azurewebsites.net/2014/12/30/how-to-change-the-video-resolution-on-a-kali-linux-vm-running-on-hyper-v/
Regards,
Luís