Skip to Content

How to install Debian 11 on VirtualBox? | step by step guide.

How to install Debian 11 on VirtualBox? | step by step guide.

We have covered the installation of Debian 11 on a Windows 11 machine using dual boot in our last blog post; however, when some users want to test things out, they may not want to use both the operating system on a physical box. The problem with that is, you cannot use both operating systems at the same time, if you would like to make a switch, you need to shut down the operating system that you are working on, and power on the secondary operating system. Though it provides the good performance it may not be ideal for everyone, instead, they could virtualize the Debian 11 instead.

Can Debian 11 be installed on Virtualbox?

The VirtualBox is a free opensource hypervisor maintained by oracle. It is available for all the common operating systems such as Windows, MAC, and Linux. And you can install the majority of the operating system out there on the VirtualBox, as long as you have the iso or virtual hard disk of the operating system that you will install. You can easily install Debian 11 on VirtualBox, and it works great. However, to get good performance, it is recommended that you install VirtualBox guest additions. We will cover that as well in this blog post.

Before you begin, you need to have:

  • Virtualbox installed on the system – Download from here.
  • Debian 11 iso file. You can get that from here. Download the DVD iso file.

1. Create Debian 11 virtual machines in Virtualbox.

To create a virtual machine in VirtualBox, you will have to click on the VM menu and create a new virtual machine. You can alternatively press CTRL+New to start the virtual machine creation wizard. You have a Guided mode and an expert mode for VM creation. Since we need to have more control over the virtual machine, I choose the expert mode.

Name: Provide a user-friendly name for the virtual machine.
Machine folder: By default, VirtualBox would choose a default location. You can change the location to some other directory if you would like.
Type: Linux.
Version: Debian (64-bit)
Memory Size: 2048Mb
Hard disk: Create a virtual hard disk now.

Click on Create.

2. Create virtual hard disk.

Like any hard disk on a physical machine, the virtual machine also requires storage where it can store its files. So we need to create a virtual storage for the same.

File location: Choose where you would like to save the virtual hard disk files. You may leave the default location or choose a different one.
File size: By default, VirtualBox would assign 8GB of storage. If you are okay with that, you can leave the default. However, for my usage, I am keeping 20Gb of storage.
Hard disk file type: The VirtualBox disk image would be selected by default. You can choose the default. However, if you plan to move this virtual machine to other hypervisors such as KVM or VMware workstations, you must choose the VMDK format.

Storage on physical hard disk: Dynamically allocated.

Click on create.

3. Configure the CPU for Debian 11.

We have created the Debian 11 virtual machine. However, there are a few more things to do before proceeding with the Debian installation.

VirtualBox has given only a single CPU; for better performance, it is best to have 2 CPUs. Hence, to add the CPU’s, right-click on the VM and click on settings.

Choose system-> Processor-> Change the Value from 1 to 2. You can skip this option if you have a lower-end CPU and don’t have more core to assign.

4. Attach the Debian 11 iso image.

We need to attach the Debian 11 iso image to the VirtualBox to proceed with the installation. Click on storage, and choose the empty virtual disk.

In Attributes, click on the drop-down on the CD disk and choose a disk file.

In the prompt, browse for the iso image and click on OK. As you can see, we have selected the Debian 11 iso-image in the VirtualBox now.

5. Configure the network.

By default, the VM is configured with the NAT adapter, which will help the VM to go out to the internet and talk to the other VMs in the LAN network. However, if anybody in the LAN network wants to talk to the virtual machine, you cannot do that in the NAT network. So if your VM wants a simple internet, then the NAT network is the right option for you.

However, I would want my LAN users to be able to talk to the VM also to make the VM be part of my local network. In such a case, you can use the bridge network. I am choosing that option here. And you also need to choose what interface you are using to connect to your LAN network, in my setup it is my Wifi.

Note: using the bridged network in the office network is not recommended.

You can learn more about the Virtualbox common network here.

Click on Apply.

6. Initiate the Debian 11 installation.

We are now set and ready to proceed with the Virtual machine installation.

Double click on the virtual machine that we just installed, and after a few seconds, you will see the installation screen. Choose Graphical install.

Name the hostname and the domain address. If you don’t have a domain address, it is okay to leave it blank. And click on continue.

7. Setup root account.

When you install the Debian 11 operating system, the root account will automatically be set, the only thing that we have to do is set the password. In the root account password section, set the root account password and continue.

8. Setup Debian 11 regular account.

Apart from the root account, we should also need to create a regular account for the user as well.

  • Enter the full name and continue.
  • Username and continue.
  • Set the password and continue.

Set the timezone to your preferred location.

9. Partition the hard disk.

We have configured the virtual hard disk for the VM in Virtualbox; we need to partition the disk in the VirtualBox now.

  • Choose Guided – use entire disk.
  • If you want to have more control on the hard disk partion you could choose manual as option and click on continue.

Choose the virtual hard disk and continue.

Choose all files in one partition and continue.

Finish partitioning and write changes to disk.

Finish yes to partitioning the disk.

The installation will now proceed.

On the scan extra installation media, choose no.

10. Configure package manager.

On the package manager configuration, choose yes. This would help us get the required software later on using the internet.

Choose the package manager mirror nearest to you.

Choose the archive mirror, I am choosing deb.debain.org and continue.

If you use a proxy to get to the internet, you may enter the proxy address and click on continue.

I am not using any proxy. Hence I left it blank and clicked on continue.

11. Software selection.

You will be asked to choose the software you would like to install on the Debian virtual machine.

Apart from the default software, I am choosing the ssh server as well., That would allow me to ssh into the Debian VM later on.

Click on continue.

In the install the grup boot laoder, choose yes.

Choose the /dev/sda/xx location to install the grup boot loader.

After a few seconds, you will see the installation is complete and you may click on continue to proceed with the reboot.

12. Install VirtualBox guest additions on Debian 11.

We just completed the Debian 11 virtual machine installation in VirtualBox; however, to get better performance from the virtual machine, you will be required to install the VirtualBox guest additions software on the system.

  • Click on Devices-> install guest additions.

If you get a prompt to run the software, you may click on cancel.

  • Go to file manager, Open VirtualBox guest additions cd drive.
  • Right-click within the window and click on Open in Terminal.
  • In the terminal, Enter the command pwd to learn what directory you are in.

As you can see, we are in /media/cdrom0 directory.

  • switch to the root user by typing su root
  • And issue the command sh /media/cdrom0/VBoxLinuxAddtions.run
  • After a few seconds, the VirtualBox guest additions will be installed, and you may go ahead and restart the virtual machine.

That’s it we have now successfully installed the Debian 11 virtual machine in the VirtualBox hypervisor.