Raspberry Pi 5 Ubuntu Headless Setup: 8 Must-Do Steps for Beginners

In this post Raspberry Pi 5 Ubuntu Headless Setup, Headless Setup means you won’t connect a monitor, mouse, or keyboard directly to your Raspberry Pi. Instead, you’ll manage everything remotely, typically via SSH. This setup is ideal for projects where space is limited, or you simply want to tuck your Pi away and access it on demand.

Running a Raspberry Pi 5 Ubuntu Headless Setup is one of the best choices for both hobbyists and professionals. Whether you want to create a personal server, build an IoT gateway, or set up a lightweight development environment, Ubuntu gives you a stable, secure, and familiar foundation to work with.

In this guide, we’ll walk through the 8 must-do steps after installing Ubuntu on a Raspberry Pi 5 to make sure your headless setup is secure, fully updated, and optimized for any project you want to run. Let’s get started!

First SSH Login & System Updates

Going further on Raspberry Pi 5 Ubuntu Headless Setup, let’s follow one by one in given sequences.

1.1. Logging In via SSH

After flashing Ubuntu onto your microSD card (or SSD if you’re on a Pi 5 that supports it), power on your Raspberry Pi.

  • Find the IP Address: Check your router’s DHCP client list, use a network scanner, or check your router’s admin interface.
  • SSH Command: Open a terminal (or PuTTY on Windows) and run:
ssh ubuntu@<IP_ADDRESS>

For example:

ssh ubuntu@192.168.1.100

Default Credentials: On Ubuntu Server for Raspberry Pi, the default username is often ubuntu, with a default password of ubuntu. You’ll typically be prompted to change this password on the first login.

1.2. Update & Upgrade

To ensure your Raspberry Pi has the latest security patches and software

sudo apt update
sudo apt upgrade -y
  • sudo apt update updates your package lists.
  • sudo apt upgrade -y installs the newest versions of installed packages automatically.

1.3. Firmware & Kernel Updates

Though Ubuntu usually manages firmware updates automatically, you can install the latest stable kernel (especially useful for Pi 5 support) with:

sudo apt install --yes linux-generic

This ensures you have the most up-to-date kernel and hardware support.

1.4. Reboot

Once updates complete:

sudo reboot

Wait a moment, then reconnect via SSH using the same command as before.

2. Changing the Default Hostname

By default, your Pi might use ubuntu as its hostname. Changing it to something unique helps you identify it on the network:

2.1 Edit /etc/hostname:

sudo nano /etc/hostname

Replace the existing name (e.g., ubuntu) with something like rpi4-server.

2.2 Edit /etc/hosts:

sudo nano /etc/hosts

Update the line containing the old hostname:

127.0.1.1    ubuntu

to:

127.0.1.1    rpi4-server

2.3 Reboot:

sudo reboot

After rebooting, you can try connecting via ssh ubuntu@rpi4-server.local (if mDNS is available) or continue using the IP address.

Raspberry Pi 5 Ubuntu Headless Setup

3. Creating a New User

For security, you might prefer disabling the default ubuntu account and creating your own:

3.1 Create a new user:

sudo adduser mynewuser

Provide a password and optional user information.

3.2 Grant sudo privileges:

sudo usermod -aG sudo mynewuser

3.3 Test SSH:

ssh mynewuser@<IP_ADDRESS>

3.4 (Optional) Disable the default ubuntu user:

sudo usermod --lock ubuntu

Locking the account prevents logins under ubuntu.

4. Configuring SSH Keys

4.1. Generate SSH Keys on Your Local Machine

SSH key authentication is more secure than using passwords. On your local system:

ssh-keygen -t ed25519

The public key typically ends up at ~/.ssh/id_ed25519.pub. If you prefer RSA, use -t rsa -b 4096.

4.2. Copy Your Public Key to the Pi

Use the ssh-copy-id utility to copy your public key:

ssh-copy-id -i ~/.ssh/id_ed25519.pub mynewuser@<IP_ADDRESS> 

Alternatively, manually paste the contents of your .pub file into the Pi’s ~/.ssh/authorized_keys.

4.3. (Optional) Disable Password Authentication

  • Edit SSH configuration:
sudo nano /etc/ssh/sshd_config

Change:

PasswordAuthentication yes

To

PasswordAuthentication no

Restart SSH:

sudo systemctl restart ssh

From here on, only valid SSH key holders can log in.

5. Setting Up a Firewall

5.1. Install UFW

UFW (Uncomplicated Firewall) is an easy interface for firewall rules:

sudo apt install ufw -y

5.2. Allow SSH and Enable the Firewall

Be sure to open SSH before enabling the firewall (otherwise, you could lock yourself out):

sudo ufw allow ssh
sudo ufw enable

5.3. Additional Rules

If you plan to run a web server, for example, open ports 80 (HTTP) and 443 (HTTPS):

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp

Check the firewall status:

sudo ufw status

6. Installing Essential Packages

6.1. Build-Essential & Git

If you plan to compile software or work with version control:

sudo apt install build-essential git -y
  • build-essential: Includes gcc, g++, and other important development tools.
  • git: Popular version control system for tracking changes in code.

6.2. Python & Pip

Python is a go-to language for Raspberry Pi projects. Ensure you have Python 3 and pip:

sudo apt install python3-pip -y
python3 --version
pip3 --version

6.3. Node.js & npm

If you’ll be running JavaScript-based apps or services:

sudo apt install nodejs npm -y
node -v
npm -v

6.4. Other Useful Utilities

sudo apt install curl wget net-tools htop nano -y
  • curl / wget: Tools for downloading files from the command line.
  • net-tools: Provides ifconfig, netstat, etc.
  • htop: Interactive process viewer to monitor resource usage.
  • nano: A beginner-friendly command-line text editor.

7. Wi-Fi Configuration (If Needed)

If you’re using Ethernet only, skip this section. For Wi-Fi on Ubuntu Server:

  • Identify your wireless interface:
ip link

Look for wlan0 or a similar name.

  • Edit your Netplan file (commonly in /etc/netplan/):
sudo nano /etc/netplan/50-cloud-init.yaml
  • Add a Wi-Fi configuration:
network:
  version: 2
  renderer: networkd
  wifis:
    wlan0:
      dhcp4: true
      access-points:
        "YourSSID":
          password: "YourPassword"
  • Apply the changes:
sudo netplan apply

Your Pi should automatically connect to the specified Wi-Fi network.

8. Enabling Remote Desktop (Optional)

Even in a headless setup, some users prefer the option of a GUI. xrdp is a common solution for remote desktop on Ubuntu.

8.1. Install xrdp

sudo apt install xrdp -y
sudo systemctl enable xrdp
sudo systemctl start xrdp

8.2. Lightweight Desktop Environment (If Using Ubuntu Server)

sudo apt install xfce4 xfce4-goodies -y
echo xfce4-session > ~/.xsession

Connect from another PC using Remote Desktop (on Windows: mstsc, on Linux: Remmina) to your_pi_ip:3389.

With this foundation on Raspberry Pi 5 Ubuntu Headless Setup, you can build practically any Pi-based project—web servers, home automation, IoT dashboards, media centers, you name it. Stay vigilant with updates, periodically review security configurations, and keep exploring new ways to make the most of your Raspberry Pi!

Conclusion

Setting up a Raspberry Pi 5 Ubuntu Headless Setup might sound intimidating at first, but by following these essential steps, you’re creating a secure, stable, and fully customizable environment that’s perfect for endless projects. From the very first SSH login and system updates to configuring SSH keys, setting up a firewall, and installing essential packages, each step builds a strong foundation for your Pi.

What makes the Raspberry Pi 5 shine with Ubuntu is its ability to run powerful workloads while staying compact and efficient. A headless setup means you can tuck it away in a corner, let it run 24/7, and still have full remote access to manage everything from coding experiments to IoT dashboards, web servers, or even lightweight desktop environments.

By securing your device, customizing the hostname, creating new users, and enabling tools like Python, Node.js, and Git, you’re preparing your Pi not just for today’s needs but for any project you dream up tomorrow. Whether you’re a beginner learning the ropes or an advanced user building production-ready solutions, this guide ensures your Raspberry Pi 5 is ready to deliver.

The best part? Once your Raspberry Pi 5 Ubuntu Headless Setup is complete, you’re free to explore, automate, and experiment without worrying about constantly plugging in a keyboard, mouse, or monitor. With this strong foundation, the possibilities are limitless—home automation, personal cloud servers, IoT gateways, or coding sandboxes.

So, go ahead and take the next step. Keep your system updated, secure, and optimized, and let your Raspberry Pi 5 power the innovative projects you’ve always wanted to build. 🚀

More from Authors

Check this out: How To Get Started with Raspberry Pi Pico in 2024

Share your love
Layer 1