After years of developing the install- and build-processes in ROS have changed a bit. So here I want to explain how you can easily install Ubuntu and ROS on your Raspberry PI 3+. If you want to use a desktop on your RPi it is necessary to use a swap file to extend the 1GB memory. This will increase the aging process of your SD-card in a significant way!

Installing Ubuntu on the Raspberry PI 3+

There are different ways to install it, but I have decided to go a simple and fast way, so use a "Preinstalled server image" from here: http://cdimage.ubuntu.com/releases/18.04/release/

I decided to choose the 64-bit ARM image: http://cdimage.ubuntu.com/releases/18.04/release/ubuntu-18.04.2-preinstalled-server-arm64+raspi3.img.xz

More information about Ubuntu on a Raspberry Pi can be found here: https://wiki.ubuntu.com/ARM/RaspberryPi

To get the image onto your SD-card there exist several simple ways for Windows and for Linux. Just ask Google for it you will find a lot of information.

For Windows, just extract the *.img file and flash it to an empty SD-card with tools like Win32DiskImager or Etcher.

After the SD-card is flashed, insert it into the RPi and boot it up.

Log in with ubuntu:ubuntu and change your password.

Update your system and expand your SD-card if necessary

sudo apt update
sudo apt upgrade
sudo apt install cloud-guest-utils
sudo growpart /dev/mmcblk0 2
sudo resize2fs /dev/mmcblk0p2

If you want to use a desktop create a swap-file first:

sudo fallocate -l 4G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

To use the swap file automatically after a reboot, edit the fstab file:

sudo nano /etc/fstab

and insert the following:

/swapfile none swap sw 0 0

Additional information in German can be found here.

Then install your desktop e.g. Unity (The Default Desktop)

sudo apt install ubuntu-desktop

If you get performance and stability problems with Unity, it might be better to switch to a more lightweight desktop like xubuntu-,lubuntu- or mate-desktop.

Next step is to set your actual locales and your keyboard layout.

Check the actual locale settings with

locale

and to see which locales are available, use

locale -a

If your "German" locales don't exist create them with the following command

sudo locale-gen de_DE.UTF-8

and update them like that

update-locale LANG=de_DE.UTF-8

The easiest way to change the keyboard layout is to use the following tool.

sudo dpkg-reconfigure keyboard-configuration

 

Installing ROS on Ubuntu

You have different possibilities to get ROS onto your system. The main source for this is:

http://wiki.ros.org/melodic/Installation/Ubuntu

First, get some basic tools like git and OpenSSH-server

sudo apt-get update
sudo apt-get install -y git
sudo apt-get install -y openssh-server

Installing ROS core

If you prefer an easy way as I do, you can choose the setup files from Ryuichiueda.

Clone them from git with like so.

git clone https://github.com/ryuichiueda/ros_setup_scripts_Ubuntu18.04_server.git

You get a directory with a step1.bash file. Run it to start the installation process

cd ros_setup_scripts_Ubuntu18.04_server
./step1.bash

After the installation is done, source the .bashrc file

source ~/.bashrc

Then set LANG=C and start the roscore to test it.

LANG=C roscore

Upgrade ROS core to Desktop(-Full) Install

If you want to upgrade to the full ROS environment including rqt, rviz and robot-generic libraries

you can use for "Desktop-Full Install"

sudo apt install ros-melodic-desktop-full

or for "Desktop Install"

sudo apt install ros-melodic-desktop

Disable display manager at startup

To prefend the desktop to be loaded at startup you can disable the display manager

systemctl set-default multi-user.target

To start it again you can use

sudo service gdm start