Page 1 of 5 123 ... LastLast
Results 1 to 10 of 49

Thread: Installing Kali Linux as a Virtual Machine in Virtual Box

  1. #1
    Super Moderator
    Join Date
    Mar 2013
    Posts
    65

    Installing Kali Linux as a Virtual Machine in Virtual Box

    Covered in this tutorial:
    • Creating a proper Virtual Machine for Kali Linux
    • Installing Kali Linux to a hard disk inside the Virtual Machine
    • Install VirtualBox Guest Addition Tools in Kali Linux
    • Setting up shared folders in VirtualBox with your Kali Linux installation


    Note: The instructions below were performed with the latest version of VirtualBox which at the time of this tutorial is 4.2.8. If you are experiencing issues with 4.1.x, please upgrade VirtualBox to this or a later release.

    Although each platform of VirtualBox has slight aesthetic differences, this method should work on any VirtualBox platform.

    Creating the Virtual Machine:
    • When you launch VirtualBox you will be presented with the Virtual Machine Manager. From this screen you can create a new virtual machine by clicking 'New' in the upper left corner.
    • The next screen will ask you to provide a Name, OS Type and Version. You can provide any name you would like for the virtual machine. Set the Type to 'Linux' and the Version to 'Debian.' VirtualBox offers both 32 and 64 bit options, please make sure to choose the proper version for your architecture. Once completed, click the continue button to move on with the setup.
    • The next portion allows you to configure the amount of memory to allocate to your new virtual machine. It is best to provide as much as can be spared, but as a minimum allocate 2048MB. Once completed, click the Continue button.
    • The next step is creation of the virtual machine hard drive, The default is to 'Create a virtual hard drive now.' Accept the default and click the Create button in the lower right portion of the window.
    • In this step, VirtualBox allows you the option to pick your hard drive file type. The default is VDI (VirtualBox Disk Image), however you can create any other type. For example, creating a VMDK will allow you to use this hard drive with VMWare as well as VirtualBox. Once you have selected your file type, click the Continue button.
    • The next step asks if you would like to allocate the entire amount of disk space at once, or dynamically allocate as hard drive space is needed. For example, if you specify a hard drive of 20GB, the initial size of the install may only be 10GB, but will grow as required until it hits the maximum size allocated. Either option is acceptable and is clearly user preference. Once you have made your selection, click the Continue button.
    • The next step is for creation of the hard drive file location and size. For location, it will always install in the default directory and only needs to be changed if desired.
    • The base install of Kali Linux will take up approximately 8GB of disk space. It is good practice to provide roughly 4 times that amount in order to ensure proper space as you add to and update the installed system with tools and files. Once you have provided the desired size, click the Create button.


    You have now created your virtual machine in VirtualBox.

    Although your virtual machine is created, there are a few steps to complete before starting it. With your newly created Kali Linux virtual machine selected, click the 'General' link in the right portion of the Manager window. This will launch a window that allows for additional configuration settings.

    Here you can make any changes you need to your new virtual machine. There are at least two changes that should be made during this step, the amount of processors to allocate to the Kali Linux VM and the attachment of the Kali Linux iso for first boot and installation.

    To change the amount of processors, select the System option and the Processor tab. As a default, the machine is granted only 1 VCPU. You can provide the VM as many processors as you like, but at least 2 are recommended.

    Next, select the Storage option to attach your Kali Linux ISO image. In the Storage Tree window, select your CD-Rom controller. Then within the Attributes pane click the CD-Rom Icon and 'Choose a virtual CD/DVD disk file' from the pop up menu. This will open a window to browse the host system for your Kali Linux ISO file. Once selected, click the Open button and then click the OK button to save all your changes you will be returned to the VirtualBox Manager.

    Your VirtualBox Virtual Machine is now ready for initial startup and Kali Linux Installation. You can now click the Start Button to launch the VM and begin the Kali Linux installation process.

    Kali Linux Installation

    The tutorial for installing Kali Linux can be found here. Once installation is complete, you will need to install the VirtualBox Guest Addition tools.

    Installing VirtualBox Guest Additions in Kali Linux
    In order to have proper mouse and screen integration as well as folder sharing with your host system, you will need to install the VirtualBox Guest additions.

    Once you have booted into your Kali Linux virtual machine, open a terminal window and issue the following command to install the Linux Kernel headers.
    Code:
    apt-get update && apt-get install -y linux-headers-$(uname -r)
    NOTE: If you are not running as root, ensure you prepend the command with a 'sudo'

    Once this is complete you can now attach the Guest Additions CD-Rom. This can be done by selecting 'Devices' from the VirtualBox Menu and selecting 'Install Guest Additions.' (In addition you can use the shortcut Host key+D.) This will mount the virtual CD Drive to your Kali Linux virtual machine. When prompted to autorun the CD, click the Cancel button.

    From a terminal window copy the VboxLinuxAdditions.run file from the Guest Addition CD-Rom to a path on your local system and then run the file.
    Code:
    cp /media/cd-rom/VBoxLinuxAdditions.run /path/to/copy/file
    Code:
    ./VboxLinuxAdditions.run
    NOTE: If you are not running as root, ensure you prepend the command with a 'sudo'

    Reboot the Kali Linux VM to complete the Guest Additions installation. You should now have full mouse and screen integration as well as the ability to share folders with the host system.

    Creating Shared Folders with the Host System
    • In order to share folders on your host system with your Kali Linux VM, there are a few short steps that need to be completed.
    • From the VirtualBox Manager, select your Kali Linux VM instance and click on the 'Shared Folders' link in the right window pane. This will launch a pop up window for adding shared folders. Within this window click the icon to add a folder (the icon is a Folder with a '+' on it).
    • In the Folder Path text box, provide the path to the folder you would like to share, or click the drop-down arrow to browse your host system for the path. Select the check boxes that allow for 'Auto-mount' and 'Make Permanent' and click the OK button both times when prompted.


    Your shared folders will now be available in the media directory. You can create a bookmark or link for easier access to the directory.
    Last edited by brav0hax; 03-16-2013 at 05:56 AM.

  2. #2
    Member
    Join Date
    Mar 2013
    Location
    In AnonWorld
    Posts
    40
    Quote Originally Posted by brav0hax View Post
    Covered in this tutorial:
    • Creating a proper Virtual Machine for Kali Linux
    • Installing Kali Linux to a hard disk inside the Virtual Machine
    • Install VirtualBox Guest Addition Tools in Kali Linux
    • Setting up shared folders in VirtualBox with your Kali Linux installation


    Although each platform of VirtualBox has slight aesthetic differences, this method should work on any VirtualBox platform.

    Creating the Virtual Machine:
    • When you launch VirtualBox you will be presented with the Virtual Machine Manager. From this screen you can create a new virtual machine by clicking 'New' in the upper left corner.
    • The next screen will ask you to provide a Name, OS Type and Version. You can provide any name you would like for the virtual machine. Set the Type to 'Linux' and the Version to 'Debian.' VirtualBox offers both 32 and 64 bit options, please make sure to choose the proper version for your architecture. Once completed, click the continue button to move on with the setup.
    • The next portion allows you to configure the amount of memory to allocate to your new virtual machine. It is best to provide as much as can be spared, but as a minimum allocate 2048MB. Once completed, click the Continue button.
    • The next step is creation of the virtual machine hard drive, The default is to 'Create a virtual hard drive now.' Accept the default and click the Create button in the lower right portion of the window.
    • In this step, VirtualBox allows you the option to pick your hard drive file type. The default is VDI (VirtualBox Disk Image), however you can create any other type. For example, creating a VMDK will allow you to use this hard drive with VMWare as well as VirtualBox. Once you have selected your file type, click the Continue button.
    • The next step asks if you would like to allocate the entire amount of disk space at once, or dynamically allocate as hard drive space is needed. For example, if you specify a hard drive of 20GB, the initial size of the install may only be 10GB, but will grow as required until it hits the maximum size allocated. Either option is acceptable and is clearly user preference. Once you have made your selection, click the Continue button.
    • The next step is for creation of the hard drive file location and size. For location, it will always install in the default directory and only needs to be changed if desired.
    • The base install of Kali Linux will take up approximately 8GB of disk space. It is good practice to provide roughly 4 times that amount in order to ensure proper space as you add to and update the installed system with tools and files. Once you have provided the desired size, click the Create button.


    You have now created your virtual machine in VirtualBox.

    Although your virtual machine is created, there are a few steps to complete before starting it. With your newly created Kali Linux virtual machine selected, click the 'General' link in the right portion of the Manager window. This will launch a window that allows for additional configuration settings.

    Here you can make any changes you need to your new virtual machine. There are at least two changes that should be made during this step, the amount of processors to allocate to the Kali Linux VM and the attachment of the Kali Linux iso for first boot and installation.

    To change the amount of processors, select the System option and the Processor tab. As a default, the machine is granted only 1 VCPU. You can provide the VM as many processors as you like, but at least 2 are recommended.

    Next, select the Storage option to attach your Kali Linux ISO image. In the Storage Tree window, select your CD-Rom controller. Then within the Attributes pane click the CD-Rom Icon and 'Choose a virtual CD/DVD disk file' from the pop up menu. This will open a window to browse the host system for your Kali Linux ISO file. Once selected, click the Open button and then click the OK button to save all your changes you will be returned to the VirtualBox Manager.

    Your VirtualBox Virtual Machine is now ready for initial startup and Kali Linux Installation. You can now click the Start Button to launch the VM and begin the Kali Linux installation process.

    Kali Linux Installation

    The tutorial for installing Kali Linux can be found here. Once installation is complete, you will need to install the VirtualBox Guest Addition tools.

    Installing VirtualBox Guest Additions in Kali Linux
    In order to have proper mouse and screen integration as well as folder sharing with your host system, you will need to install the VirtualBox Guest additions.

    Once you have booted into your Kali Linux virtual machine, open a terminal window and issue the following command to install the Linux Kernel headers.
    Code:
    apt-get update && apt-get install -y linux-headers-$(uname -r)
    NOTE: If you are not running as root, ensure you prepend the command with a 'sudo'

    Once this is complete you can now attach the Guest Additions CD-Rom. This can be done by selecting 'Devices' from the VirtualBox Menu and selecting 'Install Guest Additions.' (In addition you can use the shortcut Host key+D.) This will mount the virtual CD Drive to your Kali Linux virtual machine. When prompted to autorun the CD, click the Cancel button.

    From a terminal window copy the VboxLinuxAdditions.run file from the Guest Addition CD-Rom to a path on your local system and then run the file.
    Code:
    cp /media/cd-rom/VBoxLinuxAdditions.run /path/to/copy/file
    Code:
    ./VboxLinuxAdditions.run
    NOTE: If you are not running as root, ensure you prepend the command with a 'sudo'

    Reboot the Kali Linux VM to complete the Guest Additions installation. You should now have full mouse and screen integration as well as the ability to share folders with the host system.

    Creating Shared Folders with the Host System
    • In order to share folders on your host system with your Kali Linux VM, there are a few short steps that need to be completed.
    • From the VirtualBox Manager, select your Kali Linux VM instance and click on the 'Shared Folders' link in the right window pane. This will launch a pop up window for adding shared folders. Within this window click the icon to add a folder (the icon is a Folder with a '+' on it).
    • In the Folder Path text box, provide the path to the folder you would like to share, or click the drop-down arrow to browse your host system for the path. Select the check boxes that allow for 'Auto-mount' and 'Make Permanent' and click the OK button both times when prompted.


    Your shared folders will now be available in the media directory. You can create a bookmark or link for easier access to the directory.
    when i try this code with sudo apt-get update && apt-get install -y linux-headers-$(uname -r)
    and i get this error "root@kali:~# sudo apt-get update && apt-get install -y linux-headers-$(uname -r)Hit http://security.kali.org kali/updates InRelease
    Hit http://security.kali.org kali/updates/main amd64 Packages
    Hit http://security.kali.org kali/updates/contrib amd64 Packages
    Hit http://security.kali.org kali/updates/non-free amd64 Packages
    Ign http://security.kali.org kali/updates/contrib Translation-en_US
    Ign http://security.kali.org kali/updates/contrib Translation-en
    Ign http://security.kali.org kali/updates/main Translation-en_US
    Ign http://security.kali.org kali/updates/main Translation-en
    Ign http://security.kali.org kali/updates/non-free Translation-en_US
    Ign http://security.kali.org kali/updates/non-free Translation-en
    Reading package lists... Done
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package linux-headers-3.7-trunk-amd64
    E: Couldn't find any package by regex 'linux-headers-3.7-trunk-amd64'
    root@kali:~#
    "
    im using amd64 on vmplayer

  3. #3
    Super Moderator
    Join Date
    Mar 2013
    Posts
    65
    I doubt this is the issue, but I can tell you, you don't need the 'sudo' you're running as root already.

    It seems to me that your sources.list is messed up. They should look like this: http://pastebin.com/5cUsiBZr

    If they do not, you can copy/paste this in the file and you should be ok. I can already tell that it won't match based on your output.

    Best Regards,
    Eric

  4. #4
    Junior Member
    Join Date
    Mar 2013
    Posts
    5
    Quote Originally Posted by Gr4nD T3R0R View Post
    when i try this code with sudo apt-get update && apt-get install -y linux-headers-$(uname -r)
    and i get this error "root@kali:~# sudo apt-get update && apt-get install -y linux-headers-$(uname -r)Hit http://security.kali.org kali/updates InRelease
    Hit http://security.kali.org kali/updates/main amd64 Packages
    Hit http://security.kali.org kali/updates/contrib amd64 Packages
    Hit http://security.kali.org kali/updates/non-free amd64 Packages
    Ign http://security.kali.org kali/updates/contrib Translation-en_US
    Ign http://security.kali.org kali/updates/contrib Translation-en
    Ign http://security.kali.org kali/updates/main Translation-en_US
    Ign http://security.kali.org kali/updates/main Translation-en
    Ign http://security.kali.org kali/updates/non-free Translation-en_US
    Ign http://security.kali.org kali/updates/non-free Translation-en
    Reading package lists... Done
    Reading package lists... Done
    Building dependency tree
    Reading state information... Done
    E: Unable to locate package linux-headers-3.7-trunk-amd64
    E: Couldn't find any package by regex 'linux-headers-3.7-trunk-amd64'
    root@kali:~#
    "
    im using amd64 on vmplayer
    You shouldn't really quote a whole thread, also, use code tags to show your codes in a proper format.

  5. #5
    Junior Member
    Join Date
    Mar 2013
    Posts
    3
    Quote Originally Posted by Coded32 View Post
    You shouldn't really quote a whole thread, also, use code tags to show your codes in a proper format.
    And it'd be really great if you didn't post useless comments without addressing the topic thanks. On a second note I'm having an issue mounting the guest additions iso all together. I installed the headers, and clicked the "install guest additions drop down". Nothing occurs and a second attempt throws up an error about the drive being locked. I tried mounting /dev/cdrom manually. It gives me a file type required message, and when i specify one it gives an incorrect type error. FWIW there's no /media/cd-rom directory automatically in either the 386 or x64 versions. Any help is appreciated.

  6. #6
    Super Moderator
    Join Date
    Mar 2013
    Posts
    65
    Note: The instructions were performed with the latest version of VirtualBox which at the time of this tutorial is 4.2.8. If you are experiencing issues with 4.1.x, please upgrade VirtualBox to this or a later release.

    Many of the issues being reported appear to be related to VitualBox 4.1.x installed on the host system. There are known issues with this version and newer kernels. (https://www.virtualbox.org/ticket/11036)

    I recommend you upgrade to the latest version of VirtualBox from https://www.virtualbox.org/wiki/Downloads.

    Thanks

  7. #7
    Junior Member
    Join Date
    Mar 2013
    Location
    IXE
    Posts
    12
    hey brav0hax : cp /media/cd-rom/VBoxLinuxAdditions.run /path/to/copy/file what path should be typed ???? plz mention awaiting for your prompt reply

  8. #8
    Junior Member
    Join Date
    Mar 2013
    Posts
    1
    Quote Originally Posted by brav0hax View Post
    I doubt this is the issue, but I can tell you, you don't need the 'sudo' you're running as root already.

    It seems to me that your sources.list is messed up. They should look like this: http://pastebin.com/5cUsiBZr
    Thanks Eric, adding these two lines did fixxed it it for me indeed:

    Code:
    deb http://http.kali.org/kali kali main non-free contrib
    deb-src http://http.kali.org/kali kali main non-free contrib

  9. #9
    Junior Member
    Join Date
    Mar 2013
    Posts
    3
    Update: It appears to be an issue with 4.2.10. The issue exists in my Windows VMs also, so we'll see if Oracle gets a fix out anytime soon.

  10. #10
    Junior Member
    Join Date
    Mar 2013
    Posts
    1
    hello all,
    I just put an online tutorial to install French "KALI" under "VirtualBox"
    if you are interested it is here:

    http://bidouiller.fr/2013/03/15/tuto...ur-virtualbox/

    Sincerely,

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •