Installing Debian Linux in a VirtualBox Virtual Machine

Debian 8.2 Running

In this article, we will review the procedures required to install Debian Linux in a virtual machine managed by the VirtualBox application. A summary of the procedures is listed below:

  • Download the Debian install DVD.
  • Create a virtual machine using the VirtualBox application.
  • Boot the virtual machine from the DVD image we downloaded
  • Install the Debian Linux operating system on the virtual machine.

We will install Debian Linux because it is the version of Linux that is used by most of the researchers who have developed the network simulation tools we wish to investigate. Also, Debian is a conservative Linux distribution so we can be fairly confident that if we run into issues, we will not need to debug the operating system.

Here is the procedure we followed:

NOTE: This post was updated on January 4, 2016. I updated it to show the procedure for installing Debian 8 in VirtualBox 5.

Step 1: Download the Debian network installer

Go to http://www.debian.org and download the network installer disk image. In this example, the network installer disk image was: debian-8.2.0-amd64-netinst.iso.

Step 2: Create a new VirtualBox VM

Click on the New icon in the VirtualBox menu bar.

This will start the New Virtual Machine Wizard. The first screen is just a welcome screen so click Continue to proceed.

VM Name and OS Type

In the Name field type any name you choose (we chose “Debian 8.2”). In the Operating System field, enter “Linux” and in the Version field, enter “Debian (64 bit)”. The click Continue.

b-VirtualBox 7

Memory

Use the default setting for the amount of base memory. In our case, the default value is 768 MB. In this example, we set it to 1024 MB and we can change it later if we need to.

b-VirtualBox 7-37

Virtual Hard Disk

We will create a new virtual hard disk to use as our VM filesystem. So, use the default setting on this screen.

b-VirtualBox 7-36

In the next screen, select the format for the virtual hard disk. Here. we will us the default settings, again. So, we will use the native VirtualBox Disk Image (VDI) format. Then, click Continue.

b-VirtualBox 7-35

In the next screen, we need to choose between a Dynamically Allocated or a Fixed size virtual disk file. We should choose “dynamically allocated”, which is the default. The VirtualBox user manual says that a fixed size virtual disk file offers better file system performance but we do not know ahead of time how much disk space we really need, so it’s easier to use the default setting.

b-VirtualBox 7-34

Then, choose the location and maximum size of the VM disk image file on your host computer’s file system. Again, we just use the defaults.

In this case, the default virtual disk file size is 8GB. But, since we chose a dynamically allocated size disk file, the initial size of the disk file will be much less than 8GB. The dynamically allocated virtual disk file size will depend on the actual size of the filesystem installed in it. As we add software to the virtual machine and as running software generates log files and other data in the virtual machine, the filesystem size will grow.

b-VirtualBox 7-33

Note that the reverse does not happen. If files are deleted in the virtual disk image, the size of the virtual disk image file does not become smaller.

Click Create to proceed.

Now we see we have a Debian 8 VM available in VirtualBox and it is in the Powered Off state.

b-VirtualBox 7-32

Step 3: Insert the Debian install DVD image into the VM storage system

Now, we need to install Debian Linux. We need to configure this new virtual machine so it will boot from the network installer ISO disk image we downloaded earlier.

Select the Debian 8 virtual machine in the left side of the VirtualBox window and then click on the Settings icon in the VirtualBox menu bar.

In the screen that appears, click on the Storage icon. You will see items called IDE Controller and SATA Controller in the left side of the screen. It shows it is connected to an empty optical disk. We need to configure it so the network installer ISO disk image appears where the empty disk is now. This is just like inserting a CD or DVD installer disk into a normal host machine.

DVD’s and CD’s are attached to the IDE Controller in a real computer so click on the Empty optical disk icon below the IDE Controller. Then, click on the optical disk icon on the far right side of the window next to the CD/DVD Drive field.

b-VirtualBox 7-1

Then select the option: Choose a virtual CD/DVD disk file.

A10-VirtualBox-new

Navigate to the Downloads folder (or wherever you stored the ISO image) and select the network installer ISO image which, in this case, is debian-8.2.0-amd64-netinst.iso. Then, click Open.

b-VirtualBox 7-39

Now the disk file is available to the virtual machine and shows up as a DVD attached to the IDE Controller in the Storage Tree. Click OK to proceed.

b-VirtualBox 7-2

Now you can see that the network install ISO image is configured for the Debian 8 VM. We should be able to start it now and it will boot from the image and the software on the disk image will start the Debian Linux installation process in the virtual machine.

b-VirtualBox 7-29

Step 4: Install Debian Linux on the new virtual machine

Start the Debian virtual machine by selecting it in the VirtualBox VM Manager and then clicking on the green Start arrow. The VM will boot from the DVD, which will start the installer program on the DVD. See below for the configurations used in each of the key configuration screens. In most cases, we will use the default values.

Debian 8.2 [Running]-2

Select the country in which you a working and keyboard layout that matches the computer hardware you are using.

b-VirtualBox 7-22

b-VirtualBox 7-21

After selecting the keyboard key map, the installer installs some components and then pauses to ask for the host name. You can choose anything you want for the host name. I chose “debian”.

b-VirtualBox 7-20

It is best to leave the domain name blank, for now. We can configure it later, if we need to.

b-VirtualBox 7-19

Next, select the root password for the system. The root password is used when you need to make changes to the system’s critical software and configurations.

b-VirtualBox 7-18

Now, you will set up the user name, user id, and user password for the account you will use when working with this virtual machine. In this example, I used my real name for the user name, then I used my first name as my userid. You can use any user name and userid you wish. Then I chose a password.

b-VirtualBox 7-16

b-VirtualBox 7-15

b-VirtualBox 7-14

Next, choose the time zone in which you are working.

b-VirtualBox 7-12

In the next screen, select the default choice, Guided – use entire disk. The LVM option is an advanced disk configuration that might be useful in a real host machine but is not needed in a virtual machine. It is OK to use the LVM option, if you want.

b-VirtualBox 7-11

b-VirtualBox 7-10

All files in one partition is the simplest configuration and it is the default choice.

b-VirtualBox 7-9

b-VirtualBox 7-8

Now, you commit the disk configuration and the Debian installer will partition and format the virtual disk image file to paper it for the installation of the new Debian Linux operating system.

b-VirtualBox 7-7

The package manager application needs to be configured with information that tells it where to download additional software from, and where to find software updates in the future. the following two screens help you to choose the appropriate server. First, select the country in which the server you wish to use is located.

b-VirtualBox 7-6

Then, select the server in the country you chose. You can probably guess from the domain names which server is the most reliable. Or you can research the institutions associated with the domain names to determine which one is likely to be the best source. Don’t worry too much about choosing the best server. Any server listed will be adequate.

b-VirtualBox 7-5

Since my network does not have a proxy server, I can leave the next screen blank. Most home networks will not have a proxy server. If your network has a proxy server, enter it’s information on this screen. You may need to ask your network administrator for the proxy server information.

b-VirtualBox 7-4

b-VirtualBox 7-3

Now, the system will spend some time downloading and installing all the additional software it needs from the server you specified. This may take up to 20 minutes on a typical broadband connection.

The next screen will ask you what additional software you want to select. Debian Desktop Environment and Standard System utilities are selected by default. You should also select SSH Server so you can securely log into the virtual machine over the network if you need to.

b-VirtualBox 7-28

Next, install the GRUB bootloader.

b-VirtualBox 7-27

I suggest you install GRUB on the disk recommended by the installer. In this case, select /dev/sda from the menu in the screen below.

b-VirtualBox 7-26

b-VirtualBox 7-24

After the installation is complete, the Debian operating system boots up in the virtual machine.

Debian 8.2 [Running]-3

Log in using the userid and password you selected during the installation process.

Debian 8.2 [Running]-1

The system will be up to date. But, when you want to check for more updates, use the Debian Update Manager application.

Debian 8.2 [Running]-0

You can now proceed to install more software from inside the virtual machine, using the tools provided by the Debian Linux operating system.

In this example, I chose to shut down the virtual machine and stop at this point. I will discuss installation of additional software later, when needed.

Looking at the VirtualBox Virtual Machine Manager window, You can see that the Debian virtual machine is now configured to boot from the VDI file and the IDE controller no longer has the .iso DVD image attached to it. the .iso disk image file was automatically “ejected” by the Virtual Machine Manager application after the installation was completed.

OVB-VDI-b

66 thoughts on “Installing Debian Linux in a VirtualBox Virtual Machine”

  1. Richard Zijdeman

    Hi, Thank you very much for providing this excellent walk through. I just successfully installed the Debian 7.4 on a macbook pro running OS X 10.9.1 (March 5th, 2014)

  2. Shawn Mathiesen

    I teach Windows OS in a community college and one of the topics will be virtualization. This tutorial is perfect for my students to use to learn all about setting up a virtual machine using all freeware.
    Thanks so much for creating it!

  3. Hi Brian ,
    Can we install the debian through USB ?If so what should be format of Debian OS as it was .iso in the DVD?Does the installation of virtualbox differ when this mode is followed ?
    Thanks in advance
    Dino

    1. Hi Dino,
      USB would appear as just another available disk to VirtualBox so if you have the ISO file on a USB drive, you should be able to use it to install Debian in VirtualBox. The procedure would be the same.
      –Brian

  4. HI Brian
    I am working in windows with virtual box and this tutorial is very helpful for me but i got struck ed after the partition disk (i.e..,) the scanning of cd rom it remain in 11% and it is working after that plz guide me…
    thanks in advance….

    1. Hi Priya,
      Which version of Debian are you trying to install? I think you’ve encountered a bug that exists in Debian “Jesse”, which is not a stable release. The problem you describe is documented as a bug in the current builds of Debian Jesse. I suggest you download the Debian Wheezy (7.4) ISO file, instead. (I assume you are using the network install ISO). Information about this bug is posted at the following URLs:
      https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=740073
      http://forums.debian.net/viewtopic.php?f=17&t=111983
      Thanks for you interest,
      Brian

  5. Pingback: The Cognitive Security Analytics Company – Machine Learning, Data Science, AI and Security – Use Virtualization to Run Insecure Apps Securely

  6. Pingback: How to Host a Wargame: Red Dragon Server - Level Up Guides

  7. Very good article explaining steps..i successfully installed debian.
    Pls tell, now how to install gnu octave in debian and other softwares.
    thanks

  8. Pingback: Need Debian installation service - www.hardwarezone.com.sg

  9. Pingback: How to install the Mininet SDN Network Simulator | Open-Source Routing and Network Simulation

  10. I’ve been a developer on Windows all my career (20+ years). This walkthrough helped me install Linux for the very first time, painlessly. Thanks for taking the time!

  11. Thanks ! Great job ! It took me 1 hour to install it all. I have a question. How to instal additional software collections after installation is completed, because I pressed ENTER as I was trying to mark all collections to install but ENTER sent me to start installation.

    1. What do you mean by “all collections”? After installing, update the system using the commands:
      $ sudo apt-get update
      $ sudo apt-get upgrade
      Then install the specific packages you need. What additional software are you trying to install?

      1. I didn’t choose SSH server and SQL database. Are there any commands to get those collections(I am talking about screenshot called “A34 Debian 6.0(running)”). I am calling it “collections” because that’s how they call it on that screenshot 🙂

          1. Yeah, it was easier than finding dressed woman in google search. Sorry for wasting your time 🙂

        1. OK, for SSH I found:
          $ apt-get install ssh
          and for SQL DB:
          $ apt-get install mysql-server mysql-client

          Correct?

  12. Pingback: Debian on OSX | cdaniels.net

  13. SOME GRUB BOOTLOADER IS ON DISPLAY AFTER THE INSTALLATION IS DONE …. THE DEBIAN SCREEN IS NOT COMING WHAT TO DO?

  14. Pingback: Ranga’s Blog » Blog Archive » AGS on Debian/Parallels

  15. Ok I followed all the steps and everything went great, until debian tried to boot and then I got an error “A problem has occurred and the system can’t recover. Please contact a system administrator”. Any ideas?

    1. Hi you have to go in your computer BIOS system and enable the virtual technology probable is disabled. This is how I did it on my laptop having the same error mesage like you and after that everything was OK.Just check on the internet how you can access your computer type BIOS as on each computer you have to type different keys.

  16. same error message as andi“A problem has occurred and the system can’t recover. Please contact a system administrator”.
    before that also when the screen is black the first text message is”failed to access perfctr msr”
    is this message that could lead to the problem mention first?

  17. Thanks. But this definitely does no work. The scene is W7 sevice Pack 64 bits. Image is the latest. These walk thru stpe do work with Ubuntu hosting Virtual Box. W7 does not.
    The message “boot failure” keeps always the same. SHA 1 is ok.
    Don’t know any step further.
    Would you have any hint?

    1. Excuse-me. Service Pack 1, Windows 7 64 bits. Debian iso should be debian-8.4.0-AMD64-netinst AND NOT debian-8.4.0-arm64-netinst.
      Now it is working! Nice work, Linkletter.

  18. Pingback: Mininet-WiFi: Software defined network emulator supports WiFi networks | Open-Source Routing and Network Simulation

  19. Richard Savage

    Hi. I followed all the instructions and at the end I get a blank screen that does nothing. No blinking cursor. Nothing. Please advise.

  20. Hi Brian,
    I am running Linux Mint 17.3 and my root is on sda (500G SSD) I have a 1TB SATA drive partitioned into two (sdb1 and sdb2) (my /home folder for Linux Mint is on sdb1) During the installation I have only 1 choice and it offers configure iSCSI volumes SCSI1 (0,0,0) (sda) – 268.4GB ATA VBOX HARDISK. I so do NOT want to screw up my linux mint on sda. Why does the installer not recognize all the other partitions that are available?

    1. This post is about installing in a virtual machine, so the issues of drivers does not come up. You are attempting to install on a real machine with multiple drives and partitions. That’s a more complex case and I cannot help with that. Sorry.
      Brian

      1. Hi Brian, no, I am following your tutorial. There is nothing about installing on a real machine when you are in VirtualBox. Anyway as you can see in my previous post I got to the step in your tutorial of the slide indicating http://i0.wp.com/www.brianlinkletter.com/wp-content/uploads/2015/12/b-VirtualBox-7-10.png?w=802. When I saw this choice and I knew my current linux distro is installed on sda, I baulked and did not complete the installation because it “appears” as if my sda will be erased/formatted. do I have anything to worry about? or is all this information looking like its going to do real damage just part of creating the virtualbox installation and drives are not going to be erased or re-partitioned or destroying any current real machine configuration?

  21. Hi Brian, the article is good. But, i have one question. If we do netinstall how much data will it download. I want to know this because here data is costly and i have to know how much will it download so i can check if sufficient data balance is available before starting installation. You can assume a fairly smaller install for normal usage. Thanks.

    1. Hi Jakvara,
      You raise a good point. I did not measure how much data I used when I did the netinstall of Ubuntu. If bandwidth is limited, then I suggest you install Ubuntu from DVD. The procedure outlines in this post will also work for the other Ubuntu ISO images, including the DVD.
      Brian

  22. I am using Windows 7 64bit home. After installing VM and selecting New and then selecting Linux it only gives me 32 bit versions of Linux types to choose from. Why would that happen? I was hoping debian 7 64bit would show up on list as choice.

  23. GANESH KUMAR P

    Thank you very much. I am a school teacher. Now I successfully installed the VM for linux. I feel comfort to teach both windows and linux simultaneously. Thanks a lot.

  24. Hey, I did everything like you did but now in the end I only get a black (boot) screen. In the top left is a static underscore “_” and I can’t type nothing.

  25. Pingback: Using Virtualization to Run Insecure Apps Securely

  26. Pingback: Setup up Beagle Bone Black Cross Compilation Infrastructure – Digital Brix

  27. Hi. I seem to be running into a problem between the “Install GRUB boot loader…” step. There is a step between Install GRUB boot loader and “finish the installation…” that you did not cover.When I try to start the VM, it does not boot. Any suggestions?

    1. I see I used an incorrect screen capture. Use the “dev/sda” selection and it will work. Do not use the “manual” selection.

      I will update my post with a correction. Thank you for finding this error.

  28. Any ideas why even though I choose to install a desktop environment I’m still booting into the command line with no way to access a GUI?
    I used this iso file: debian-8.6.0-amd64-CD-1.iso

  29. Thank you so much for putting everything in proper detail, Brian!
    Even for a complete layman like me, this post has been very helpful guiding exactly in the right steps.
    Thanks a bunch!

    Cheers,
    Luke

  30. Hi Brian
    I used debian-8.5.0-amd64-netinst.iso and after the installation is complete, the Debian operating system boots and opens the terminal asking for “hostname login:” for which i gave the username which i gave during the process. it got logged in with the password.
    BUT My question is why is not the desktop GUI is not available as you shown in ur screen shots?????
    Thanks in Advance!!!

  31. Hello Brian, many thanks for your detailed tutorial. It help me a lot when installing my first Debian OS.

    I was getting lost with the official tutorial :
    https://www.debian.org/releases/stable/installmanual

    then this way:
    http://ftp.cica.es/debian/dists/jessie/main/installer-amd64/current/images/hd-media/gtk/

    then I found your tutorial and with the .iso choice (network install) was much more easier.

    but this was because I need to get used to this “world”, your tutorial is a quicker and more simple way.

    Next challange to install it in the other way 🙂

    thank you again.

    br,
    jesus

Comments are closed.

Scroll to Top