install ubuntu server on raspberry pi

The Ultimate Guide to Set Up Ubuntu Server On Raspberry Pi

Ubuntu Server is the equivalent of Raspberry Pi OS “Lite” in the Ubuntu family. It comes with the latest features but without a desktop interface, making it a great choice to host any home server on a Raspberry Pi. However, starting with command lines only can feel challenging, so I created this tutorial to guide you with your first steps.

Ubuntu has an official server release for the Raspberry Pi, available in direct download or via Raspberry Pi Imager. It can be flashed on an SD card or USB drive and works on all recent Raspberry Pi models.

Let’s start with the installation procedure, and then I’ll give you a few tips on how to configure and use this system. I’ll even show you how to install any desktop environment on it if you want to try one.

If you’re looking to quickly progress on Raspberry Pi, you can check out my e-book here. It’s a 30-day challenge where you learn one new thing every day until you become a Raspberry Pi expert. The first third of the book teaches you the basics, but the following chapters include projects you can try on your own.

How to Install Ubuntu Server on Raspberry Pi

Here are the required steps to install Ubuntu Server on Raspberry Pi:

  • Download and install Raspberry Pi Imager on your computer.
  • Insert an SD card.
  • Use Raspberry Pi Imager to flash Ubuntu Server onto the SD card.
  • Boot the Raspberry Pi with this new SD card.

I’ll now explain each step in detail. And give you an alternative if you prefer to use Balena Etcher or another tool.

Method 1: Use Raspberry Pi Imager

Install Raspberry Pi Imager on your computer or Raspberry Pi

The easiest way to get Ubuntu Server running on your Raspberry Pi is to use Raspberry Pi Imager, which you’ll find on the official website:

  • Open the software page of the official website.
  • Download the version corresponding to your operating system.
    It’s compatible with Windows, macOS and Linux. You can even use your Raspberry Pi directly if Raspberry Pi OS is already installed:
    sudo apt install rpi-imager

Once installed, you can move to the next step to copy the Ubuntu files to your SD card.

Flash Ubuntu Server on an SD card or USB drive

Ubuntu Server is available in the OS list in Raspberry Pi Imager, so flashing it will be straightforward:

  • Open Raspberry Pi Imager on your computer.
  • Insert your SD card.
    You can also use a USB drive if your Raspberry Pi model supports it (more details about this in my course, if needed).
  • Click on “Choose OS” and “Other general-purpose OS”.
    Ubuntu is listed there. Click on it to see all versions currently available.
  • Pick the 64-bit version if your model supports it. It doesn’t have any major issues, unlike the Raspberry Pi OS.

Raspberry Pi Imager includes advanced configuration options. You can click on the wheel icon in the bottom right to configure a few things before the first boot.

I recommend doing it in this case. We’ll use a terminal-only operating system, which means everything you don’t configure right now will have to be done in complicated command lines.

I would at least set a username and password, and if needed, change the keyboard layout for your system. This way, it will work directly on the first boot. You can also configure the network there, especially if you don’t have a simple network with DHCP enabled.

Then, click on “Choose Storage” and select your SD card or USB drive in the list.
Finally, click on “Write” to start the file copy.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

After a few minutes, your SD card is ready to use, and you can move to the next step.

Method 2: Manual installation

If you prefer, you can always get the Ubuntu image manually from the official website.
Sometimes, Raspberry Pi Imager doesn’t have the latest version list, or maybe you prefer using another tool, it’s fine.

Go to this page on the Ubuntu website, and scroll down to the “Download Ubuntu Server” section.
You have several choices here:

  • LTS version: recommended for use on production servers, with longer-term support (you’ll receive updates for five years).
  • The latest version: Can be the same one, but generally, there is a more recent image, updated every 6 months, including the latest package versions. It should be fine for personal use, it’s stable enough for your Raspberry Pi, and you can upgrade it when the next release will be available.
  • 64-bit or 32-bit: Pick the 64-bit edition if you have a recent Raspberry Pi model (3, 4, 400 or 2W).
    Unlike Raspberry Pi OS, Ubuntu 64-bit has been the default for a long time, I didn’t notice any major issues using it (more details about the differences between 64 and 32 bits here).

Once you have the image downloaded on your computer, use your favorite tool to flash it on your SD card or USB drive.

I like Balena Etcher, as it’s easy to use and often slightly faster, but it doesn’t really matter.

Click on “Flash from file”, select the destination storage and click on “Flash!”. A few minutes later, the system is ready to use, and you can start your Raspberry Pi with it (check the next section).

Join Our Community!

Connect, learn, and grow with other Raspberry Pi enthusiasts. Support RaspberryTips and enjoy an ad-free reading experience. Get exclusive monthly video tutorials and many other benefits.

Learn more
Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

Getting Started With Ubuntu Server on Raspberry Pi

As mentioned in the introduction, your first boot with Ubuntu Server won’t be as welcoming as with Ubuntu Desktop or other distributions. You’ll only see a black screen with a small font to start with.

Let me guide you through the first steps :-).

First boot

Unlike on PC or with the Desktop edition, there is no welcome wizard on the latest version of Ubuntu Server. You get directly to the login prompt, where you can enter your login and password.

If you used the Advanced Settings in Raspberry Pi Imager and defined a specific user and password, you can use it directly:

Note: You may need to wait a few seconds after the first prompt shows up. It looks like some initialization steps are running in the background (I got some SSH debug messages while I was typing my username and password).

If you used the manual installation or didn’t set the user and password in Raspberry Pi Imager, the default user is:

  • Login: ubuntu
  • Password: ubuntu

You are required to change the password immediately on the first login.

Keyboard configuration

Unless you specified it via Raspberry Pi Imager, the default keyboard configuration will be set to QWERTY (US).

This can already be a challenge to log in for the first time if (like me) you use a different keyboard layout, with a strong password. Here is a picture to help you with this first step:

Anyway, once logged in, I recommend setting up the correct keyboard layout before anything else.

Use this command to run the wizard:
sudo dpkg-reconfigure keyboard-configuration

You’ll get access to a configuration tool, where you can select your country, layout and a few additional settings about your keyboard. A reboot is required to apply the configuration after that:
sudo reboot

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

On the next boot, you should be able to use the normal layout to log in and move on with the next steps.

Are you a bit lost in the Linux command line? Check this article first for the most important commands to remember and a free downloadable cheat sheet so you can have the commands at your fingertips.

Network configuration

When plugged into a network cable, Ubuntu Server should automatically get assigned an IP address by the DHCP server (the Internet router in most cases).

You can use this command to make sure it worked:
ip a

As you can see on my screenshot, I can see my current IP address (192.168.222.23) in the eth0 section (Ethernet cable). It means I’m already connected to my local network and to the Internet, which should be the case for you too on “normal” networks at home.

If you need to use a Wi-Fi connection, I would start with an Ethernet cable and configure it from there, or try to do it from Raspberry Imager options directly.

The manual Wi-Fi configuration from the command line directly is a bit complicated, so I wrote a specific article about it, you can find more details here:

System updates

Once the initial configuration is done (user, keyboard layout and network), it’s a good practice to download and install the latest security updates on your new system.

Like with Raspberry Pi OS and all Debian-based distributions, Ubuntu Server uses APT, so it can be done easily with:
sudo apt update
sudo apt upgrade -y

A reboot is probably a good idea if you download many updates in your first run, especially if, like in my example, there is a new kernel available:

You should at least accept to restart all the services, and likely restart the whole system with:
sudo reboot

Optional: you can tweak a few things to make this black screen look better, check this for the details: How to Increase Font Size in the Linux Terminal (+ Bonus tips)

Enable SSH

On Ubuntu Server, SSH is installed and enabled by default, as soon as the default user and password are set.

So, at this stage, if you followed all the previous steps, you are connected to the network, know your user and password, and can connect to it directly from your computer:

If you need any additional guidance on how to use SSH to control your Raspberry Pi, click on this link to learn everything about it. The article is for Raspberry Pi OS, but it’s almost the same thing on Ubuntu.

Install new applications

Ubuntu Server comes with two methods to install new applications:

  • APT: The default package manager for any Debian-based distribution. You can use it with the same commands as on Raspberry Pi OS, to install standalone applications, for example:
    sudo apt install <package-name>
  • SNAP: Snap is available natively on Ubuntu and allows you to install applications as a complete archive, including all the required dependencies and installing them in a distinct container.
    You can browse the snap store online, or use the command line to find and install new snaps on Ubuntu.
    snap search <string>
    snap install <name>

The main difference between Snap and Apt is that apt will install an individual package on the system whereas Snap downloads a whole archive, with all the prerequisites inside, and installs it in a confined folder that’s isolated from the system.

I explain all the differences between Snap and Apt in this article. Some people love snaps, as it makes their life easier (one command to install NextCloud instead of following a long tutorial), while others blame the lack of control.

Anyway, it’s not the point of this article, for now, just remember that both are available on Ubuntu Server. You can follow almost all the tutorials on this website, even if they are made for Raspberry Pi OS, it shouldn’t be that different.

Download Your Essential Linux Commands Guide!
It's a free PDF guide containing every Raspberry Pi Linux command you should know!
Download now

🛠 This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Reminder: Remember that all the members of my community get access to this website without ads, exclusive courses and much more. You can become part of this community for as little as $5 per month & get all the benefits immediately.

Upgrade Ubuntu Server with a desktop environment

Even if you started with Ubuntu Server, and are now limited to what you can do with it, it’s still possible to install a desktop environment over it.

As Ubuntu is not offering all desktop environments in direct download for Raspberry Pi, it can also be a good strategy to get Xubuntu or Kubuntu on your Raspberry Pi. The default desktop environment on Ubuntu Desktop is GNOME, which is the heaviest option, so not necessarily the best idea, especially if you have an older Raspberry Pi model.

install ubuntu server on raspberry pi

Starting with Ubuntu Server, and then installing another desktop environment than GNOME can be a good way to maximize convenience and performance.

Here are the solutions you can try:

  • GNOME: it should be fine with a Raspberry Pi 4 or 400.
    Installation:
    sudo apt install ubuntu-desktop
  • KDE: Should run slightly better than GNOME on most models, but still a bit heavy for Raspberry Pi.
    Installation:
    sudo apt install kubuntu-desktop
  • LXDE: If you like the Raspberry Pi OS interface, it’s almost the same thing. Better performance overall.
    Installation:
    sudo apt install lubuntu-desktop
  • XFCE: Another great option for performance.
    Installation:
    sudo apt install xubuntu-desktop
    I have a full guide explaining how to install XFCE on Ubuntu Server if you want more details.

Other packages might be available in the default repository, feel free to do some research if you really want another. For example, Cinnamon is available (cinnamon-desktop-environment) and MATE too (ubuntu-mate-desktop).

If you want to start with the minimum required, you can use the “–no-install-recommends” option in your apt command, something like:
sudo apt install --no-install-recommends <package-name>

I tried it for you, the installation took a while, but everything worked fine after the reboot.

You need to choose a display manager during the installation, and you might need to install it manually with some environments (I kept gdm3, the default option), but aside from that, it’s straightforward.

I tested on a Raspberry Pi 4, so I can’t tell how each environment works on each model, but the installation is not that complicated.

install xfce ubuntu server

If you want to learn more about Ubuntu, and how to use Ubuntu Server especially, I have a ton of tutorials on this website, so feel free to check them too:

Whenever you’re ready, here are other ways I can help you:

The RaspberryTips Community: If you want to hang out with me and other Raspberry Pi fans, you can join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.

Master your Raspberry Pi in 30 days: If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.

The Raspberry Pi Bootcamp: Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.

Master Python on Raspberry Pi: Create, understand, and improve any Python script for your Raspberry Pi. Learn the essentials step-by-step without losing time understanding useless concepts.

You can also find all my recommendations for tools and hardware on this page.

Similar Posts