How To Install Kali Linux on Virtual Machine

by 9:02 PM 0 comments
Hi friends, the latest version of Kali Linux 1.0.6  has been released and is available for download here.  Today we are going to see how to install this latest version of Kali Linux in Oracle Virtualbox’s latest version available for download http://sh.st/wE758 . In this step-by-step guide, I will try to resolve all the problems faced in the installation of Kali Linux(1.0.5) including installation of virtualbox guest additions and screen integration problems. So let’ start.
First let’s create a  new virtual machine. Open Virtualbox and go to “Machine” and click on New as shown below.
v1
Choose your virtual machine’s name as you like. I named it Kali(1.0.6). Choose the OS type as “Linux” and version as “Debian(32 bit)” ( since I am installing 32bit version.). Click on Next.
v2
Allot the memory of  atleast 512MB. Click on Next.
v3
Select the option “Create a virtual hard drive now”. Click on “Create“.
v4
If you want to use your virtual machine  image with other virtualization software like Vmware, select vmdk image otherwise select vdi image. Click on “Next“.
v5
Select the option “Dynamically allocated”. Click on “Next”.
v6
Allocate  atleast 15GB of hard disk to the virtual machine. Click on “Create“.
v7
The virtual machine is created. It’s time to boot into our operating system. Before booting into Kali Linux we need to make  a few changes. Go to “Settings” as shown below.
v8
Go to System>Processor and enable the option “Enable PAE/NX” and click on OK.
v8a
Start the virtual machine and browse to the location of the iso file of Kali Linux and click on “Start“.
v9
Select the option “Install”. Hit “Enter”.
v10
Choose the language as “English” or as applicable.
v11
Select the location of your choice. I chose “India.”
v12
Choose your keyboard.
v13
The system will load some additional components and then prompt you for the hostname. Enter hostname and Activate the “Continue” button.
v15
You can choose the domain name if you want. However it is optional. Activate “Continue”
v16
The system will prompt you to set the root password. Enter the root password and click on “Continue.”
v17
Re-enter the password to verify. Click on “Continue.”
v18
The system will prompt you to partition disks. If you are not sure what to do, choose “Guide-use entire disk.” option.
v19
Confirm the disk partitioning.
v20
Select the partitioning scheme of your choice. If you are a new user choose the first option as recommended.
v21
Then you will be given an overview of current settings. Choose the option “Finish partitioning and write changes to disk.”
v22
Select the option “Yes” to write the changes to disk.
v23
The installation of the system will start. In the middle of the process, you will be prompted if you want to use a network mirror. select “No”.
v25
Then system will ask you whether to install the grub loader to MBR. Click “Yes”  and the installation will continue.
v28
When the installation is completed, the system will ask you to reboot into the system. click on “Continue”.
v30
The system will reboot into the operating system as shown below. Enter the username as “root” and the password as configured previously.
v31
Now comes the most interesting but contentious part. Yes, installation of guest additions. But don’t worry. you will have a final solution at the end of the article. Install guest additions by going to “Devices>install guest additions”. A cd image will appear on the Kali desktop. Double click on the cd image. A message will be displayed as below. Click on “Run”.
v32
Most probably you will get an error message as shown below.
v33
Open a terminal. Type the command “pwd” to see the current directory. Go to the “media” directory where our virtualbox guest additions cd is mounted by typing commands “cd/” and then “cd media”. Type “ls” to see where our guest additions  is mounted. It’s mounted at directory “cdrom”. Navigate to that directory by typing command “cd cdrom“.  Type the command “ls” once again to see the contents of the directory.
v34
We are interested in the file “VBoxLinuxAdditions.run”. Check the permissions of this program by typing command “ls -l VBoxLinuxAdditions.run”. We can see that the root user doesn’t have “execute” permissions on this file. First copy this file to the root directory by typing command cp VBoxLinuxAdditions.run /root. Now go to root directory by typing command cd /root. Change the permissions of this file by typing command chmod 755 VBoxLinuxAdditions.run. Now let’s check if the permissions have been changed. Type command ls -l  VBoxLinuxAdditions.run. We can see below that now we have execute permissions over this file.
v35
Now let’s run this program. Type command ./VBoxLinuxAdditions.run. Guest additions would be successfully installed BUT( and that’ s a but in capital letters)  if you get the below error message then guest additions have not been installed and you  have some more work to do.
v36
If we observe the above error message, it’s very clear that the headers for the current kernel were missing. So let’s try to install the headers for the current kernel. Type command apt-get update && apt-get install -y linux-headers-$(uname -r). Hopefully this should work but if it says it was unable to locate the  headers as shown below, then we have some more work to do. Actually in the installation of previous version of Kali Linux(1.0.5) on Virtualbox, even if the headers were not installed, guest additions installation was successful  for some people. However let’s not rely on probability for this version. So let’s move on.
v37
If the system says it cannot find the package of headers, it is very evident that it is not looking in the right place. We need to specify the location where the system should look for headers. We will do it by altering the sources.list file. For those who don’t know, sources.list file is a file where system  has list of repositories where the OS  should be checking for updates or installing new programs. Type the command locate sources.list to search for sources file. We are interested in the one located in the “apt” directory. We will open this file using vi editor. Type command vi /etc/apt/sources.list.
v37a
If you are new to vi editor, type i once to get into insert mode, then add the following three lines given in red box in the below image to your sources.list file. Once you are finished, tap the esc key to get out of insert mode,then type :wq to save and exit the file.
v37b
Type the command apt-get update && apt-get install -y linux-headers-$(uname -r) once again to install the headers. You will see the below processes taking palce.
v38

v39
We can see below that the linux headers have been successfully installed.
v40
Now let’s install the guest additons. type command ./VBoxLinuxAdditions.run.  We can see below that this time the isntallation has not failed.
v41
Reboot the system by typing command shutdown -r -t / 0. Hope this was helpful. If you face any problems please leave a comment below.
v42

Unknown

Developer

We Looked in the Face Of Truth As iT Told Us Lies

0 comments:

Post a Comment