ROS2LabRobotics & ROS 2 Lab

ROS 2: Zero to MoveIt 2 › Module 0 › Ubuntu

Set up ROS 2 on Ubuntu 24.04

12 steps About 45 to 90 minutes, mostly waiting Tested on the course PC

Your route: ROS 2 Jazzy straight on Ubuntu 24.04. Do one step at a time. Each step says what to do, how long it takes, what you should see, and what to do when you are stuck. No step touches your own files, and you can stop after any step.

Run on the course PC (Ubuntu 24.04) on 16 Nov 2026, with the helper and this page.

I have an older Ubuntu, or another Linux

Ubuntu 22.04 or 20.04: ROS 2 Jazzy has packages for 24.04 only. Open Software Updater: it offers the upgrade to 24.04. Back up your files first. Another Linux (Mint, Fedora, Debian …): use the Browser Lab, or install Ubuntu 24.04. The check below tells you which Ubuntu you have.

0 of 12 steps done Helper: not connected

No PC, or stuck? Use the Browser Lab: nothing to install, and every lesson works there.

  1. Part A: Before you install

    One small thing first: check that this computer is strong enough.

  2. A1 Check my PC (before anything is installed)

    How long this takes: about 1 minute Where: the Terminal

    First find out whether this PC can run ROS 2 and Gazebo. The check only reads: it installs nothing, changes nothing and needs no password.

    Open the Terminal: press Ctrl+Alt+T. A window with a blinking mark opens. (Or click the grid of dots at the bottom left of the screen, type terminal, and press Enter.)

    Press Copy on the line below. Click inside the Terminal, paste with Ctrl+Shift+V (or right-click and choose Paste), then press Enter.

    wget --https-only -qO- https://www.ros2lab.com/install/check.sh | bash

    Then come back here and press the button.

    Your browser may ask "Allow this site to find devices on your local network?". Choose Allow: the page only reads the result from your own computer.

    It does not appear? Paste the result instead

    Answer by hand, or correct what the check found
    About your PC (the check fills this in; you can change it)
    Computer
    Graphics card
    Memory (RAM)
    Free disk space
    Internet

    What you should see

    Terminal
    ===== ROS2LAB PC CHECK 1 =====
    system: linux
    os: Ubuntu 24.04.5 LTS
    ...
    cores: 16
    ram_gb: 15.3
    disk_free_gb: 61.0
    ...
    ===== END =====
    
    Now go back to the ROS2Lab page and press "Read the result from my PC".

    About 20 lines between two ===== lines (shortened here). After you press the button, a table appears on this page with a green, yellow or red mark for each line.

    Exactly what it reads, and where the result goes
    • The Ubuntu version.
    • The processor and its number of cores.
    • The size of the memory.
    • The free space of your home folder.
    • The name of the graphics card and its driver.
    • The OpenGL level, if a tool for it is installed.
    • Whether Ubuntu runs inside Windows or a virtual machine.
    • How fast one file downloads from packages.ros.org (up to 8 seconds; the file is thrown away).

    The result is printed in your Terminal. It then waits on your own computer (address 127.0.0.1) for up to 10 minutes. This page reads it only when you press the button, and keeps it in this browser. It is not sent to ROS2Lab or anywhere else.

    You can read the whole script first: https://www.ros2lab.com/install/check.sh

    What these words mean
    Terminal
    A window where you type commands instead of clicking. You type one line and press Enter; the computer answers with text.
    Command
    One line of text that tells the computer to do one thing.
    Script
    A text file with commands. You can open its address in your browser and read every line before you run it.
    127.0.0.1
    The address that always means "this computer itself". What goes there never leaves your PC.
    Cores
    The workers inside the processor. More cores do more things at the same time.
    Graphics card (GPU)
    The part of the PC that draws 3D pictures. Gazebo needs it.
    Driver
    The program that lets Windows use a part of the PC, here the graphics card.
    OpenGL
    The language programs use to ask the graphics card for 3D pictures. Gazebo needs level 3.3 or higher.
    Virtual machine
    A computer inside your computer: a program (UTM) that runs Ubuntu in a window on your Mac.
    Mbit/s
    How fast your internet is. A bigger number is faster.
    Stuck? The 3 most common problems
    1. The Terminal says Command 'wget' not found. Type this instead: curl -fsSL https://www.ros2lab.com/install/check.sh | bash. If that is missing too, use "Answer by hand" below.
    2. The button says it cannot read the result. Your browser may have asked "Allow this site to find devices on your local network?". If you pressed Block, allow it in the site settings (the icon left of the address). Or use "Paste the result" below. Safari and Brave always block it: paste instead.
    3. I read this guide on my phone. The button only works in a browser on the same PC. Open "Answer by hand" below and choose what fits your PC.

    None of these? Show this step to your teacher, or to a friend who knows computers. You do not have to wait: every lesson also works in the Browser Lab.

  3. Part C: Install ROS 2 in ten steps

    Now everything happens inside Ubuntu. Each step is one line to paste. The step numbers are the helper's own: ros2lab setup --step 5 is step 5 here.

  4. Helper Start the helper

    How long this takes: about 1 minute Where: the Terminal

    The helper is a small program that reads what is installed and tells this page. From now on the ticks on this page come from your PC. The line below puts one small file into your home folder and starts it. It needs no password. Started this way the helper only reads: it runs no commands and changes no files.

    In the Terminal, paste with Ctrl+Shift+V this line and press Enter:

    wget --https-only -qO- https://www.ros2lab.com/install/setup.sh | bash -s guided

    Leave that window open. Come back here and press:

    Not connected yet.

    Your browser may ask "Allow this site to find devices on your local network?". Choose Allow: it is the helper on your own PC.

    What you should see

    Terminal
    ros2lab 0.6.26 installed.
    The helper is starting. LEAVE THIS WINDOW OPEN and go back to the ROS2Lab page: it now shows what your PC has.
    For the next commands open a second terminal. To stop the helper: Ctrl+C in this window.
    ros2lab helper on http://127.0.0.1:7777
      Leave this window open. This helper only READS what is installed …

    On this page: Connected, with a list of what your PC has now.

    For every step below, use a second window: press Ctrl+Alt+T again. The helper keeps running in the first one.

    Two windows
    Window 1: helper
    leave it open
    Window 2: commands
    paste the steps here

    A drawing, not a photo of your screen.

    What these words mean
    Helper
    A small program called ros2lab. It reads what is installed on your PC and tells this page, so the ticks here are real. It talks only to 127.0.0.1.
    127.0.0.1
    The address that always means "this computer itself". What goes there never leaves your PC.
    Stuck? The 3 most common problems
    1. This page stays "Not connected". Look at the helper window. One of its last lines must say helper on http://127.0.0.1:7777. If you closed it, paste the line again. If the browser asked about your local network and you pressed Block, allow it in the site settings. Safari and Brave always block it: use Chrome, Edge or Firefox, or tick the steps by hand.
    2. OSError: [Errno 98] Address already in use A helper is already running in another window. Use that one, or close it with Ctrl+C and paste the line again.
    3. Command 'wget' not found Type sudo apt-get install -y wget, then paste the line again.

    None of these? Show this step to your teacher, or to a friend who knows computers. You do not have to wait: every lesson also works in the Browser Lab.

    I have installed ROS 2 before: one command for everything

    This line installs the helper and then runs all ten steps by itself. It asks for your password once and then types the same sudo commands that the steps below show. Use it if you know what they do.

    wget --https-only -qO- https://www.ros2lab.com/install/setup.sh | bash

    Run the helper line above in a second window as well, and this page still shows live what is installed.

  5. Step 1 Get Ubuntu ready (the 'universe' software list and curl)

    How long this takes: 1 to 3 minutes Where: the second Terminal window

    This refreshes Ubuntu's list of software, installs three small tools, and switches on "universe".

    In the second window, paste with Ctrl+Shift+V this line and press Enter:

    sudo apt-get update \
      && sudo apt-get install -y locales software-properties-common curl \
      && sudo add-apt-repository -y universe

    It asks [sudo] password for …:. Type your Ubuntu password and press Enter. Nothing shows while you type, not even dots: that is normal.

    What you should see

    Many lines scroll past. At the end your prompt (the line ending in $) is back, and no line starts with E:. The tick on this page turns green by itself within a few seconds.

    What these words mean
    sudo
    "Do this as the administrator of this PC." That is why it asks for your password. Only you type sudo commands; the helper never does.
    apt-get
    Ubuntu's program that downloads and installs software.
    Package
    One piece of software that apt-get installs.
    universe
    A big list of free software kept by the Ubuntu community. ROS 2 needs some of it.
    Stuck? The 3 most common problems
    1. E: Could not get lock /var/lib/dpkg/lock-frontend Ubuntu is updating itself in the background. Wait five minutes and paste the line again.
    2. … is not in the sudoers file This user may not install software. Log in as the user that was made when Ubuntu was installed.
    3. Temporary failure resolving or Could not resolve Ubuntu has no internet. Check the connection. Then paste the line again.

    None of these? Type ros2lab report and send the file it makes to your teacher. You do not have to wait: every lesson also works in the Browser Lab.

  6. Step 2 Add the official ROS 2 software source

    How long this takes: about 1 minute Where: the second Terminal window

    This tells Ubuntu where ROS 2 lives. It downloads one small file from the ROS project, checks its fingerprint, installs it and refreshes the list.

    Paste into the second window:

    curl -fsSL --proto '=https' --tlsv1.2 -o /tmp/ros2-apt-source.deb \
      https://github.com/ros-infrastructure/ros-apt-source/releases/download/1.3.0/ros2-apt-source_1.3.0.noble_all.deb \
      && echo \
      "f31d84adf5054c7d60ded0e82c0f776a77ea33af53d08f40b9ad7c94cca55296  /tmp/ros2-apt-source.deb" \
      | sha256sum -c - \
      && sudo dpkg -i /tmp/ros2-apt-source.deb \
      && sudo apt-get update

    What you should see

    Terminal
    /tmp/ros2-apt-source.deb: OK

    That line means the fingerprint matched. After it, the list is refreshed and some lines name packages.ros.org.

    Source: ROS 2 Jazzy: Ubuntu (deb packages).

    What these words mean
    Software source
    An address on the internet where apt-get looks for packages. ROS 2 lives at packages.ros.org.
    Fingerprint (sha256)
    A long number worked out from a file. If one letter of the file changes, the number changes. The command compares it and stops if the download is not the file this course tested.
    Stuck? The 3 most common problems
    1. /tmp/ros2-apt-source.deb: FAILED The download broke on the way. Paste the line again.
    2. EXPKEYSIG F42ED6FBAB17C654 or NO_PUBKEY An old ROS source from before 2025 is on this PC. Remove it: sudo rm -f /etc/apt/sources.list.d/ros2.list /etc/apt/sources.list.d/ros2-latest.list then paste the line again.
    3. curl: (6) Could not resolve host: github.com The network blocks GitHub (some school and office networks do). Try another network, for example your phone's hotspot for this one small file.

    None of these? Type ros2lab report and send the file it makes to your teacher. You do not have to wait: every lesson also works in the Browser Lab.

  7. Step 3 Install ROS 2 Jazzy, Gazebo Harmonic, ros2_control and MoveIt 2

    How long this takes: 15 to 40 minutes on most connections; you can leave it running Where: the second Terminal window

    The big one. It installs ROS 2 Jazzy, Gazebo Harmonic, ros2_control, MoveIt 2, colcon and the course's tools. The line names 33 packages; apt-get adds what they need.

    Laptop: plug in the charger, and do not close the lid while this runs. If the laptop went to sleep and the step stopped with an error, paste the line again: it goes on where it stopped.

    Paste into the second window. You can leave it running:

    sudo apt-get install -y ros-jazzy-desktop ros-dev-tools ros-jazzy-ros-gz \
      ros-jazzy-ros2-control ros-jazzy-ros2-controllers ros-jazzy-gz-ros2-control \
      ros-jazzy-xacro ros-jazzy-joint-state-publisher-gui ros-jazzy-twist-mux \
      ros-jazzy-teleop-twist-keyboard ros-jazzy-moveit ros-jazzy-moveit-py \
      ros-jazzy-demo-nodes-cpp ros-jazzy-demo-nodes-py python3-colcon-common-extensions \
      python3-rosdep python3-vcstool git mesa-utils ros-jazzy-twist-stamper \
      ros-jazzy-urdf-tutorial liburdfdom-tools ros-jazzy-tf2-tools ros-jazzy-tf-transformations \
      ros-jazzy-teleop-twist-joy ros-jazzy-joy ros-jazzy-rqt-robot-steering \
      ros-jazzy-plotjuggler-ros ros-jazzy-pilz-industrial-motion-planner \
      ros-jazzy-moveit-planners-chomp ros-jazzy-moveit-planners-stomp python3-numpy \
      python3-scipy

    What you should see

    On this page the line Course packages counts up (for example "21 of 33 installed"). In the window, hundreds of lines scroll past; at the end your prompt is back and no line starts with E:.

    Source: packages measured on the course PC: 0.67 GB to download, 2.2 GB on disk (16 Nov 2026).

    What these words mean
    ROS 2 Jazzy
    The Robot Operating System, version "Jazzy": the programs and tools robots are built with. It is free.
    Gazebo Harmonic
    A simulator: it shows a robot in a 3D world and works out how it moves.
    ros2_control
    The part of ROS 2 that drives a robot's motors (in the simulator, and on a real robot).
    MoveIt 2
    The part of ROS 2 that plans how a robot arm moves without hitting things.
    colcon
    The tool that turns ROS 2 source files into programs you can run. This is called "building".
    Stuck? The 3 most common problems
    1. E: Unable to locate package ros-jazzy-desktop Step 2 is not done, or this is not Ubuntu 24.04. Look at the list "What your PC has now" at the top of this page.
    2. Hash Sum mismatch or Failed to fetch A download broke. Type sudo apt-get update, then paste the line again: it goes on where it stopped.
    3. No space left on device The disk is full. Type sudo apt-get clean, free more space, then paste the line again.

    None of these? Type ros2lab report and send the file it makes to your teacher. You do not have to wait: every lesson also works in the Browser Lab.

    Good place to stop for today. Your ticks are saved in this browser. Next time: open this page again and go on with the next step. If you had started the helper, start it again with its line.

  8. Step 4 Start rosdep (it finds the system packages a workspace needs)

    How long this takes: about 1 minute Where: the second Terminal window

    rosdep finds the system packages a workspace needs. The first line creates its list (it needs your password); the second downloads the list for you.

    4a. Paste this line into the second window and press Enter. Type your password if it asks.

    sudo rosdep init

    4b. When the prompt is back, paste this line:

    rosdep update

    What you should see

    The second line prints several lines that begin with Hit and ends with updated cache in /home/…/.ros/rosdep/sources.cache.

    What these words mean
    rosdep
    A tool that looks up which system packages a ROS 2 workspace needs.
    Stuck? The 3 most common problems
    1. ERROR: default sources list file already exists Fine: someone ran the first line before. Go on with the second line.
    2. Command 'rosdep' not found Step 3 did not finish. Do not install what Ubuntu suggests there. Paste the line of step 3 again.
    3. The second line stops with urlopen error or timed out The internet was slow for a moment. Type rosdep update again.

    None of these? Type ros2lab report and send the file it makes to your teacher. You do not have to wait: every lesson also works in the Browser Lab.

  9. Step 5 Download the course workspace into ~/ws

    How long this takes: under 1 minute Where: the second Terminal window

    This downloads the course's ready-made robots (a 5 MB file from ros2lab.com) into the folder ~/ws and checks its fingerprint. No password.

    Paste into the second window:

    ros2lab setup --step 5

    What you should see

    Terminal
    ros2lab 0.6.26 · detected ubuntu-24.04
    ros2lab step 5 of 10: Download the course workspace into ~/ws
        /tmp/ros2lab-ws.tar.gz: OK
      ✓ step 5 done
    What these words mean
    Workspace
    A folder that holds ROS 2 packages. The course's ready-made robots live in ~/ws; your own work goes to ~/ros2lab_work/ws.
    ~
    Short for your home folder, for example /home/asha.
    Stuck? The 3 most common problems
    1. Command 'ros2lab' not found or ros2lab: command not found This window was opened before the helper was installed. Close it and open a new one.
    2. … already holds other packages; ros2lab will not overwrite them You already have a folder ~/ws with other work. Rename it: mv ~/ws ~/ws_old, then run the step again.
    3. /tmp/ros2lab-ws.tar.gz: FAILED The download broke. Run the step again.

    None of these? Type ros2lab report and send the file it makes to your teacher. You do not have to wait: every lesson also works in the Browser Lab.

  10. Step 6 Build the course workspace with colcon

    How long this takes: 2 to 10 minutes Where: the second Terminal window

    colcon now turns the course's source files into programs ROS 2 can run. The fan may get loud: that is normal.

    Paste into the second window:

    ros2lab setup --step 6

    With 4 GB of memory, close your other programs first and use this line instead: MAKEFLAGS=-j1 ros2lab setup --step 6

    What you should see

    Terminal
    ros2lab 0.6.26 · detected ubuntu-24.04
    ros2lab step 6 of 10: Build the course workspace with colcon
        Starting >>> …
        Finished <<< …
        Summary: 11 packages finished [13.3s]
      ✓ step 6 done

    One Starting and one Finished line for each package, then the summary. (13 seconds on the course PC; your time will differ.)

    What these words mean
    colcon
    The tool that turns ROS 2 source files into programs you can run. This is called "building".
    Stuck? The 3 most common problems
    1. It says some system packages the workspace needs are missing and shows a sudo apt-get install line. Paste that line (it needs your password), then run the step again.
    2. c++: fatal error: Killed signal terminated program cc1plus The memory ran out. Close the browser's other tabs and run MAKEFLAGS=-j1 ros2lab setup --step 6: it builds one package and one file at a time.
    3. One package ends with Failed <<<. Run the step again. If the same package fails again, type ros2lab report and send the file it makes to your teacher.

    None of these? Type ros2lab report and send the file it makes to your teacher. You do not have to wait: every lesson also works in the Browser Lab.

  11. Step 7 VS Code and the five course extensions (optional)

    How long this takes: about 5 minutes (optional) Where: the second Terminal window

    VS Code is the editor the lessons use. You can skip this step now and do it later.

    1. Install VS Code from Microsoft's own software source (it needs your password). Paste into the second window:

    sudo DEBIAN_FRONTEND=noninteractive apt-get -y install gpg curl \
      && sudo mkdir -p /etc/apt/keyrings \
      && curl -fsSL --proto '=https' --tlsv1.2 https://packages.microsoft.com/keys/microsoft.asc \
      | gpg --dearmor | sudo tee /etc/apt/keyrings/packages.microsoft.gpg >/dev/null \
      && printf \
      'Types: deb\nURIs: https://packages.microsoft.com/repos/code\nSuites: stable\nComponents: main\nArchitectures: amd64,arm64,armhf\nSigned-By: /etc/apt/keyrings/packages.microsoft.gpg\n' \
      | sudo tee /etc/apt/sources.list.d/vscode.sources >/dev/null \
      && sudo DEBIAN_FRONTEND=noninteractive apt-get -y update \
      && sudo DEBIAN_FRONTEND=noninteractive apt-get -y install code

    2. Then the five course extensions (no password):

    ros2lab setup --step 7

    What you should see

    The step ends with a line that begins ✓ VS Code extensions: and names five extensions: Python, ROS 2, URDF, YAML and XML.

    Source: Visual Studio Code on Linux; Developing in WSL.

    What these words mean
    VS Code
    A free editor from Microsoft for writing program files. The lessons use it.
    Stuck? The 3 most common problems
    1. editor: missing extensions: … The internet dropped while it downloaded. Run ros2lab setup --step 7 again.
    2. Command 'code' not found Part 1 did not finish. Paste its line again.
    3. I do not want VS Code. Press "Skip this step". The lessons also work with any text editor, and the Browser Lab has its own.

    None of these? Type ros2lab report and send the file it makes to your teacher. You do not have to wait: every lesson also works in the Browser Lab.

  12. Step 8 Make every new terminal know ROS 2

    How long this takes: under 1 minute Where: the second Terminal window

    This adds a few lines to the end of the file ~/.bashrc, between two marks that say # ros2lab. Every new terminal then knows ROS 2 and the course robots. It also picks your ROS_DOMAIN_ID. No password.

    Paste into the second window:

    ros2lab setup --step 8

    Then close the second window and open a new one (press Ctrl+Alt+T again). Only new windows read the new lines.

    What you should see

    Terminal
    ros2lab 0.6.26 · detected ubuntu-24.04
    ros2lab step 8 of 10: Make every new terminal know ROS 2
      ✓ step 8 done

    In the new window, ros2 --help now answers with a list of commands.

    What these words mean
    ~/.bashrc
    A text file that Ubuntu reads every time you open a terminal.
    ROS_DOMAIN_ID
    A number from 0 to 101. ROS 2 programs with the same number can hear each other. Lesson 1.2 explains it.
    Stuck? The 3 most common problems
    1. In the new window Command 'ros2' not found. The window was open before this step. Close it and open another one.
    2. I already had my own lines for ROS in ~/.bashrc. They stay. ros2lab only writes between its two marks.
    3. I want to undo it. ros2lab uninstall removes the lines, the course workspace and the helper's files. It asks first.

    None of these? Type ros2lab report and send the file it makes to your teacher. You do not have to wait: every lesson also works in the Browser Lab.

  13. Step 9 Test ROS 2 and Gazebo on this PC

    How long this takes: 2 to 4 minutes Where: the second Terminal window

    Now the PC tests itself. First come 15 checks of ROS 2 and Gazebo. Then comes a speed test: Gazebo runs without a window for 10 seconds of robot time. A Gazebo window opens and closes by itself a few times: do not click it.

    In the new window:

    ros2lab setup --step 9

    What you should see

    Terminal
    ros2lab 0.6.26 · detected ubuntu-24.04
    ros2lab step 9 of 10: Test ROS 2 and Gazebo on this PC
    ros2lab doctor 0.6.26 on ubuntu-24.04 (ROS 2 jazzy)
      ✓ ROS 2 Jazzy installed
      ✓ ros2 CLI answers
      …
    ros2lab speed test: Gazebo without a window, 10 seconds of simulated time (about 25 seconds)
      ✓ Gazebo runs at 100 % of real time (full speed)
      ✓ Gazebo draws with: …
    ros2lab step 9 done. Last step: ros2lab sim   (the course robot opens in Gazebo and RViz)

    A tick, a warning sign or a cross for each check. On this page: your speed, and the graphics card Gazebo really used. Your speed can be below 100 %. On a small PC or in a virtual machine that is expected; it is not a failure.

    Source: Gazebo Harmonic: troubleshooting (OpenGL, software rendering).

    What these words mean
    OpenGL
    The language programs use to ask the graphics card for 3D pictures. Gazebo needs level 3.3 or higher.
    Graphics card (GPU)
    The part of the PC that draws 3D pictures. Gazebo needs it.
    Stuck? The 3 most common problems
    1. A cross at rendering works (GUI). Gazebo could not draw, even with software drawing. Type ros2lab report and send the file to your teacher; meanwhile every lesson works in the Browser Lab.
    2. A cross at ROS_DOMAIN_ID: "this terminal has nothing". This window is older than step 8. Close it, open a new one, and run the step again.
    3. The speed is far below 100 %. The lessons still work; robots move slower than a real clock. Close other programs. For heavy lessons you can use the Browser Lab.

    None of these? Type ros2lab report and send the file it makes to your teacher. You do not have to wait: every lesson also works in the Browser Lab.

  14. Step 10 Open the course robot in Gazebo and RViz

    How long this takes: about 2 minutes Where: the second Terminal window

    The last step: open the course robot, my_bot, in Gazebo (the simulator) and in RViz (the viewer).

    ros2lab sim

    What you should see

    Gazebo and RViz
    Gazebo
    a small robot on a grey floor
    RViz
    the same robot on a grid

    A drawing, not a photo of your screen.

    Two windows open. The first start can take up to a minute. This page ticks the step when it sees both. Close them with Ctrl+C in the window where you typed the command.

    Source: Gazebo Harmonic: troubleshooting.

    Stuck? The 3 most common problems
    1. The Gazebo window stays black or closes at once. Type ROS2LAB_GPU=off ros2lab setup --step 9. When it ends, type ros2lab sim again. Gazebo then draws with the processor: slower, but it works.
    2. No window opens at all. Are you logged in on the PC's own screen (not through a remote text connection)? Gazebo needs a screen.
    3. It works, but it is very slow. That is software drawing or a small graphics card. The lessons work. For smooth 3D you can do the Gazebo lessons in the Browser Lab.

    None of these? Type ros2lab report and send the file it makes to your teacher. You do not have to wait: every lesson also works in the Browser Lab.

Back to Module 0