Running Raspbian in a Virtual Machine

in #raspberrypi6 years ago (edited)

Raspbian is the most common operating system used on Raspberry Pi single-board computers. It's simple and comes with some cool toys preinstalled readily available for installation, such as Geany, Node-Red, and Scratch. The large user base behind the OS encouraged the development of an x86 version. This means any regular desktop or laptop PC can run Raspbian, and users can take it for a test drive without loading or even owning a Raspberry Pi.

Whether you're new to Raspbian and want to play around with Linux, or an experienced programmer looking to test scripts before deploying them on a $35 Raspberry Pi, running Raspbian in a virtual machine is a great alternative to installing it on a full desktop. For those who have never used them before, virtual machines allow you to run a virtual computer within your computer, allowing you to run an operating system inside the one you're currently using.

Scroll past the instructions to follow along with the video on LBRY

Prerequisites

The rest of this tutorial assumes you have the following things:

  • VirtualBox VM software (Available for free here for most operating systems)
  • The latest version of the "Raspberry Pi Desktop" installer (Also free here)
  • An internet connection

Creating a Virtual Machine

Open VirtualBox and select the blue New icon in the top left. You may name the machine whatever you like but choose Linux for type and Linux 2.6/3.x/4.x(32-bit) for version. The next screen will ask how much memory to reserve for the machine. Raspbian should run fine under 512, but if your system has enough memory, I would recommend at least 1024. Any more than 1024 shouldn't be necessary.

Continue on by following the prompts to create a virtual hard disk. You can stick with all the default options. Pick any size you feel like, but Raspbian requires at least 4GB. Note that as long as you selected Dynamically located, space won't actually be used on your real hard drive until it fills up. Fixed Size drive will always take up the exact amount of space they were allocated.

The wizard will now close showing your newly created VM.

NOTE: the video demonstrates activating the EFI boot mode. This is not necessary, you may ignore that step.

Starting the VM

Select your VM and click the green Start button. Hit the folder and navigate to the ISO you downloaded from the Raspberry Pi website. If your file ends in .img then you've accidentally downloaded the version of Raspbian for Raspberry Pi devices and not desktop computers; this version will not run within VirtualBox.

After a second you see a blue box with some options inside. Click anywhere in the square and confirm to capture input. This will allow VirtualBox to route your keyboard actions directly to the virtual machine.

Installing Raspbian

Now that the virtual machine is up and running, the rest of these instructions also apply if you're directly installing Raspbian on a computer as the main operating system.

Use the arrow keys to select Graphical install and hit the enter key. After a second VirtualBox will notify you that the guest OS supports mouse pointer integration. This means that you don't have to capture input anymore and the mouse can move freely between your desktop and the virtual machine.

Follow the on-screen prompts to complete the installation. Refer to the video for specific details about installation. Upon completion, Raspbian will autoeject the virtual disk and reboot. The first time Raspbian boots it will start a configuration wizard to customize and update your installation.

Congratulations! You've successfully installed Raspbian in a virtual machine!

Watch the installation video!

Support this project in the LBRY client

Wondering how Raspbian boots on a real Raspberry Pi? Check out our old Steemit post!

Effortlessly written with StackEdit

Coin Marketplace

STEEM 0.21
TRX 0.27
JST 0.040
BTC 102367.04
ETH 3705.53
USDT 1.00
SBD 3.23