CodeTheRobot

Ubuntu Linux for Robotics · Lesson 02 of 96

Installing Ubuntu LTS (22.04 and 26.04)

Choosing a release, verifying the image, dual boot vs dedicated disk, and the first update.

Estimated time · 60–90 min

Learning goals

What you will understand

  • Explain installing ubuntu lts (22.04 and 26.04) in your own words
  • Use it in a small workstation example
  • Verify the result instead of assuming it worked

Understand the idea first

The mental model

Ubuntu LTS (long-term support) releases are supported for five years and are what robotics uses. Ubuntu 22.04 LTS supports older ROS 2 releases such as Humble; this course's ROS 2 Lyrical Luth targets Ubuntu 26.04 LTS. Pick the Ubuntu release that matches your ROS 2 distribution, and check the ROS 2 documentation before installing.

Before writing anything to a disk, back up your data and verify the downloaded image with its checksum. A dedicated disk or a robot computer is simplest; a dual boot needs free space and care with the boot order. Never choose 'erase disk' on a computer that has data you need.

Guided lesson

Work through these steps

  1. 1.

    Open a terminal and record the current state before changing anything.

  2. 2.

    Read the installing ubuntu lts (22.04 and 26.04) commands and predict what each one does.

  3. 3.

    Run the commands one at a time and compare each output with your prediction.

  4. 4.

    Write the commands that worked in a setup note you can repeat later.

Worked example

Read it before you run it

sha256sum ubuntu-26.04-desktop-amd64.iso
# Compute the checksum of the download.
grep desktop-amd64 SHA256SUMS
# Show the published checksum for the same file; the two must be identical.
lsblk -f
# List disks and partitions so you can identify the USB stick and the target disk.
# Write the ISO to the USB stick with a tool such as balenaEtcher or Ubuntu's Startup Disk Creator
# Use a graphical writer so you cannot pick the wrong device by typing a path.
sudo apt update && sudo apt upgrade -y
# After the first boot, update all packages.
lsb_release -cs
# Print the codename of the installed release.

What the example is doing

  1. 1.Lines without sudo only inspect or change files you own; sudo authorizes a system-wide change.
  2. 2.Read command output before moving to the next line. Stop if names, versions, disks, or paths differ from the lesson.
  3. 3.Comments beginning with # explain safety checks and are not executed by the shell.

Watch it run · Build and run

See what this code does

The terminal types this lesson's practice solution and runs it. The scene shows the kind of robot behaviour that code drives. It plays by itself and loops.

sourcecompilerprogramBUILD AND RUN

Demo for Installing Ubuntu LTS (22.04 and 26.04). Expected result: The checksum of the file matches the published checksum

Practice code

Now type it yourself

Open a terminal, run the starter line by line (or save it as practice.sh and run bash practice.sh), and replace every TODO with your own command.

# Compare a file's checksum with the published list
# TODO: verify ubuntu.iso against the SHA256SUMS file, checking only the files that are present

Expected output

The checksum of the file matches the published checksum
Stuck? Show the full solution (try it yourself first)
# Compare a file's checksum with the published list
sha256sum -c SHA256SUMS --ignore-missing

Expected result

How you know it worked

  • Each command completes without an unexplained error.
  • Your notes contain the command, the important output, and what it proves.

Practical exercise

Apply the lesson

Download the Ubuntu image you need, verify its checksum, install it in a virtual machine or on a spare disk, run the first update, and record the release codename. List which ROS 2 distribution matches your Ubuntu version.

Before you continue

  • You recorded the starting state
  • Every command and output is understood
  • The change can be repeated from your notes

If something goes wrong

A command says permission denied.

Check ownership and permissions first. Do not add sudo unless the command changes a documented system location.

A command or package is not found.

Check spelling, Ubuntu version, enabled repositories, and whether the previous installation command succeeded.