Fresh Install of 64-bit Ubuntu 20.04 LTS on my Raspberry Pi 4
By: Darin M
Tags: Tutorial, Raspberry Pi, Linux, Ubuntu, Notes

Just installed Ubuntu Core LTS 20.04 on my Raspberry Pi 4. I was excited to have a supported version of a 64-bit OS for my new Pi. I’m keeping track of what I’m learning as I go along.

Getting Started

The official Raspberry Pi SD card imaging tool already has the option to pull down and install Ubuntu 20.04 LTS Server in the GUI. Just drill down in the OS menu, insert your SD card, and off you go.

As soon as the image was complete on the SD card, I powered down my RPi4 (that was previously running Rasbian Buster) so I could replace the SD card, and rebooted. Within moments, I was sitting at a prompt ready to go. The initial login and password are ubuntu and ubuntu . As soon as I logged in I was required to change the password for the account.

Adding Me

I don’t like continuing to run the default account, so I created my own and set it so that I could run commands as root using sudo :

ubuntu@ubuntu:~$ sudo adduser darin

Adding user `darin' …

Adding new group `darin' (1001) …

Adding new user `darin' (1001) with group `darin' …

Creating home directory `/home/darin' …

Copying files from `/etc/skel’ …

New password:

Retype new password:

passwd: password updated successfully

Changing the user information for darin

Enter the new value, or press ENTER for the default

Full Name []: Darin M

Room Number []:

Work Phone []:

Home Phone []:

Other []:

Is the information correct? [Y/n] y ubuntu@ubuntu:~$ usermod -aG sudo darin

Giving the Pi It’s Identity

Eventually, this little Pi is going to be my NextCloud server. Let’s name it something more appropriate (I screwed this up the first time, then found this guide):

ubuntu@ubuntu:~$ hostnamectl

Static hostname: ubuntu

Icon name: computer

Machine ID: b8fb962029a44b84bee515d16d6874cc

Boot ID: 946cd90fa20a4f4d8e7298887c9a4e3d

Operating System: Ubuntu 20.04 LTS

Kernel: Linux 5.4.0-1008-raspi

Architecture: arm64 ubuntu@ubuntu:~$ sudo hostnamectl set-hostname pi-nas ubuntu@ubuntu:~$ sudo vi /etc/hosts

## See edits below... ubuntu@ubuntu:~$ sudo vi /etc/cloud/cloud.cfg

## See edits below... ubuntu@ubuntu:~$ hostnamectl

Static hostname: pi-nas

Icon name: computer



Operating System: Ubuntu 20.04 LTS

Kernel: Linux 5.4.0-1008-raspi

Architecture: arm64 ubuntu@ubuntu:~$

In the /etc/hosts file I added the following on line #2:

127.0.0.1 pi-nas

In the /etc/cloud/cloud.cfg file, I located the preserve_hostname line and changed it from false to true:

preserve_hostname: true

With that all taken care of, I now logout as the ubuntu user and log back in as my newly created account.

IFCONFIG is Gone, Long Live IP

I’ve got it connected directly to my switch via Ethernet with a static IP. On my DHCP server I assigned the address, but I immediately found that my trusty old ifconfig command was missing when I was ready to refresh it’s lease. A quick Reddit search informed me that I’m living in the past… And I discovered the ip command. After a quick read of it’s help command, I found my solution:

darin@pi-nas:~$ sudo ip link set eth0 down

darin@pi-nas:~$ sudo ip link set eth0 up

darin@pi-nas:~$ ip address show eth0

2: eth0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP group default qlen 1000

link/ether dc:a6:32:47:26:04 brd ff:ff:ff:ff:ff:ff

inet 192.168.1.70/24 brd 192.168.10.255 scope global dynamic eth0

valid_lft 85111sec preferred_lft 85111sec

inet6 fe80::dea6:32ff:fe47:2604/64 scope link

valid_lft forever preferred_lft forever

Now I know it’s got a static IP of 192.168.1.70.

Lock it Down

Now that I’ve got a static IP and I can find it on the network easily, I’m going to move off of direct console access to remote access via SSH. Before I do, I’m going to turn on the firewall and ONLY allow SSH for now:

darin@pi-nas:~$ sudo ufw app list

[sudo] password for dbm1175:

Available applications:

OpenSSH darin@pi-nas:~$ sudo ufw status

Status: inactive darin@pi-nas:~$ sudo ufw allow OpenSSH

Rules updated

Rules updated (v6) darin@pi-nas:~$ sudo ufw enable

Command may disrupt existing ssh connections. Proceed with operation (y|n)? y

Firewall is active and enabled on system startup darin@pi-nas:~$ sudo ufw status

Status: active To Action From

-- ------ ----

OpenSSH ALLOW Anywhere

OpenSSH (v6) ALLOW Anywhere (v6) darin@pi-nas:~$

Now I can move off of console directly and start working on my new server over a Secure Shell from my laptop.

Refreshen

Once reconnected to my Ubuntu Pi remotely, I was informed on login that ther were a few updates available already. No time like the present to get all up to date: