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.

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

  1. 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.
  2. Go to Ubuntu 22.04 Download Page and Download the 64-bit PC (AMD64) desktop image. A .iso desktop image will start downloading.
    article image 1 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

  1. In this section, you will use the Oracle VirtualBox software. VirtualBox is a free general-purpose virtualizer available across Linux, Mac OS, and Windows.
  2. 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. article image 1
  3. 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.
  4. Click Next on the welcome screen in the Setup Wizard to begin the process. article image 1
  5. 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. article image 1
  6. 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. article image 1
  7. 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. article image 1
  8. Once the installation is done, click on the Finish button to exit the Setup Wizard. article image 1
  9. Launch the VirtualBox Manager from the Start Menu. article image 1

Creating Virtual Machine

Once the VirtualBox Software is installed properly, you can begin creating your Virtual Machine.

  1. 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. article image 1
  2. 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. article image 1
  3. 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.
  4. Also, check the Guest Additions box to install the default Guest Additions ISO that is downloaded as part of VirtualBox. article image 1
  5. 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. article image 1
  6. 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. article image 1
  7. Click Next to continue and view a summary of your virtual machine setting. After this click Finish to initialize the machine. article image 1
  8. 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. article image 1
    article image 1
  9. On the first boot, it will begin the unattended installation. article image 1
  10. Once the installation completes, the machine will automatically reboot to complete the installation. article image 1
  11. Finally, you will be greeted with the Ubuntu log-in screen where you can enter your username and password defined during the previous setup. article image 1

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: