How to install Ubuntu 20.04 LTS 64-bit server for arm64 (Pi 3 & 4). Most of the info you can find on ubuntu.com, but I like to have it all in the same place. As this is my first ever blog, it will be simple and easy …. I hope.
Why I want to do this, well I like to setup a Raspberry Pi Kubernetes cluster based on MicroK8s and use that to play around with my Sensors, store the data and present the data in some interesting way. So step 1; getting the SD-cards ready, I use 16GB and 32Gb cards. But I guess you can go as low as 4GB, but that could limit you in the future, as you might run out of storage space for extra things you might want to install on your Pi’s. I will always configure my SD Cards on a Pi connected to a monitor (and remember the Pi 3 requires a nomal HDMI conector and the Pi 4 requires a micro-HDMI connector), Ethernet cable connected to my switch and a USB keyboard.
Download the “Raspberry Pi Imager for Windows” from www.raspberrypi.org and as my Ubuntu desktop is not yet installed, I needed the Windows version. Install it and start it.
Choose your OS, Ubuntu 20.04 LTS (Pi 3 & 4), in our case we need the arm64 architecture as MicroK8s is only available for 64-bit Ubuntu version. So make sure you select the correct version.
And finally select the your target SD Card, click WRITE and just wait for it to be ready.
Now step 2; boot your Rapsberry Pi (3 or 4) with the newly created Ubuntu server installation. As this is a server without GUI you will need to dive into the CLI. At the first login (User: ubuntu / Password: ubuntu;) you will be forced to change the default password.
Ubuntu 20.04 LTS ubuntu tty1 ubuntu login: ubuntu <enter> Password: <password> <enter> Welcome to Ubuntu 20.04 LTS .. .. .. Last login: Wed May 6 07:19:04 UTC 2020 on tty1 ubuntu@ubuntu:~$ _
Now you are ready to setup you Raspberry Pi. I wanted some extra tools installed, net-tools, curl, etc. Just enough to make my life a bit more easy on the command-line. I also wanted a fixed IP and a different user. (Adding the user I will not explain in this post)
Lets get some extra tools installed, but first make sure your Pi is fully updated and then install net-tools and curl.
$ sudo apt update && sudo apt upgrade <enter> $ sudo apt install net-tools curl <enter>
Ubuntu 20.04 LTS comes with Netplan for configuration of your network interfaces. So forget your /etc/network/interfaces and follow the next steps to setup your Raspberry with a Fixed IP on both cabled and wireless network.
First, figure out the names of the network interfaces. On a Raspberry Pi this is always eth0 and wlan0. If you want you can check it yourself by running the command “ip a” from the command-line. The configuration files for Netplan are stored at /etc/netplan/.. and will need to be changed. When you installed the Pi it comes with a yaml-file; 50-cloud-init.yaml. Create 2 new files; 01-netcfg-eth0.yaml, 02-netcfg-wlan0.yaml, one for each network-interface and add the required details. Netplan will handle file starting with 01, then 02 etc. The 50-cloud-init.yaml will no longer be needed and can be removed. My private network is a 192.168.2.0/24 Class C network, so that’s what I will be using in my examples. Also make sure that your yaml files indentations are correct, use spaces, not tabs. And if you do get errors when your try or apply Netplan changes you will need to check your indentations.
Add the following information to the 01-netcfg-eth0.yaml and 02-netcfg-eth0.yaml files.
$ sudo vi /etc/netplan/01-netcfg-eth0.yaml network: version: 2 ethernets: eth0: dhcp4: no optional: true addresses: [192.168.2.190/24] gateway4: 192.168.2.254 nameservers: addresses: [192.168.2.254,188.8.131.52] $ sudo vi /etc/netplan/02-netcfg-wlan0.yaml network: version: 2 wifis: wlan0: dhcp4: no optional: true addresses: [192.168.2.191/24] gateway4: 192.168.2.254 nameservers: addresses: [192.168.2.254,184.108.40.206] aaccess-points: "network_ssid_name": password: "***********" $ sudo rm /etc/netplan/50-cloud-init.yaml
Test your configuration, or if you are sure all is correct just apply the changes
$ sudo netplan try Or if you are bold enough $ sudo netplan apply
Next step, test you can connect to your Pi using ssh. On your PC or laptop start an terminal session or something like Putty see if you are able to ssh to your Raspberry Pi on both the IP’s you configured in the the Netplan yaml files.
MacBook-Pro-van-Allan:~ smitae$ ssh firstname.lastname@example.org email@example.com's password: ********** Welcome to Ubuntu 20.04 LTS (GNU/Linux 5.4.0-1008-raspi aarch64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage System information as of Thu May 7 16:57:26 UTC 2020 System load: 0.0 Usage of /: 3.4% of 57.37GB Memory usage: 29% Swap usage: 0% Temperature: 39.2 C Processes: 125 Users logged in: 1 IPv4 address for eth0: 192.168.2.190 IPv6 address for eth0: 2a02:a446:c14a:1:ba27:ebff:feb7:4e90 IPv4 address for wlan0: 192.168.2.191 IPv6 address for wlan0: 2a02:a446:c14a:1:ba27:ebff:fee2:1bc5 * Ubuntu 20.04 LTS is out, raising the bar on performance, security, and optimisation for Intel, AMD, Nvidia, ARM64 and Z15 as well as AWS, Azure and Google Cloud. https://ubuntu.com/blog/ubuntu-20-04-lts-arrives 0 updates can be installed immediately. 0 of these updates are security updates. Last login: Thu May 7 10:45:11 2020 from 192.168.2.16 ubuntu@ubuntu:~$
Shutdown your Pi ( sudo shutdown ), disconnect your HDMI cable and keyboard. And setup your Pi on his final location, attach the network cable and power and power it up.
Done, you now have your Raspberry Pi running Ubuntu Server 20.04 LTS. And your are ready to do some real stuff.