The Raspberry Pi is the most famous single-board computer. Initially, the scope of the Raspberry Pi project aimed to promote computer science education in schools and developing countries.
Its low cost, portability, and extremely low power consumption have made it far more popular than expected. From weather stations to home automation, enthusiasts have built many cool projects using the Raspberry Pi.
The fourth-generation Raspberry Pi has the capabilities and processing power of a regular desktop computer. However, this article is not about using the Raspberry Pi as a desktop. Instead, I will show you how to install Ubuntu Server on your Raspberry Pi.
In this tutorial, I will be using the Raspberry Pi 4, and here are the topics I will cover:
This tutorial requires the following devices:
Installing Ubuntu Server on Raspberry Pi
In this tutorial, I will use Ubuntu to create the Raspberry Pi SD card, but you can create it on other Linux distributions, macOS, and Windows. This is because the steps for preparing the SD card are the same for the Raspberry Pi Imager tool.
The Raspberry Pi Imager tool automatically downloads the Raspberry Pi OS image you choose. This means you need a good network connection to download about 1GB of data.
Step 1: Prepare the SD card with Raspberry Pi Imager
Ensure that you have inserted the microSD card into your computer and installed Raspberry Pi Imager on your computer.
You can download the Imager tool suitable for your operating system from these links:
Although I am using Ubuntu, I will not use the Debian packages listed above, but rather install the snap package via the command line. This method can be applied to a wider range of Linux distributions.
sudo snap install rpi-imager
After installing the Raspberry Pi Imager tool, find and open it, and click the “CHOOSE OS” menu.
Scroll through the menu and click “Ubuntu” (“Core” and “Server” images).
From the available images, I chose Ubuntu 20.04 LTS 64-bit. If you have a Raspberry Pi 2, you can only choose the 32-bit image.
Important: If you are using the latest Raspberry Pi 4 with 8GB of memory, you should choose the 64-bit operating system; otherwise, you can only use 4GB of memory.
From the “SD Card” menu, select your microSD card and click “WRITE”.
If it shows some errors, try writing it again. Now it will download the Ubuntu Server image and write it to the micro SD card.
When this process is complete, it will notify you.
Step 2: Add WiFi support on Ubuntu Server
After flashing the micro SD card, you are almost ready to use it. Before using it, one thing you might want to do is add Wi-Fi support.
With the SD card still inserted in the reader, open the file manager and locate the “system-boot” partition on the card.
The file you need to find and edit is named network-config
.
This process can also be done on Windows and MacOS. As mentioned earlier, edit the network-config
file to add your Wi-Fi credentials.
First, uncomment the lines in the rectangular box (remove the leading #
tag).
Then, replace myhomewifi
with your Wi-Fi network name, for example, "itsfoss"
, and replace "S3kr1t"
with the Wi-Fi password, enclosed in quotes, for example, "12345679"
.
It might look something like this:
wifis:
wlan0:
dhcp4: true
optional: true
access-points:
"your wifi name":
password: "your_wifi_password"
Save the file and insert the micro SD card into your Raspberry Pi. On the first boot, if your Raspberry Pi cannot connect to the Wi-Fi network, just restart your device.
Step 3: Use Ubuntu Server on Raspberry Pi (if you have a dedicated monitor, keyboard, and mouse)
If you have an extra mouse, keyboard, and monitor, you can easily use the Raspberry Pi like any other computer (but without GUI).
Simply insert the micro SD card into the Raspberry Pi, connect the monitor, keyboard, and mouse. Now turn on your Raspberry Pi. It will display the TTY login screen (black terminal screen) and ask for a username and password.
ubuntu
ubuntu
When prompted, use ubuntu
as the password. After a successful login, Ubuntu will prompt you to change the default password.
Enjoy your Ubuntu Server!
Step 3: Connect to your Raspberry Pi via SSH (if you don’t have a monitor, keyboard, and mouse for the Raspberry Pi)
If you don’t have a dedicated monitor for the Raspberry Pi, that’s fine. Who needs a server with a monitor when you can access it directly via SSH and use it your way?
On Ubuntu and Mac OS, an SSH client is usually pre-installed. To connect remotely to your Raspberry Pi, you need to find its IP address. Check the devices connected to your network to see which one is the Raspberry Pi.
Since I don’t have a Windows machine, you can refer to Microsoft’s comprehensive guide.
Open the terminal and run the following command:
ssh ubuntu@raspberry_pi_ip_address
You may see the following message confirming the connection:
Are you sure you want to continue connecting (yes/no/[fingerprint])?
Type yes
and hit enter.
When prompted, use ubuntu
as the password. Of course, you will be asked to change the password.
Once done, you will be logged out automatically, and you must reconnect with the new password.
Your Ubuntu Server is now running on the Raspberry Pi!
Conclusion
Installing Ubuntu Server on Raspberry Pi is a simple process, and it is highly pre-configured, making it enjoyable to use.
I must say that among all the operating systems I have tried on the Raspberry Pi, Ubuntu Server is the easiest to install. I am not exaggerating. Please check my guide on installing Arch Linux on Raspberry Pi for reference.
I hope this guide also helps you install Ubuntu Server on your Raspberry Pi. If you have any questions or suggestions, please let me know in the comments.
via: https://itsfoss.com/install-ubuntu-server-raspberry-pi/
Author: Dimitrios Savvopoulos Topic: lujun9972 Translator: geekpi Proofreader: wxy
This article is originally compiled by LCTT and proudly presented by Linux China
Leave a Comment
Your email address will not be published. Required fields are marked *