How to Install ROS on Ubuntu Linux in 5 Minutes or Less

ros-homepage

In this post, we will get started with ROS, the Robot Operating System. ROS is the most popular robot programming platform. The reason it is so popular is that it is free, open-source, and has a ton of pre-written code that you can use for your robotics project. Sure you could write everything from scratch, but why reinvent the wheel? ROS saves you time from having to write code for common robot capabilities like navigation, motion planning, path planning, perception, control, and manipulation. It also has a huge worldwide community.

You Will Need

In order to complete this tutorial, you will need:

Directions

The official steps for installing ROS are at this link at ROS.org, but I will walk you through the process below so that you can see what each step should look like.

As of the time of this writing, the latest version with long term support (LTS) of ROS is ROS Melodic Morenia. Select that option.

1-latest-version-of-ros

I am using Ubuntu, so I will click on the Ubuntu option, which will land me on this page.

2-select-your-platform

Click the 9 white dots at the bottom left of your screen.

3-nine-white-dots

Search for Software & Updates. Then click on it.

4-software-updates

Make sure main, universe, restricted, and multiverse are all checked. Then click Close.

5-all-checked

Now open up a new terminal window, and type (or copy and paste) the following command:

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

The command above sets your computer up to accept software from packages.ros.org. 

Now we need to set up the secure keys so that our system accepts what we are going to download. 

For the next step, update the package list on your system.

sudo apt update
8-update-package-list

Now type:

sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
7-add-keys

Now do a full desktop install of ROS. At the time of this writing, the latest version is ROS Melodic Morenia. The command below installs all the software, tools, algorithms, and robot simulators for ROS. After you type the command and press Enter, press Y and hit Enter when asked if you want to continue. It will take a while to download all this stuff, so feel free to take a break while ROS downloads to your system.

sudo apt install ros-melodic-desktop-full

Now initialize rosdep. This is a tool that is required before you can use ROS.

sudo rosdep init
rosdep update

Set up the environment variables.

echo "source /opt/ros/melodic/setup.bash" >> ~/.bashrc
source ~/.bashrc

Install some other tools that you will work with in ROS. After you type the command below, press Y and Enter to complete the download process.

sudo apt install python-rosinstall python-rosinstall-generator python-wstool build-essential

Here is the last step of the installation process. Check which version of ROS you have installed. If you see your ROS version as the output, congratulations you have successfully installed ROS!

rosversion -d
9-check-ros-version

ROS has a lot of new vocabulary (e.g nodes, bags, topics). So before start working with ROS, I recommend you bookmark (no need to read in detail) this page at the ROS Wiki which covers the new vocabulary associated with ROS. That way, when I mention a term you might not understand, you know where to look it up.