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.
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.
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.
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.
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.
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.
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.
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.
Then select the option: Choose a virtual CD/DVD disk file.
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.
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.
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.
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.
Select the country in which you a working and keyboard layout that matches the computer hardware you are using.
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”.
It is best to leave the domain name blank, for now. We can configure it later, if we need to.
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.
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.
Next, choose the time zone in which you are working.
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.
All files in one partition is the simplest configuration and it is the default choice.
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.
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.
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.
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.
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.
Next, install the GRUB bootloader.
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.
After the installation is complete, the Debian operating system boots up in the virtual machine.
Log in using the userid and password you selected during the installation process.
The system will be up to date. But, when you want to check for more updates, use the Debian Update Manager application.
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.
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)
Thanks, Richard. I appreciate your feedback.
–Brian
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!
I’m glad you found this information to be useful, Shawn!
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
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
thanks Brian.Your tutorial helped me a lot
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….
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
@it is not working after that how to overcome this
Pingback: The Cognitive Security Analytics Company – Machine Learning, Data Science, AI and Security – Use Virtualization to Run Insecure Apps Securely
Pingback: How to Host a Wargame: Red Dragon Server - Level Up Guides
Very good article explaining steps..i successfully installed debian.
Pls tell, now how to install gnu octave in debian and other softwares.
thanks
Pingback: Need Debian installation service - www.hardwarezone.com.sg
Pingback: How to install the Mininet SDN Network Simulator | Open-Source Routing and Network Simulation
Great tutorial! Thanks a lot!
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!
this artikel very good
can u please send me a URL of the Debian 6 version to download it??
You should use the latest version of Debian (7.8) unless you have a specific requirement to use 6.0. If you really need to install an old release, they are stored at the following URL: http://cdimage.debian.org/cdimage/archive/
Great tutorial. Thank you!
Thanks for your excellent walk through. I manage to install Ubuntu Server 14.04.
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.
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?
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 🙂
Look at the following links.
https://packages.debian.org/squeeze/ssh
https://packages.debian.org/jessie/mysql-server
# apt-get install ssh
# apt-get install mysql-server
Yeah, it was easier than finding dressed woman in google search. Sorry for wasting your time 🙂
OK, for SSH I found:
$ apt-get install ssh
and for SQL DB:
$ apt-get install mysql-server mysql-client
Correct?
Thanks dude 😀 its very helpful
Pingback: Debian on OSX | cdaniels.net
Very Useful. Thanks
SOME GRUB BOOTLOADER IS ON DISPLAY AFTER THE INSTALLATION IS DONE …. THE DEBIAN SCREEN IS NOT COMING WHAT TO DO?
Pingback: Ranga’s Blog » Blog Archive » AGS on Debian/Parallels
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?
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.
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?
dear sir
let us know latest update as you know on debian
b/r
mozaffar
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?
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.
Pingback: Mininet-WiFi: Software defined network emulator supports WiFi networks | Open-Source Routing and Network Simulation
Hi. I followed all the instructions and at the end I get a blank screen that does nothing. No blinking cursor. Nothing. Please advise.
Hi Richard,
This has happened to me in the past, but very infrequently. I would stop the VM and start it again and that usually solved the problem.
Some links that may help:
http://askubuntu.com/questions/371432/how-to-troubleshoot-booting-to-a-black-screen-on-virtualbox
http://superuser.com/questions/965065/ubuntu-running-on-virtual-box-shows-black-screen
Thanks,
Brian
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?
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
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?
If you are installing Linux on a virtual machine, then you have nothing to worry about. If you make a mistake, delet the VM and create a new one.
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.
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
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.
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.
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.
Pingback: Using Virtualization to Run Insecure Apps Securely
Pingback: Setup up Beagle Bone Black Cross Compilation Infrastructure – Digital Brix
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?
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.
Confirmed to work on ASUS Laptop within Windows 10 with Debian 8.5.0.
pls how can i convert the CLI to GUI.
Look at my post about setting up a desktop system on AWS to see the procedure to install XFCE on a server.
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
Well, using the net installer debian-8.6.0-amd64-netinst instead solves the problem.
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
Hi Brian,
I got stuck up with “Bad Archive mirror” while configuring the package manager.
I use http://cdimage.debian.org/debian-cd/current/amd64/iso-cd/debian-8.7.1-amd64-netinst.iso. How to proceed from here?
Any help would be appreciated!!
Thanks in Advance!
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!!!
Great. Thank you for the installation Guide.:)
Thanks a lot.
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