![]()
IoT Unlocked: Your Journey to Innovation Starts Now
![]()
IoT Unlocked: Your Journey to Innovation Starts Now

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!
Going further on Raspberry Pi 5 Ubuntu Headless Setup, let’s follow one by one in given sequences.
After flashing Ubuntu onto your microSD card (or SSD if you’re on a Pi 5 that supports it), power on your Raspberry Pi.
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.
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.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.
Once updates complete:
sudo reboot
Wait a moment, then reconnect via SSH using the same command as before.
By default, your Pi might use ubuntu as its hostname. Changing it to something unique helps you identify it on the network:
sudo nano /etc/hostname
Replace the existing name (e.g., ubuntu) with something like rpi4-server.
sudo nano /etc/hosts
Update the line containing the old hostname:
127.0.1.1 ubuntu
to:
127.0.1.1 rpi4-server
sudo reboot
After rebooting, you can try connecting via ssh ubuntu@rpi4-server.local (if mDNS is available) or continue using the IP address.

For security, you might prefer disabling the default ubuntu account and creating your own:
sudo adduser mynewuser
Provide a password and optional user information.
sudo usermod -aG sudo mynewuser
ssh mynewuser@<IP_ADDRESS>
sudo usermod --lock ubuntu
Locking the account prevents logins under ubuntu.
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.
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.
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.
UFW (Uncomplicated Firewall) is an easy interface for firewall rules:
sudo apt install ufw -y
Be sure to open SSH before enabling the firewall (otherwise, you could lock yourself out):
sudo ufw allow ssh
sudo ufw enable
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
If you plan to compile software or work with version control:
sudo apt install build-essential git -y
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
If you’ll be running JavaScript-based apps or services:
sudo apt install nodejs npm -y
node -v
npm -v
sudo apt install curl wget net-tools htop nano -y
If you’re using Ethernet only, skip this section. For Wi-Fi on Ubuntu Server:
ip link
Look for wlan0 or a similar name.
sudo nano /etc/netplan/50-cloud-init.yaml
network:
version: 2
renderer: networkd
wifis:
wlan0:
dhcp4: true
access-points:
"YourSSID":
password: "YourPassword"
sudo netplan apply
Your Pi should automatically connect to the specified Wi-Fi network.
Even in a headless setup, some users prefer the option of a GUI. xrdp is a common solution for remote desktop on Ubuntu.
sudo apt install xrdp -y
sudo systemctl enable xrdp
sudo systemctl start xrdp
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!
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. 🚀
Check this out: How To Get Started with Raspberry Pi Pico in 2024