How to Run Raspberry Pi OS on Virtual Machine

Jinku Hu Feb 02, 2024
  1. Download Raspberry Pi OS Desktop Version
  2. Create A New Virtual Machine in VirtualBox
  3. Configure Virtual Machine Settings in VirtualBox
How to Run Raspberry Pi OS on Virtual Machine

This article will demonstrate how to run Raspberry Pi OS on a local virtual machine on a PC.

Download Raspberry Pi OS Desktop Version

Raspberry Pi Desktop is an essential operating system based on Debian with Raspberry Pi Desktop environment.

It’s compatible with PC or Mac hardware that has x86 architecture-based CPUs. You can run Pi Desktop on physical hardware or virtualized machines.

In this case, we are focusing on the virtual environment using the Oracle VM VirtualBox software. The latter is free for most x86 systems, and it’s also open-source software.

The installation instructions are provided in VirtualBox’s official manual. We assume you have the latest version, e.g. 6.1 installed.

We need to download the Raspberry Pi Desktop image from here.

It would help verify the image integrity by verifying the SHA256 hash value matches the one listed on the official website.

On Linux-based systems, you can run command-line utility sha256sum to output the SHA256 hash value by passing it the image file name as an argument:

sha256sum 2021-01-11-raspios-buster-i386.iso

Create A New Virtual Machine in VirtualBox

Once the image signature is verified, you can go ahead and launch Oracle VM VirtualBox. To create a new virtual machine, click on the New button from the Machine category in the menu bar.

This will open a new window to specify the machine’s name as desired. Additionally, you can choose the folder where VirtualBox will store the virtual machines and their data.

It would help if you chose the operating system type, Linux Debian 32bit. We will choose the default RAM size for the machine at this step, but you can also modify this parameter later.

Next, click the Create button to move to the virtual hard drive configuration window. The default size is usually sufficient for basic usage.

Still, if you’re going to add multiple packages, it’s better to expand the storage capacity at this point rather than change it later.

Note that the dynamically allocated storage type is preferred to use the host system efficiently. Then you need to click on Create, and the machine will be created.

Configure Virtual Machine Settings in VirtualBox

A newly created machine should be listed on the left side of the VirtualBox window. We need to attach the .iso disk image to the machine and boot.

To attach a disk image to the existing virtual machine, right-click on the machine listing itself and choose the Settings item. Then move to the Storage submenu and click on the Empty IDE controller item.

At this point, you should see the disk icon on the right-hand panel, click it, and then the Choose a disk file option. The latter will let you choose a disk image from your file system.

Once the disk image is specified, you can press the OK button and double-click the named virtual machine listing to boot it.

Note that you might want to configure additional settings like networking, which you can find on the official VirtualBox documentation.

On system startup, you’ll have the option to run the Raspberry Desktop OS or install it on the virtual machine.

It might be better to choose the Graphical install option if you’re doing the system installation for the first time.

Author: Jinku Hu
Jinku Hu avatar Jinku Hu avatar

Founder of DelftStack.com. Jinku has worked in the robotics and automotive industries for over 8 years. He sharpened his coding skills when he needed to do the automatic testing, data collection from remote servers and report creation from the endurance test. He is from an electrical/electronics engineering background but has expanded his interest to embedded electronics, embedded programming and front-/back-end programming.

LinkedIn Facebook

Related Article - Raspberry Pi

Related Article - Raspberry Pi OS