The Raspberry Pi supports several Linux distributions. In most cases, you can simply flash the system image to an SD card, insert that SD card into your Raspberry Pi and start running. However, this does not apply to Ubuntu.
Fortunately, with the release of the Raspberry Pi Imager tool, the process of installing Ubuntu on the Raspberry Pi is now very easy. In this article, you will learn how to flash an Ubuntu image onto a Raspberry Pi.
Install Ubuntu using Raspberry Pi Imager
Visit the Raspberry Pi Foundation and website download the correct version of the Raspberry Pi Imager for your operating system.
Once the Raspberry Pi Imager is installed:
1. Insert the SD card into your laptop or computer.
2. Launch the application Raspberry Pi Imager.
3. Click Choose OS. Imager will now retrieve and display information about various operating systems compatible with the Raspberry Pi.Click Choose OS
The Raspberry Pi Foundation has released an Imager that you can use to flash different Pi-compatible operating systems.
4. Since you want to install Ubuntu, choose Ubuntu.
You can now choose from the latest Ubuntu LTS (Long Term Support) image server or the Ubuntu Core image. At the time of writing, the following images are available for the Raspberry Pi:
- Ubuntu 20.04 LTS. 32-bit host operating system for the armhf architecture.
- Ubuntu 20.04 LTS. 64-bit server operating system for the arm64 architecture.
- Ubuntu Core 18. 32 bit IoT operating system Ubuntu Core 18 for armhf architectures.
- Ubuntu Core 18. 64 bit IoT operating system Ubuntu Core 18 for arm64 architecture.
Make sure you choose an image that is compatible with your particular model of Raspberry Pi.
5. After you make your selection, click Choose SD card and select the SD card where you want to burn the system image.Click Choose SD card
6. Now, the only thing left to do is click Write and wait for the Raspberry Pi Imager to write the system image to the SD card.
Configure Ubuntu to connect to WiFi automatically
Next, edit the Ubuntu system image on the SD card so that the Pi automatically connects to the WiFi network:
1. Make sure the SD card is inserted in your laptop or computer. Launch a file manager app and go to SD card folder.
2. Open the partition system-boot, as it contains the configuration files loaded when the Raspberry Pi starts up.
3. Open the file network-config in the text editor.Open the network-config file in a text editor
4. Find the section wifis and uncomment everything in this section by deleting # at the beginning of each line.Find the wifis section
The WiFi section now looks similar to this:
wifis: wlan0: dhcp4: true optional: true access-points: myhomewifi: password: "S3kr1t"
You need to update access-points to refer to the name of the WiFi network. If this name contains any spaces, make sure you surround it with quotes, for example:
access-points: "My home network":
Next, replace S3kr1t with the password for your own WiFi network.
Save this file and safely remove the SD card from your laptop or computer.
Now, every time you start up your Raspberry Pi, it will automatically connect to the network.
Using Ubuntu on Raspberry Pi
Connect the display and keyboard to the Raspberry Pi and power on. On the login screen, log into your default Ubuntu account (username and password are both ubuntu).
Since this default login is public, you will be prompted to change the password to something more secure. To create a new password, follow the on-screen instructions.
Consider installing a desktop
By now, you will have noticed that Ubuntu doesn't come with a graphical user interface (GUI), so you can only interact with the Raspberry Pi from the command line.
If you prefer to interact with your Pi in a desktop environment, there are a variety of desktops you can install:
First, update the Raspberry Pi:
sudo apt update && sudo apt -y upgrade
Then you can set up your preferred desktop environment. For example:
sudo apt install kubuntu-desktop sudo apt install lubuntu-desktop sudo apt install xubuntu-desktop
After you install the desktop environment, restart the Pi with the following command:
Once the Raspberry Pi boots, the desktop environment is ready for you to use.
Set up the headless Raspberry Pi
If you prefer to run your Pi headless, then you may want to communicate with it over SSH.
To communicate over SSH, you need to know the IP address of the Raspberry Pi. If you don't know the Pi IP address, there are several ways you can retrieve this information for the headless Raspberry Pi:
You can view information about all the devices connected to your network by logging in to your router's configuration page. In the web browser address bar, enter the router's IP address and then log into your account.
Each router will be different, but if you explore the different menus and sections, you will find a log containing all the devices connected to the router. Find the Raspberry Pi in the list, click on it, and you will have access to the Pi's IP address.
Fing is a free network scanning app available for Android and iOS.
Install this app on your smartphone, then select Scan for devices> Devices. You should now have a list of devices that are currently connected to the network.List of devices currently connected to the network
Find the Raspberry Pi and write down its IP address.
Connect via SSH
Once you have the Raspberry Pi's IP address, you're ready to connect over SSH.
On the computer, open Terminal and run the following command:
ssh [email protected]<Địa chỉ IP của Raspberry Pi>
When prompted, enter Ubuntu's default password: ubuntu.
You are now connected to your Raspberry Pi and can begin issuing commands over SSH.
- What's new in Ubuntu 18.04 LTS?
- 7 Great Ideas for Using a Raspberry Pi as a Server
- 10 operating systems you can run with Raspberry Pi