Install Raspberry Pi OS Desktop on a Virtual Machine (VirtualBox)

Raspbian Desktop Welcome Screen

In this tutorial I’ll show you how to install Raspberry Pi OS Desktop on a virtual machine, and more specifically on VirtualBox.

As you may know, Raspberry Pi OS is the new name for Raspbian – the official OS for Raspberry Pi boards, derived from Debian.

But… Raspberry Pi OS is not only working on Raspberry Pi boards. You can actually install it on a standard computer. In fact, there is a Raspberry Pi OS Desktop version just for that! And even better, you can install Raspberry Pi OS Desktop directly on a virtual machine. This will allow you to do some experiments and test Raspberry Pi OS, directly from your computer (on Windows, Linux, or Mac).

This tutorial is a step by step guide to help you during the installation process.

Let’s get started!

You are learning how to use Raspberry Pi to build your own projects?

Check out Raspberry Pi For Beginners and learn step by step.

Watch this video as an additional resource to this article:

After watching the video, subscribe to the Robotics Back-End Youtube channel so you don’t miss the next tutorials!

Install VirtualBox

As stated before, for this tutorial I’ll use VirtualBox. You can download the installer from their official wiki page. Take the latest available version, and choose the OS you’re currently using (Windows, Linux, Mac).

Then, after you’ve downloaded it, click on the installer and follow the steps on the screen to install VirtualBox on your computer.

Download Raspberry Pi OS Desktop ISO

Go to the Raspberry Pi download page – Raspberry Pi Desktop section – and click on the “Download” button for a direct download. You can also choose to download by Torrent, in this case make sure you have a Torrent software installed on your computer.

The download part is the longest of the installation process, as the ISO file is more than 2GB.

Create a new virtual machine for Raspberry Pi OS Desktop

Start VirtualBox. On the left you’ll see the list of all virtual machines you’ve already created. If you just installed VirtualBox, this list will be empty. As you can see on the image below, in my case I already have one. Let’s now create a new one for Raspberry Pi OS Desktop. Click on the “New” button.

Create New VM in Virtual Box

You will get a setting popup for your new virtual machine.

Virtual Machine Name and type

First select a name which will be easy for you to remember. As you’ll install Raspberry Pi OS Desktop OS, why not simply call it “Raspberry Pi OS Desktop” (or “Raspbian Desktop”) ?

Also, you need to choose what kind of machine you want it to be. In this case, Linux, and more specifically Debian (64-bit).

Raspbian Desktop VM Name

Click on “Next”.

RAM allocation

Now you’ll have to choose how much RAM you want to allocate for your virtual machine. As you can see the recommended memory size here is 1GB. It’s better to put more if you can, as long as you stay in the green area (so the virtual machine doesn’t eat up the required resources for your host OS). In this example I’ve allocated 4GB.

Allocate RAM for VM in VirtualBox

Virtual Hard Disk

After the RAM, VirtualBox will ask you if you want to create a virtual hard disk for your virtual machine. At this point I recommend you follow the default instruction, which is “Create a virtual hard disk now”. Click on “Create” to go to the next screen.

Create Virtual Hard Disk for a VM

If VirtualBox asks you to choose which kind of virtual hard disk you want, you can go with “VDI (VirtualBox Disk Image)”, which is the default option.

Then, it will ask you to choose between a dynamically allocated disk, or one with a fixed size. If you have a lot of space on your computer, and if its performance is quite low, choose “Fixed size”. Otherwise, “dynamically allocated” is good. This can use a little bit more resources when running the VM, but nothing to worry about if your computer has descent performances.

VirtualBox will ask you how much space you want to allocate for your VM. It may set 8GB by default, which is quite low. I recommend you put at least 15 to 25GB, so you won’t have to worry about it anymore (unless you plan on using heavy media files inside your VM).

Allocate Size for Virtual Hard Disk in VirtualBox

Note: if hard disk space is dynamically allocated, you can put a bigger number, it’s OK since the additional disk space won’t be used at the beginning.

When clicking on “Create”, the virtual hard disk will be created and the popup will shutdown. You will see a new virtual machine on your list!

Raspbian Desktop VM in VirtualBox

Allocate CPUs for your VM

There is one additional thing you can do to boost your VM, which is not in the default setup wizard. Select your “Raspberry Pi OS Desktop” (or whichever name you chose) and click on “Settings”. You can also right-click on the VM > “Settings”.

In the “System” tab, “Processor” panel, you can see how many CPUs are allocated for your VM. By default only 1 will be used. If you have 4 or 8 cores in your machine, I recommend you use 2 to 4 cores. This will really speed up things when running your VM.

Allocate CPUs for a VM in VirtualBox

Associate the Raspberry Pi OS Desktop ISO file to your Virtual Machine

Now, still inside the settings, go into the “Storage” tab. Select the “Empty” disk icon below “Controller: IDE”. On the right, click on the disk icon and select “Choose a disk file”. Now is the time to fetch your downloaded Raspberry Pi OS Desktop ISO.

Set Raspbian Desktop ISO in VirtualBox Settings

After you’ve found and selected the correct ISO, you’ll be able to see it like in the following screenshot.

VirtualBox Settings - Raspbian Desktop ISO Selected

Click on “OK” to save and close the settings window.

Now, you can launch your Raspberry Pi OS Desktop VM by clicking on the “Start” button, which a big green arrow.

VirtualBox may ask you to choose (again) your startup ISO file.

Select Raspbian Desktop ISO on VM First Boot

In this case, browse your files and select your ISO, and then click on “Start”.

The first step of the installation is done. You have now successfully created a virtual machine, allocated RAM and CPU, and associated the Raspberry Pi OS Desktop ISO.

Now it’s time to install the Raspberry Pi OS Desktop OS itself.

Install Raspberry Pi OS Desktop on your virtual machine

After you’ve started Raspberry Pi OS Desktop from VirtualBox for the first time, you’ll get a menu asking you to choose between running or installing the OS.


Choose “Graphical install” with your keyboard arrows, and press ENTER. Usually if you don’t do anything for 10 seconds, the first choice will automatically be executed. No worry, in this case you just have to restart your VM (click on the top right cross > Shutdown).

After you’ve selected “Graphical install” you’ll get a series of dialogs to help you correctly install your OS.

Choose language

First, choose your language.


Click on “Continue”. Here you might get a loading bar saying “Loading additional components”. Wait until it’s done.

Partition Disks

In the previous section you have allocated some space to use for the virtual hard disk. Now is the time to create some partitions on this virtual disk.

The next few dialogs you get will let you choose how to partition your disk. If you’re not confident partitioning your disk manually, choose the following options, which are completely fine.

Raspbian Desktop Partition Disks - Use Entire Disk

You will be asked if you want to erase all data on your disk. Don’t worry here, the disk we’re talking about is your virtual disk, not the space where all your personal data and Windows (or other) OS is stored. So, yes, you can choose to totally erase the virtual disk, since there’s nothing in it yet.

Raspbian Desktop Partition Disks - VirtualBox Hard Disk

If you know what you’re doing, you can choose to separate the /home partition from the rest. Otherwise, all files in one partition is fine.

Raspbian Desktop Partitioning

Then you get the summary of what will be created. As you can see 2 partitions will be created on your virtual hard disk:

  • ext4: where all files will be stored.
  • swap: this additional space will be used when your Raspberry Pi OS consumes too much RAM. This is kind of a “safety feature” to have when installing an OS.

Raspbian Desktop Partitioning Summary - ext4 and swap

Now, the installation wizard will show you a global summary and ask you to confirm. Click on “Yes” and “Continue”.

Raspbian Desktop Partitioning Confirmation

You should now see a loading bar stating “Installing the system”. Depending on your computer performance, and the resources that you’ve allocated for your VM, this can take quite a long time (a few minutes).

Install GRUB boot loader

After partitioning your disk, the installation wizard will ask you if you want to install the GRUB boot loader on your newly created hard drive. This is perfectly safe to do, as again, this is a new virtual hard drive, with nothing previously installed on it.

Choose “Yes” and click on “Continue”.

Install GRUB on hard disk - Raspbian Desktop

You should see the virtual hard drive created by VirtualBox in the list. Choose the device starting with “/dev/sda”, and click on “Continue”.

Install GRUB on virtual hard disk

Well, this is the end of the Raspberry Pi OS Desktop installation steps! Now you should get an “installation complete” screen, and see this last progress bar.

Raspbian Desktop - Finish the Installation

After that, your Raspberry Pi OS Desktop is installed on your new virtual machine. All you have to do is launch it.

Your Raspberry Pi OS Desktop virtual machine is now ready – First launch

After the last installation step, your virtual machine may automatically reboot and start on your newly installed Raspberry Pi OS Desktop. If not, simply start it from the VirtualBox main window.

You should see this.

GRUB menu - Raspbian Desktop

This is the GRUB menu, which simply ask which OS you want to start. If you do nothing, after about 5 seconds the first choice will be selected, which is what you want. So, either wait for 5 seconds, or press ENTER to launch Raspberry Pi OS Desktop (seen as “Debian GNU/Linux”).

As it’s the first time you launch your newly installed OS, you’ll see a welcome screen.

Raspbian Desktop Welcome Screen

Click on “Next” to finish the configuration of your OS. This is optional but I strongly recommend you do it. You will have to:

  • Choose a country, language, timezone, keyboard configuration.
  • Change the default password (by default, username: “pi”, and password: “raspberry”).
  • Update software with latest available versions.

What to do next on your Raspberry Pi OS Desktop?

Well, configuring Raspberry Pi OS Desktop on a virtual machine requires quite a few steps. But now that you’re here, everything should work fine and you can now use your OS without any problem.

Now, the interesting things can begin! You can start many Raspberry Pi projects directly on your computer, without having to have one Raspberry Pi board. Of course you won’t get access to the Raspberry Pi hardware (GPIO headers), but everything else is possible.

Start by configuring your environment, install a text editor (Nano, Vim, Emacs, …), and start developing your first project!

Did you find this tutorial useful?

Do you want to learn how to build awesome projects with Raspberry Pi?

If yes, this course is for you:

Raspberry Pi For Beginners - Complete Course

>> Raspberry Pi For Beginners <<