Installing and Setting up Ubuntu
Pieter PInstallation
-
Download the Ubuntu Server image from https://ubuntu.com/download/raspberry-pi
wget -P /tmp/ http://cdimage.ubuntu.com/releases/focal/release/ubuntu-20.04-preinstalled-server-arm64+raspi.img.xz -
Then write the disk image to your SD card
Be careful when usingxzcat /tmp/ubuntu-20.04-preinstalled-server-arm64+raspi.img.xz | sudo dd of=/dev/mmcblk0 bs=32Mdd, if you specify the wrong output (of=...), it'll overwrite everything on that device, so it's easy to accidentally destroy your computer. -
Install the SD card into the Raspberry Pi, connect it to a network using Ethernet, and power it up.
If you don't have an Ethernet network to connect the Pi to, you can configure the WiFi first, as explained here: WiFi Setup -
Use your favorite method to find its IP address. You can find it in your router's settings, with an app like
Fing, or by using a command line tool like
nmap. If you have a router that automatically adds the hostnames of the devices on the local network to its IP records, you might be able to just use the hostnameubuntu, without needing to find its IP address manually. -
Connect to the Raspberry Pi over SSH
Replace the IP address with the one you found in the previous step.ssh -o IdentitiesOnly=yes ubuntu@192.168.1.100ssh -o IdentitiesOnly=yes ubuntu@ubuntu # if you have a smart DNS server in your router
You'll be prompted a password, the default one isubuntu. - Follow the instructions to change the default password and connect again with the new password.
SSH Configuration
- Set the hostname:
sudo hostnamectl set-hostname rpi3 - Install the
avahi-daemonpackage to enable mDNS:sudo apt install avahi-daemon - If you already had the
avahi-daemoninstalled, you have to restart it to use the new hostname:sudo service avahi-daemon restart - Close the SSH connection:
exit - You should now be able to reach the Pi using its mDNS hostname:
ping rpi3.local -c3 -
Create an SSH configuration for the Pi on your computer, so you can
connect to it without having to specify the hostname or username:
cat >> ~/.ssh/config << 'EOF' Host RPi3 HostName rpi3.local User ubuntu EOF - Add your public key to the Pi's
authorized_keys, so you can connect to it without entering the password each time:
If you don't have an SSH key pair yet, you can follow these instructions on how to create one: DigitalOcean - How to Set Up SSH Keys.ssh-copy-id -i ~/.ssh/id_rsa.pub -o IdentitiesOnly=yes RPi3 -
You can now try to connect to it without having to specify the hostname
or username, and without having to enter your password:
ssh RPi3 -
For security reasons, it's a good idea to disallow password login. Edit the
/etc/ssh/sshd_configfile:
Locate the linesudo nano /etc/ssh/sshd_configPasswordAuthentication yes, and replace it withPasswordAuthentication no. Then save the file and exit the editor usingCtrl+X.
Finally, restart the SSH server to apply the settings:
Now you'll only be able to log into the Pi using the SSH key we installed in step 7.sudo service ssh restart