How to Install ROS Noetic and ROS Melodic on Ubuntu 20.04


Today I will walk you through the steps to install ROS Noetic and ROS Melodic on your Ubuntu 20.04. The steps will be very easy and you should be able to complete the installation very quickly.

Before we begin to see the Installation process of ROS, let’s see what ROS is and why it is the preferred choice of many hobbyists, engineers, and robotics designers throughout the world.

What is ROS?

Robot Operating System, in short “ROS” is an open-source framework for researchers and developers to build and reuse code between robotics applications. It is a collection of software libraries and frameworks used in robotics development.

There is also ROS 2, which is the more advanced and newer version of the framework that has the features that were missing in the previous ROS.

Install ROS Noetic on Ubuntu 20.04

Okay, so the first ROS version that we are going to install is ROS Noetic Ninjemys. To begin, first, make sure you have root permissions on your ubuntu system as we need root permission to download and install ROS.

Add ROS Source List

The first step will be to add the ROS Source List to our ubuntu system so that we can easily download and install all the resources for ROS using our command terminal. 

Before adding the ROS source list to your ubuntu system, be sure to first update your ubuntu packages using the update command.

sudo apt-get update

After that, you can add the ROS source list by using the command below –

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

After adding the source list run the update command again to refresh the ubuntu packages list.

sudo apt-get update

Add ROS Keys

To be able to add the ROS keys, first install curl in your ubuntu. You can do that by using the command below-

sudo apt-get install curl

After installing curl, Copy-Paste the command given below in the terminal, if everything is working fine then you should see an output in the terminal that says “OK”, which means you can continue with the installation of ROS Noetic.

curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -

add ros key to ubuntu

After adding the ROS keys you can run the ROS Noetic installation commands that will start the installation process of ROS Noetic on your ubuntu.

Download and Install ROS Noetic

You can install the full version of ROS Noetic using the command given below which will download all the things you need for ROS Noetic, like GUI, 2D/3D simulators etc.

sudo apt-get install ros-noetic-desktop-full -y

Now, if you don’t want to download all the extra features then you can just download the ROS-Base with this command –

sudo apt-get install ros-noetic-desktop -y

The full version of ROS Noetic is recommended as it will have all the features, packages, libraries that you might and will need. So, just download the full version of ROS Noetic which will take approximately 3GB of storage.

ROS Noetic Environment Setup

Now to be able to run ROS Noetic in your terminal you will have to source the setup.bash file in every terminal window you want to run ROS Noetic in. You can do that by entering the command given below in the terminal.

source /opt/ros/noetic/setup.bash

But, sourcing the bash file every time you open a new terminal will be very inconvenient, that’s why you can automate this process by adding the source command to your bashrc file.

You can echo the source command using the command given below –

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

ALTERNATIVE WAY TO ADD SOURCE COMMAND TO BASHRC (STARTS)

Or, you can manually add the source command to your bashrc file using the gedit editor.

gedit ~/.bashrc

Add the “source /opt/ros/noetic/setup.bash” line to the end of the bashrc file, save and then exit.

ALTERNATIVE WAY TO ADD SOURCE COMMAND TO BASHRC (ENDS)

Once you have echo or added the source command to the bashrc file run the source command to finish the setup.

source ~/.bashrc

And, that’s it. The installation of ROS Noetic is now complete. You can use the command “roscore” to verify the installation of ROS Noetic.

Install ROS Melodic on Ubuntu 20.04

Okay so if you want to install ROS Melodic instead of ROS Noetic then here are the steps to do that.

The installation steps are the same as ROS Noetic, with just a little bit of changes. Once you have added the source list and the ROS keys you can download ROS Melodic using the command below.

sudo apt-get install ros-melodic-desktop-full -y

Or, you can download the smaller version of ROS Melodic which doesn’t contain the extra features like 2D/3D simulator etc.

sudo apt-get install ros-melodic-desktop -y

Once ROS Melodic is downloaded and installed, finish the installation process by setting up the Environment variable. First add the source command to the bashrc file using echo command. 

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

This command will add the source command to the bashrc file, you can also add it manually by editing the bashrc file using the gedit editor.

gedit ~/.bashrc

After that run the source command to finish the installation process of ROS Melodic.

source ~/.bashrc

Install Important Packages

Now for both ROS Noetic and ROS Melodic you will need some common tools that are required to run and use some features of ROS. Here are the most common tools that you will need to install.

  • python-rosdep
  • python-rosinstall
  • python-rosinstall-generator
  • python-wstool
  • build-essential

You can install all these tools and dependencies by using “sudo apt-get install <tool-name>” like –

sudo apt-get install python-rosinstall

Now, there is one tool that you will need a lot when using ROS, and that tool is rosdep. You can install rosdep by using the command given below – 

sudo apt-get install python-rosdep

After installing rosdep, run the following command to initialize rosdep. 

sudo rosdep init
rosdep update

Conclusion –

And that’s it, that’s how you can download, install and set up ROS Noetic and ROS Melodic on your ubuntu 20.04. If you have any questions regarding the installation process of ROS then be sure to comment below. Thank You.

Recent Content