How To - Ubuntu Desktop on Raspberry Pi

Summary

Steps on how to install and configure Ubuntu Server 24.04 on a Raspberry Pi (RPI). The host PC will be a macOS or Windows.

Note: Windows specific instructions are under construction

Note: my host macOS is an Apple M2 Pro running Sonoma v14.5.

Initial

RPI info

  • choose a userid for the rpi account: e.g. rpi_userid
  • choose a password for the rpi account: e.g. rpi_password
  • choose a hostname for the rpi: e.g. rpi_name
    • recommend: no spaces. If you expect to use multiple RPIs use a suffix "-01" or equivalent

Create SD-Card

install rpi imager

  • Download rpi-imager from macOS rpi-imager
  • move imager_1.8.5.dmg to Applications directory

insert microSD card

  • use at least 32GB (more is better)
  • use an adapter as need for the microSD card
  • check it's mounted using Finder

start rpi-imager

  • open Applications/Raspberry Pi Imager.app
  • Raspberry Pi Device
    • click Choose Device
    • Click on which RPI you have. Mine was "Raspberry Pi 4"
    • the imager should now indicate "RASPBERRY PI 4"
  • Operating System:
    • click Choose OS
    • click Other General-purpose OS
    • click Ubuntu
    • click Ubuntu Desktop 24.04.1 LTS (64-bit) (Note: not server)
    • the imager show now indicate "UBUNTU DESKTOP 24.04.01 LTS (64-BIT)"
  • Storage:
    • click Choose Storage
    • click "Apple SDXC Reader Media" or equivalent
    • the image shouw now indicate "APPLE SDXC READER MEDIA"
    • click Next
  • get a dlg box "Warning" "All existing data ... will be erased."
  • click Yes
  • get a dlg box "Raspberry Pi imager wants to make changes"
  • click Yes
  • imager will flash the microSD card.
    • do not press "Cancel Write" or "Cancel Verify" buttons
    • will take about 10 minutes
  • get a dlg box "Write Successful"
  • remove the microSD card from the host
  • press Continue
  • close rpi-imager

Install Ubuntu on RPI

insert SD Card into RPI

  • ensure RPI is off
  • move SD card to RPI

  • wire the RPI

    • add a USB-A mouse
    • add a USB-A keyboard
    • attach an RJ-45 cable hardwired to your Router (strongly recommeneded)
    • attach an HDMI-micro to the RPI HDMI1 socket
    • attach a USB-C cable to the RPI
  • power on the RPI

  • wait for it to boot up
    • red LED is lit
    • green LED flashes
    • screen shows rainbow for a couple of seconds then goes black
    • the Ubuntu screen shows and spins
    • will take about 2 minutes

configure Ubuntu Desktop

  • get a dlg box "System Configuration"
    • choose English language (or as appropriate)
    • click Continue
  • get "Keyboard Layout"
    • choose English (US) and English (US) (or as appropriate)
    • click Continue
  • get "Where Are You?"
    • choose your Timezone
    • click Continue
  • get "Who Are You?"
    • set "Your Name" to rpi_userid (you can use your own name, but it can be confusing on the login screen)
    • set "Your Computer's name" to rpi_name
    • set "Pick a username" to rpi_userid
    • set "Choose a Password" to rpi_password
    • select "Require my password to login"
    • click Continue

complete install

  • will install Ubuntu Desktop;

    • eventually gets "Applying Changes" dlg box
    • system reboots
    • system shows Ubuntu Login screen
    • takes about 5m
  • login using rpi_userid and rpi_password

  • get dlg box "Welcome to Ubuntu 24.04 LTS"
    • click Next
  • get "Ubuntu Pro"
    • select Skip for Now
    • click Next
  • get "Help Improve Ubuntu"
    • select "No, don't share system data"
    • click Next
  • get "Get started with more Applications"

    • click Finish
  • click on "Show Apps" (3 point icon) to see applications

    • select Terminal icon
    • right click on Terminal icon in Dash, select "Pin to Dash"
  • get IP address

ip address
  • check for eth0 inet address, typically 10.0.0.nn

Update and Configure Ubuntu

enable SSH

  • click on "Show Apps" (3 point icon) to see applications

    • select Settings
    • right click on Settings icon in Dash, select "Pin to Dash"
  • open Settings

    • scroll to "System" and click
    • click on "Secure Shell"
    • get dlg box "Secure Shell"
    • enable "Secure Shell"
    • close dlg box
    • close Settings
sudo apt update
sudo apt upgrade

# install ssh
sudo apt install openssh-server openssh-client
mkdir -p ~/.ssh 

sudo apt autoremove
sudo apt autoclean
  • reboot RPI using Reboot icon (upper right power icon on main window)

check Apps

  • start Firefox (should be in Dash apps)
  • do a Google search

  • start LibreOffice Writer (should be in Dash apps)

  • start LibreOffice Calc (use "Show Apps" 3 point icon)
    • select LibreOffice Calc
    • right click on LibreOffice icon in Dash, select "Pin to Dash"

setup datetime and timezone

# set timezone, otherwise some utilities such as rsync can be confused by different timestamps
sudo apt install -y ntpdate
# bounce the service
sudo timedatectl set-ntp off 
sudo timedatectl set-ntp on
# Note: change to your appropriate timezone
sudo timedatectl set-timezone America/Edmonton

# reboot RPI using command line
sudo reboot
# RPI takes about 2m to reboot

Set up communication from host PC to RPI

set up static IP address on your router

  • set the IP address as a static address in your router:

    • Note: I have a tp-link AX-3000 router, your instruction will be different
    • open Router, goto to Advanced, DHCP Server
    • find rpi_name
    • add it to Address Reservation to maintain the same IP address
  • Note: setting the ip address to static will ensure that the /etc/hosts doesn't need to change, the ssl key doesn't change etc.

set hosts to the RPI IP address

On the macOS host PC:

  • add it to /etc/hosts
sudo nano /etc/hosts
# add an entry in that file 
10.0.0.xx        rpi_name

start ssh terminal and login to rpi

On the macOS host PC:

ssh rpi_userid@rpi_name

# an ssh terminal should appear
ip address
# confirm it is the 10.0.0.xx address you set in your router

ping google.com
# confirm access to internet
# ctl-c to exit

# to exit from ssh terminal
exit
# should be back on macOS

Done!

At this point, the RPI can be accessed from any OS or utility that supports SSH e.g.

  • Ubuntu or other linux bash terminal
  • Windows MSYS2 terminal
  • macOS terminal
  • apps similar to putty

check rsync works

# send a directory from your host PC to the rpi's home directory
rsync -avhc --progress some_host_dir/ "rpi_userid@rpi_name:/home/rpi_userid/some_rpi_dir/"

# ssh into the RPI and check the directory ~/some_rpi_dir exists and has the correct content
# on macOS host:
ssh rpi_userid@rpi_name
# in ssh terminal:
cd ~/some_rpi_dir
ls
# should match directory on macOS

- John Arrizza