The Ultimate Guide to Set Up Ubuntu Server On Raspberry Pi

1. Install Ubuntu Server

The first step to setting up Ubuntu Server on your Raspberry Pi is to install the operating system. You can do this by downloading the Ubuntu Server image from the official Ubuntu website. Once you have the image, you can use a tool like Etcher to write the image to your SD card.

2. Connect to Your Raspberry Pi

Once you have the image written to your SD card, you can insert it into your Raspberry Pi and connect it to your network. You can then use a tool like PuTTY to connect to your Raspberry Pi via SSH.

3. Configure Your Network

Once you are connected to your Raspberry Pi, you will need to configure your network settings. This can be done by editing the /etc/network/interfaces file. You will need to set up a static IP address, as well as configure your DNS settings.

4. Install Packages

Once your network is configured, you can start installing packages. You can use the apt-get command to install packages from the Ubuntu repositories. You can also use the apt-add-repository command to add additional repositories.

5. Configure Services

Once you have installed the necessary packages, you can start configuring services. This can be done by editing the /etc/init.d/ directory. You can also use the service command to start, stop, and restart services.

6. Secure Your Server

The last step is to secure your server. This can be done by setting up a firewall, configuring SSH, and setting up user accounts. You can also use tools like fail2ban to protect your server from malicious attacks.

By following these steps, you should be able to set up Ubuntu Server on your Raspberry Pi. Once you have everything configured, you can start using your server for whatever you need.

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.

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).

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

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

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.

Want to chat with other Raspberry Pi enthusiasts? Join the community, share your current projects and ask for help directly in the forums.

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:

Additional Resources

Not sure where to start?
Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.
Watch the Raspberry Pi Bootcamp course now.

Master your Raspberry Pi in 30 days
Don’t want the basic stuff only? 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.
Download the e-book.

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

Need help building something with Python?
Create, understand, and improve any Python script for your Raspberry Pi.
Learn the essentials step-by-step without losing time understanding useless concepts.
Get the e-book now.

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

The Ultimate Guide to Set Up Ubuntu Server On Raspberry Pi

Raspberry Pi is a small, low-cost computer that can be used to build a variety of projects. It is a great platform for running a variety of server applications, including web servers, database servers, and more. In this guide, we will show you how to set up an Ubuntu server on your Raspberry Pi.

Step 1: Install Raspbian

The first step is to install Raspbian, the official operating system for Raspberry Pi. You can download the latest version of Raspbian from the Raspberry Pi website. Once you have downloaded the image, you can write it to an SD card using a tool such as Etcher.

Step 2: Configure Raspbian

Once you have installed Raspbian, you will need to configure it. This includes setting up the network, setting a password, and enabling SSH. You can do this by running the raspi-config command in the terminal.

Step 3: Install Ubuntu Server

Once you have configured Raspbian, you can install Ubuntu Server. You can download the latest version of Ubuntu Server from the Ubuntu website. Once you have downloaded the image, you can write it to an SD card using a tool such as Etcher.

Step 4: Configure Ubuntu Server

Once you have installed Ubuntu Server, you will need to configure it. This includes setting up the network, setting a password, and enabling SSH. You can do this by running the ubuntu-config command in the terminal.

Step 5: Install Additional Software

Once you have configured Ubuntu Server, you can install additional software. This includes web servers, database servers, and more. You can install these packages using the apt-get command in the terminal.

Step 6: Test Your Setup

Once you have installed and configured Ubuntu Server, you can test your setup. You can do this by connecting to your server using SSH and running some basic commands. If everything is working correctly, you should be able to access your server from another computer.

Conclusion

Setting up an Ubuntu server on your Raspberry Pi is a great way to get started with server applications. In this guide, we have shown you how to install and configure Ubuntu Server on your Raspberry Pi. With a few simple steps, you can have a fully functional server up and running in no time.

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

Contact
San Vito Al Tagliamento 33078
Pordenone Italy
Item added to cart.
0 items - 0.00
Open chat
Scan the code
Hello 👋
Can we help you?