How to Install ROS 2 in Ubuntu 22.04 on Windows using Virtual Box
Congratulations on taking the first step into the fascinating realm of robotics!
In this tutorial, I will walk you through the in-depth process to install Ubuntu 22.04 with ROS 2 on a Windows 10/11 system using the free Oracle VirtualBox software.
Pre Requisites
Make sure you satisfy the below prerequisites before installing Ubuntu 22.04 Virtual Machine and ROS 2 Humble on your Windows system.
- A computer running Windows 10 or 11. This guide uses Windows 10 64-bit.
Note: VirtualBox should work fine on any recent version of Windows 10 or 11.
- Ubuntu: Desktop 22.04 ISO Image
- Oracle VirtualBox 7.1 software
- Minimum 50 GB of Storage memory
- Minimum of 8 GB of RAM
Let’s dive right into the process to set up Ubuntu 22.04 Virtual machine to start working with ROS 2.
Download Ubuntu 22.04 ISO Image
- This section will walk you through the process of downloading and installing the latest LTS version of the Ubuntu distribution of Linux, i.e.,
Ubuntu 22.04 Jammy Jellyfish
.
- Go to Ubuntu 22.04 Download Page and Download the 64-bit PC (AMD64) desktop image. A
.iso
desktop image will start downloading.
NOTE : Windows 10/11 systems are based on the AMD64/Intel-64
architecture. Make sure you use the AMD
image for a Windows 10/11 system and not an ARMv8
image. This step might take time depending on your internet speed.
Download and Install VirtualBox
- In this section, you will use the Oracle VirtualBox software. VirtualBox is a free general-purpose virtualizer available across Linux, Mac OS, and Windows.
- Go to the VirtualBox Downloads page Oracle VM VirtualBox Downloads page and click on the Windows hosts link to download the VirtualBox software. It will download a “.exe” installer file into your Downloads folder.
- Locate and double-click the VirtualBox installer file from the
Downloads
folder in your File Explorer and it will launch the VirtualBox 7.0.8 Setup wizard.
- Click Next on the welcome screen in the Setup Wizard to begin the process.
-
On the Custom Setup screen, you can leave the default selections for now so that the installer can set up Wizard to install the features. You can change the installation location by clicking on Browse or else leave the default location. Click Next when ready to continue.
-
The next screen will show a Warning about the network interfaces. The Setup Wizard will install a virtual network adapter that may reset and temporarily disconnect the network connection. Click on Yes to process the installation.
-
The next screen will ask you to confirm the installation. Click on Install to begin the installation of VirtualBox 7.0.8. The installation process will begin and it might take several minutes.
-
Once the installation is done, click on the Finish button to exit the Setup Wizard.
-
Launch the VirtualBox Manager from the
Start
Menu.
Creating Virtual Machine
Once the VirtualBox Software is installed properly, you can begin creating your Virtual Machine.
-
Click the New button from the top Menu on the VirtualBox Manager window. This will open the Create Virtual Machine wizard which will let you create and configure your new Virtual Machine with the desired settings.
-
On the Virtual Machine Name and Operating System section, fill in the name, Folder (location to store the Virtual machine files), and select the
Ubuntu 22.04 ISO Image
(downloaded in the previous section) in the ISO Image option.
Click on the Next button to process.
- On the Unattended Guest OS Install Setup section, you need to enter your
username
and password
in addition to your machine name so that it can be configured automatically during the first boot.
-
Also, check the Guest Additions box to install the default Guest Additions ISO that is downloaded as part of VirtualBox.
-
In the next Hardware section, specify how much of your host machine’s RAM and processors the virtual machine can use. Change the slider position to allocate the correct values.
NOTE: For using ROS 2 application, it is recommended to use a minimum of 8 GB RAM
and at least 6 CPUs
.
-
Next in the Virtual Hard Disk section, specify the size of the hard disk for the virtual machine. For ROS 2, it is recommended around
50 GB
as a minimum.
-
Click Next to continue and view a summary of your virtual machine setting. After this click Finish to initialize the machine.
-
You will see a message saying
Powering VM up …
in the VirtualBox manager and a new desktop Window will appear for your Ubuntu 22.04 Virtual machine’s first boot.
-
On the first boot, it will begin the unattended installation.
-
Once the installation completes, the machine will automatically reboot to complete the installation.
-
Finally, you will be greeted with the Ubuntu log-in screen where you can enter your
username
and password
defined during the previous setup.
Install ROS 2 Humble Hawksbill
Hang in there!!
You are one step away from becoming a ROS 2 developer with your Ubuntu 22.04 VirtualBox Machine setup.
To install the latest LTS version of ROS 2, i.e., Humble Hawksbill, follow the steps here.
Voila!! I hope you have ROS 2 Humble Running on Ubuntu 22.04 inside a Virtual Machine on Windows Laptop.
If you liked the article, please buy me a ☕️ coffee
Currently, I am reading The Light We Carry by Michelle Obama.
References: