View on GitHub

ROS2-Crash-Course

Hands-on ROS 2 crash course covering ROS fundamentals and robot programming in Python through practical activities with TurtleSim and iRobot Create3.

ROS 2 Virtual Machine Setup Guide

This guide provides instructions to create a virtual machine with Ubuntu 24.04, ROS 2 Jazzy, Terminator, and VSCode. This virtual machine will enable you to follow the ROS 2 Crash Course on Windows, Linux or Apple machines.

1. Install Virtualization Software

The virtualization software is responsible for running the Ubuntu virtual machine on your computer (the host). The virtualization software will use part of your computer resources (memory, disk, processor etc.) to run Ubuntu as if it was running on an independent computer.

You can install any virtualization software compatible with the OVA standard. Two free options are:

Note: If you want to run the Virtual Machine on a macOS computer, then you must install VirtualBox, which is and available at https://www.virtualbox.org/. The instructions below were prepared for VMWare Workstation Pro, but they can also be used for VirtuaBox - keep in mind that the menu options might be different than the ones indicated below.

1.1 Download the virtualization software

  1. Go to support.broadcom.com and create or log in to a free Broadcom account.
  2. Once logged in, go to the menu Software → Enterprise Software → My Dashboard → My Downloads → Free Software Downloads.
  3. Search for VMware Workstation Pro, select version 26H1, choose your operating system.
  4. Accept the Terms and Conditions checkbox, then click the download icon.

1.2 Install

  1. Run the installer as Administrator.
  2. Accept defaults throughout. When asked about Enhanced Keyboard Driver, install it (useful for Linux guests).
  3. Skip the license key screen — leave it blank and click Continue.
  4. Finish the installation and reboot, if prompted.

Hyper-V note: If you use Docker Desktop, WSL2, or Windows Sandbox, VMware 26H1 is compatible with the Windows Hypervisor Platform. No need to disable Hyper-V.

Now, follow the instructions from Section 2 onwards to create your virtual machine from scratch: you will download and install Ubuntu, ROS 2, and related software.

If you already have a virtual machine .OVA file, click below and follow the instructions to import it. In that case, you don’t need to follow the instructions from Sections 2 and 3.

Click here for instructions on how to import the VM
> ⚠️ Important! OVA files are created for specific target hardware. This means that Apple Silicon mac (M series) users cannot import a VM built for x86 (Intel-compatible) processors, and vice-versa. If you do not have a file compatible with your hardware, you need to create your own virtual machine by following the instructions from Section 2 onwards.
If you already have an `.ova` file for your hardware, follow the steps below to import it:

If you are using VMWare:

1. Open VMware and click File → Open → select the `.ova` file.
2. Follow the import wizard (accept defaults).
3. Before starting the VM: go to VM → Settings and configure it with the following parameters:

* RAM: 4 GB minimum, 8 GB recommended (maximum half of your computer's RAM)
* CPUs: 2-4 cores
* Network: NAT (Bridged Adapter should also work, but many of my students had issues with it)
* USB: Enable USB 3.x controller

If you are using VirtualBox, the procedure is similar:

1. Open Virtual Box and click File → Import Appliance → select the `.ova` file.
2. Configure the VM with the same settings listed above.

After importing and configuring the settings, start the VM to boot up Ubuntu. You can now login and start using ROS!

Note: The VM provided by Hanze has username `ros2`, password `ros2`.

The next steps need to be followed only if you want to create your own virtual machine (.ova file). If your VM is already running, you can go back to the Main page.

2. Download Ubuntu 24.04 ISO

Each version of ROS 2 is designed for a specific version of Ubuntu (24.04 in case of ROS 2 Jazzy). Although ROS 2 can run in other operating systems, there are limitations and compatibility issues. To avoid such issues, we are going to install ROS 2 over Ubuntu, so we need to download it:

  1. Go to https://releases.ubuntu.com/24.04/.
  2. Download Ubuntu 24.04.x LTS (the .iso file, ~5.8 GB).

    Apple silicon users: go to https://ubuntu.com/download/alternative-downloads and get the ARM 64-bit version. Maybe you will need a torrent client, like qbittorent.

  3. Save the ISO file somewhere you’ll remember, e.g. C:\Users\your_name\Downloads\ubuntu-24.04-desktop-amd64.iso.

3. Create a Virtual Machine for ROS 2 Jazzy

This section guides you through creating a Ubuntu 24.04 virtual machine with ROS 2 Jazzy, VSCode, RViz2 (and optionally Webots). It assumes that you have VMWare Workstation, but it should also work with VirtualBox. All instructions were successfully tested on a Windows 11 machine with VMWare Workstation.

Estimated total time: 2–3 hours (most of it is waiting for downloads and installs).

What you’ll have at the end:

3.1 New VM Wizard

  1. Open VMware Workstation.
  2. Click Create a New Virtual Machine.
  3. Choose Typical (recommended) → Next.
  4. Select Installer disc image file (iso), browse to your Ubuntu ISO → Next.
  5. Fill in:
    • Full name: Hanze Master SSE (this is just an example: you can select anything - Not required by VirtualBox)
    • Username: ros2 (keep it simple for this workshop)
    • Password: ros2 (keep it simple for this workshop)
  6. VM Name: ROS2-Jazzy-Ubuntu2404
  7. Location: choose a drive with at least 50 GB free.

3.2 Disk Size

3.3 Customize Hardware

Click Customize Hardware:

Click Close, then Finish.

3.4 Virtual Network Configuration

By default, VMware uses an “Automatic” bridging setting that guesses your active connection. Sometimes, you need to force it to use your actual Wi-Fi or Ethernet card to get internet connection.

  1. At the top menu bar of VMware Workstation, click on Edit -> Virtual Network Editor…

    Note: If you see a button at the bottom right that says Change Settings with an administrator shield icon, click it to unlock full configurations.

  2. In the top list, click on VMnet0 (this is the default virtual switch used for Bridged mode).

  3. Look at the bottom section under VMnet Information. Where it says Bridged to:, it will likely say Automatic. Click the dropdown menu and change it from Automatic to your exact, active network adapter.

    • If you are on Wi-Fi, look for an option that says Intel Wi-Fi, Wireless, or 802.11. On my computer those options were not available: it worked with Microsoft Network Apadter Multiplexor Driver.

    • If you are on a wired cable, look for Realtek PCIe, Intel Ethernet, or Gigabit Network Connection.

Click Apply, then OK.

3.5 Install Ubuntu

VMware’s Easy Install will automate most of the Ubuntu setup. The VM will boot, install Ubuntu, and log in automatically. This takes 15–25 minutes.

When the desktop appears:

3.6 Install Open VMware Tools (or Guest Additions, for VirtualBox)

VMware Tools provides display scaling, clipboard sharing, and drag-and-drop. On Ubuntu 24.04 they install automatically via Easy Install, but verify:

systemctl status open-vm-tools

If not running:

sudo apt update && sudo apt install open-vm-tools open-vm-tools-desktop -y
sudo reboot

After reboot, the VM window should resize automatically when you drag the corner.

In VirtualBox, go to Features → Shared Clipboard (Bidirectional, or Host to Guest) to allow copy-pasting of the commands.

3.7 System Updates

sudo apt update && sudo apt upgrade -y
sudo reboot

3.8 Install Terminator

When running ROS, you often need to work with several terminal windows simultaneously. The regular Terminal that comes pre-installed with Ubuntu works fine, so you can skip this step if you prefer to work with it. But there are other termianl tools that help organizing the use of multiple terminals in one screen. The one I prefer is called Terminator (obviously).

To install Terminator, run:

sudo apt install terminator

Once installed, you can find it on the applications menu. I recommend pinning it to the side bar to make it easier: while it is running, right-click on the Terminator icon on the side bar and select “Pin to Dash”.

Some useful keyboard commands are:

A list of all commands is available at https://github.com/gnome-terminator/terminator.

3.9 Install ROS 2 Jazzy

First, we need to setup the locale variables:

sudo apt install locales -y
sudo locale-gen en_US en_US.UTF-8
sudo update-locale LC_ALL=en_US.UTF-8 LANG=en_US.UTF-8
export LANG=en_US.UTF-8

Now, add ROS 2 repository:

sudo apt install software-properties-common curl -y
sudo add-apt-repository universe
sudo curl -sSL https://raw.githubusercontent.com/ros/rosdistro/master/ros.key \
  -o /usr/share/keyrings/ros-archive-keyring.gpg
echo "deb [arch=$(dpkg --print-architecture) \
  signed-by=/usr/share/keyrings/ros-archive-keyring.gpg] \
  http://packages.ros.org/ros2/ubuntu \
  $(. /etc/os-release && echo $UBUNTU_CODENAME) main" | \
  sudo tee /etc/apt/sources.list.d/ros2.list > /dev/null
sudo apt update

Finally, install ROS 2 Jazzy Desktop Full. The following command installs ROS 2, RViz2, rqt, demo nodes, and all standard tools. It can take 10–20 minutes depending on your internet and VM speed.

sudo apt install ros-jazzy-desktop-full -y

To be able to compile code for ROS, you need to install ROS development tools. Install the complete development suite:

sudo apt install ros-dev-tools python3-pip -y

Then, initialize and download the package dependency database:

sudo rosdep init

This will show a deprecation warning and might take a while. Do not interrupt the process.

When the cursor is available again, run the update command (which will also show a warning message and will take a lot longer to complete). Do not interrupt the process.

rosdep update

3.10 Configure and test ROS 2

For the ROS 2 commands to be found, you must source its environment in every new terminal window that you open. The commands below automate this process by including the source command in the .bashrc file (which is a script that runs every time a new session is open):

echo "source /opt/ros/jazzy/setup.bash" >> ~/.bashrc

Now, let’s verify your installation by running a ROS 2 node. Open a new terminal window and run the command below:

ros2 run demo_nodes_cpp talker

If ROS 2 was installed successfully, you will see the message below being printed every second with an ever increasing number:

`[INFO] ... [talker]: Publishing: 'Hello World: 1'` 

Press Ctrl+C to stop.

You can also run a simple simulation by running TurtleSim. First, run the command below to open the simulator screen:

ros2 run turtlesim turtlesim_node

The command you just ran is executing the turtlesim_node. A node is how programs are referred to in ROS. Leave the TurtleSim node running and open a new terminal (if you are using Terminator, you can do that with CTRL + Shift + O). In the new terminal, run:

ros2 run turtlesim turtle_teleop_key

The second terminal is running another node called turtle_teleop_key. Keep the focus on this terminal and use the arrows to control the simulated turtle!

Press Ctrl+C on both terminals to stop the execution of both nodes.

3.11 Install VSCode

Now that you verified that ROS 2 was installed properly, let’s install VSCode. You will use it later to program your own nodes.

sudo snap install code --classic

Apple silicon users: snap command doesn’t work for ARM 64 for VSCode. You need to get the package from https://code.visualstudio.com/download then run: sudo apt install /path_to_file/vscode.deb

Once installed, open VSCode from the Applications menu and install these extensions (search in the Extensions panel, Ctrl+Shift+X):

4. Conclusion

After completing the steps above, your virtual machine is ready for use. Now you can start following the ROS 2 Crash Course!

You can also follow the optional sections below if you want to install Webots, connect to a real robot form your VM, or share it with others.


Optional sections

Optional 1: Install Webots

Webots is an open-source robotics simulator with similar features than Gazebo, but it is more computationally efficient, which is benefitial when running on a virtual machine. Webots is also more beginner friendly.

If you are interested in installing Webots on your VM, follow the instructions available at: https://docs.ros.org/en/jazzy/Tutorials/Advanced/Simulators/Webots/Installation-Ubuntu.html.

Optional 2: Configure Networking for Robot Connectivity

This section is relevant for connecting the VM to a physical robot - if that’s not your case, you can skip it.

To enable the communication between a physical robot and ROS 2 inside your virtual machine, you must configure its network as bridged (not NAT):

  1. With the VM powered off, go to VM → Settings → Network Adapter.
  2. Set it to Bridged: Connected directly to the physical network.
  3. Click the Configure Adapters button and make sure your active Wi-Fi or Ethernet adapter is checked.
  4. Power the VM back on.

Verify the VM has its own IP address:

ip addr show

The VM should show an IP address in the same subnet as your host machine (e.g., 192.168.1.x or 192.168.2.x), not 192.168.x.x from VMware’s NAT range. If you see 192.168.232.x, networking is likely still on NAT - go back and fix the adapter setting.

Test ROS 2 multicast (DDS discovery):

ros2 multicast receive &
ros2 multicast send

You should see Received from .... This confirms that DDS node discovery will work on the network.

Optional 3: Export the VM for Distribution

This is an optional step, in case you want to share this virtual machine. You can export your VM as an .ova file, which is a single portable archive that can be imported by VMware or Virtual Box - the importing machine needs to use the same processor architecture (x86, ARM, Apple Silicon).

Before sharing it, you can clean up disk space by running the following commands:

sudo apt autoremove -y
sudo apt clean

Then, shut down the VM cleanly

sudo shutdown now

Finally, export the VM as an OVA file.

  1. In VMware Workstation, make sure the VM is powered off.
  2. Go to File → Export to OVF…
  3. In the filename, type a name ending in .ova (e.g., ROS2-Jazzy-Ubuntu2404.ova).
  4. Choose a destination with enough free space (~20–25 GB).
  5. Click Save and wait — this takes 5–15 minutes.

You can share the .ova file via USB drive, Google Drive, or a file server.