Thursday, March 14, 2013

Installing Kali Linux in a VirtualBox Virtual Machine

Introduction

For years, Backtrack Linux, a penetration testing suite from Offensive Security has been the standard operating system for security testing professionals. However, Offensive Security has just released a new distribution based on Backtrack called Kali Linux which seems to offer quite a few improvements. In a previous post, I showed how to create a Backtrack virtual machine using the open-source virtualization software VirtualBox. I felt it would be helpful to create a similar post showing how to create a Kali Linux virtual machine. The process will be nearly identical, but hopefully will still serve as a useful reference to some. With that being said, let's get started.Creating the Virtual Machine

After getting both Kali Linux installation media, as well as downloading and installing VirtualBox, the first thing we will want to do is to open up VirtualBox and create a "New" VM (disregard the existing VMs on my system).

Then, we will name the operating system. In this case, I will simply name it "kali". After selecting that we are intending to install Debian on the machine (since we know that Kali is using Debian), we will click "Next."

After naming the VM, we need to select the amount of memory (RAM) that we will allocate to it. Since all these virtual machines are running on my laptop, I just start out with 512 MB and move up as needed. Then we will click "Next".

Next, we need to create the virtual hard drive for the VM. I usually just select the default option to "Create a virtual hard drive now" to help keep the VM's separate. We then click "Create."

Once we have selected the type of hard drive we want, we should select the type of hard drive format we want for our virtual machine. As explained in the previous post, each of these has their purposes, but since I stick to VirtualBox, I just create the hard drive as a VDI. Then, we'll click "Next".

To save space where possible, I select to "Dynamically allocate" space on the hard drive as needed. Then, click "Next".

Finally, we need to select how much space we want to allocate to the VM. This will largely depend on personal preference, but I usually start with the default 8GB and allocate more as needed. Then, we click "Create" to create our VM.

The VM is now listed in our homescreen, so let's double-click it to boot it up. From here, we need to select the installation media we want to use. We will browse out to the ISO file we downloaded earlier. Then, we'll click "Start" to boot from the ISO.

After we land in the boot screen, we want to install the OS to the VM so that we won't need access to the ISO every time we want to use it. So, we will select "Install."

Next, we select our language, country, and keymap as appropriate. Then, we will set a hostname for our system. In this example, I just used "kali."

Then, if you have a specific domain name to configure you can do so. Otherwise, just hit "Continue". Next, we need to set a root password. Choose whatever you like, but I will use the Kali default "toor".

After confirming this password, and selecting our time zone, we need to partition our virtual hard drive to install the OS. Since we created a separate VDI for this VM, we can select to use the entire disk.

After confirming the disk to partition (the only disk available), and selecting how we want to partition the filesystem (for my example I only created one partition, but feel free to change as you would like), the installer will begin writing the changes to the disk and installing the OS.

Once everything is installed, there is one more step to do before we can boot into the system. We need to enable PAE/NX for the VM. Otherwise, you may get a fatal error when attempting to boot into Kali Linux. To do this, highlight the VM in the homescreen, and click "Settings". From here, navigate to the "System" submenu and go to the "Processor" tab. You will see the option to "Enable PAE/NX". Check this box to enable it.

After doing this, we can boot into our system. If everything goes well, we should be presented with the following login screen:

From here, just login as "root" using the password set earlier and you're good to go! Enjoy using Kali Linux, and a big thanks goes out to the guys and gals from Offensive Security who work hard to make the best distro possible.

While this was a very basic post, as always, comment below with any questions or comments!

For some reason when I run Nmap, it only can find my host... I have the network adapter set to bridged in the virtualbox settings.. is there a way i can run this and see all the other devices on my network except only my host computer?

I'm afraid I don't understand your problem.. Do you have virtualbox installed? If not, there is a previous post for doing that. If you do have it installed, then it should be a matter of downloading the latest Kali Linux ISO and following the instructions.

Nice post, unfortantly its still not working for me. At bootup i get 2 warnings and so the "OH NO! There is a problem contact system admin" Screen appears instead of the login window.the warnings are:1. Not starting: protmapper is nor working....2. Root filesystem has insufficient free space, mounting tmpfs on /tmp...Any idea why this would happen. I configured Virtualbox like you discriped. I checked several times and tried to install it on 2 diffrent computers. Both run Win7 x64 as Hostsystem.Any Help would be much appriciatedTHX

HI After I install Kali linux to virtual box I get an error message saying 'A fatal error has occurred while running the machine and the machine execution has been stopped"I have done the regular install and the graphical installs and re installed both waysand still get the same message If anyone can help that would be great Thanks

To everybody who gets an ERROR when booting into Kali: Right-Click on your Virtual Machine in the VirtualBox Manager, select "Settings". In the next window, choose "System", go to "Processor" and check the "Enable PAE/NX"-Box. Now it should work :-)

I got as far as partitioning the disk and when I clicked guided-use whole disk, it said there was apparently not enough space. I gave it more than the amount you chose for MB and GB. I have the virtual hard drive in my external hardrive. Would that be an issue? Please help I have no clue