Installing Ubuntu 20.04 + ROS Noetic on Raspberry Pi 4 (without a monitor)

xiangyu fu Lv3

1. Required Equipment

Required equipment:

  • Raspberry Pi 4 Model B

  • Wi-Fi capability

  • MicroSD card: minimum 32GB

  • MicroSD to SD card adapter

  • (Optional) Monitor, mouse, etc.

2. Raspberry Pi Image Burner

If you don't have a monitor, you'll need to use a Raspberry Pi image burner, which you can download from the official website.

First, select the operating system, then find Ubuntu Server 20.04.5 version.

Next, configure the system initialization options: - "Enable SSH service" to enable SSH - "Set username" - "Configure Wi-Fi" (important): This will enable Wi-Fi and automatically connect to the provided network and password. Ensure this Wi-Fi network matches the one your current computer is connected to; otherwise, the rest of this tutorial won't work.

Proceed with burning and wait for completion.

3. Finding Raspberry Pi 4 IP Address

Remove the micro SD card from your computer and insert it into the Raspberry Pi 4's slot, ensuring the Pi is powered off (unplug power). Power on the Raspberry Pi 4; you should see the green LED on the Pi flashing randomly, indicating it's booting and using the SD card. If the green LED doesn't flash randomly, the burning operation might not have been successful, and you may need to burn the image again.

The Pi 4 will attempt to connect to the current Wi-Fi network with the provided name and password.

Next step is to find out what the IP address of the Raspberry Pi is in your network.

Note: If you don't see the Pi's address initially, wait at least 2 minutes before powering off/on the Raspberry Pi again.

3.1 Windows

For Windows, you can use Advanced IP Scanner .

Simply click "Scan" and wait.

You can see the IP address of my Raspberry Pi is 192.168.178.40.

3.2 Linux/Ubuntu

Typically done using nmap (if not already installed: sudo apt install nmap).

First, find your network IP address and subnet mask. Run the command ifconfig:

1
$ ifconfig

In this example, my Ubuntu host IP address is 192.168.43.138 with a subnet mask of 255.255.255.0 (24 bits).

Now, use nmap with the obtained data:

1
$ sudo nmap -sP 192.168.43.0/24

This will reveal the Raspberry Pi's IP address: 192.168.43.56.

3.3 With a Monitor

Directly input:

1
$ ip addr

The output looks like this:

1
2
3
4
5
6
7
8
9
10
11
12
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
inet 127.0.0.1/8 scope host lo
valid_lft forever preferred_lft forever
inet6 ::1/128 scope host
valid_lft forever preferred_lft forever
2: eth0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc mq state DOWN group default qlen 1000
link/ether e4:5f:01:49:a8:b6 brd ff:ff:ff:ff:ff:ff
3: wlan0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
link/ether e4:5f:01:49:a8:b7 brd ff:ff:ff:ff:ff:ff
inet 192.168.178.40/24 brd 192.168.178.255 scope global dynamic wlan0
valid_lft 863983sec preferred_lft 863983sec

4. Connecting to Raspberry Pi

Open Terminal on Windows, simply by typing “cmd” in the Windows search bar, then “Run Command.”

4. Connecting to Raspberry Pi

To connect to your Raspberry Pi from Windows, open a terminal by typing "cmd" in the Windows search bar and launching Command Prompt. Here, I recommend using VS Code because it's very suitable for future development, and I highly recommend it.

Enter the following command:

1
$ ssh pi@192.168.178.40

Replace "pi" with any other username you entered in the advanced settings of your Raspberry Pi image burner. Also, use the IP address you found in the previous step, not necessarily 192.168.178.40.

You'll then see something like this:

1
2
3
4
5
6
The authenticity of host '192.168.178.40 (192.168.178.40)' can't be established.
ED25519 key fingerprint is SHA256:WI67l/jru1i2vEnrHWLbzoV+1s71Dt0AJtg6JBP8faI.
This key is not known by any other names
Are you sure you want to continue connecting (yes/no/[fingerprint])? yes
Warning: Permanently added '192.168.178.40' (ED25519) to the list of known hosts.
pi@192.168.178.40's password:

You need to type "yes" for the first question and then enter the password set in the advanced settings of your image burner.

After that, you'll see something like this:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
Welcome to Ubuntu 20.04.6 LTS (GNU/Linux 5.4.0-1090-raspi aarch64)

* Documentation: https://help.ubuntu.com
* Management: https://landscape.canonical.com
* Support: https://ubuntu.com/advantage

System information as of Sun Aug 6 10:11:16 UTC 2023

System load: 0.47 Temperature: 55.0 C
Usage of /: 31.3% of 28.94GB Processes: 168
Memory usage: 4% Users logged in: 0
Swap usage: 0% IPv4 address for wlan0: 192.168.178.40

* Strictly confined Kubernetes makes edge and IoT secure. Learn how MicroK8s
just raised the bar for easy, resilient and secure K8s cluster deployment.

https://ubuntu.com/engage/secure-kubernetes-at-the-edge

Expanded Security Maintenance for Applications is not enabled.

183 updates can be applied immediately.
To see these additional updates run: apt list --upgradable

29 additional security updates can be applied with ESM Apps.
Learn more about enabling ESM Apps service at https://ubuntu.com/esm

New release '22.04.2 LTS' available.
Run 'do-release-upgrade' to upgrade to it.


Last login: Thu Jul 20 12:13:32 2023 from 192.168.163.155
pi@ubuntu:~$

5. Installing ROS Noetic

Setting up sources.list

Configure your computer to accept software from packages.ros.org.

1
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'

This command adds the ROS software package source to the sources.list file.

1
2
sudo apt install curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

These two commands install curl (if not already installed) and import the public key for ROS software packages.

1
sudo apt update

This command updates the list of available packages.

Installing Desktop version

Includes all content in ROS-Base and tools like rqt and rviz.

1
sudo apt install ros-noetic-desktop

This command installs the ROS Desktop version, which includes all content in ROS-Base and additional tools like rqt and rviz.

1
2
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc

These two commands add ROS environment variables to the bashrc file and load them immediately in the current session.

Install packages such as python3-rosdep, python3-rosinstall, python3-rosinstall-generator, python3-wstool, and build-essential.

1
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential

This command installs commonly used ROS dependency tools and essential packages required for compilation.

Initializing rosdep

Before using many ROS tools, you need to initialize rosdep. rosdep makes it easy to install system dependencies for the source code you want to compile, and certain ROS core components require it to function. If rosdep is not installed yet, install it as follows.

1
sudo apt install python3-rosdep

This command installs rosdep.

Run the following commands to initialize rosdep.

1
2
sudo rosdep init
rosdep update

These two commands initialize rosdep and fetch the latest rosdep rules.

Testing

Next, you can run roscore to check the ROS installation.

1
roscore

  • Title: Installing Ubuntu 20.04 + ROS Noetic on Raspberry Pi 4 (without a monitor)
  • Author: xiangyu fu
  • Created at : 2023-08-06 18:25:35
  • Updated at : 2024-06-23 00:59:02
  • Link: https://redefine.ohevan.com/2023/08/06/misc/install_ubuntu_on_raspberry_pi/
  • License: This work is licensed under CC BY-NC-SA 4.0.
Comments