Install ROS on Ubuntu 20.04.3

ROS is a fundamental library to bridge SLAM systems with real world vehicle applications. This article briefly explains the overall installation process, as well as proposing solutions to some common errors during installation.

Here, we install ROS Noetic Ninjemys on Ubuntu 20.04.3, the overall process is the same for older visions. Please refer to ROS Official Wiki for more details.

Some Setup Before Installation

  • Configure Ubuntu repositories to allow all four repository type. Under a few circumstances, it’s the system’s default setting and can be skipped.

  • Setup sources.list:

    sudo sh -c 'echo "deb $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
  • Setup keys. Make sure curl is installed, and then:

    curl -s | sudo apt-key add -

The most common error here is no valid OpenPGP data found, these are some possible workarounds:

  • Check Internet connection, especially if you are in worldwide web restricted areas such as mainland China. Use a proxy if possible.

  • Use wget to manually download the key and then add it. Personally, I believe it is a more robust method since this error may persist even using a proxy:

    sudo apt-key add ros.key


If the previous steps completed without error, we can head straight to installing ROS, be sure to run sudo apt update first.

After that, run sudo apt install ros-noetic-desktop-full to perform a full install. A detailed list of installation options is available on ROS wiki mentioned above.

This is a pretty trivial step and all you need to do is wait patiently. Still, if an error appears saying something like no packages are found, try open the following URL in your Ubuntu browser:


Or directly click here. This will activate the installation process in Ubuntu GUI.

Post-Installation Setup & Initialize

Run the following command in bash to setup environment:

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

And install some other dependencies:

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

Next and final step, initialize rosdep:

sudo apt install python3-rosdep
sudo rosdep init
rosdep update

The step sudo rosdep init will commonly throw an Website may be down error, it’s a pretty widespread issue, and these are some solutions may work:

  • Install CA certificate:

    sudo apt-get install ca-certificates
  • Since this error indicates that the target website cannot be connected, it’s most likely (also sadly) still an Internet connection issue. Try to use a proxy.

  • If all these failed, we can generate the target file manually:

    mkdir -p /etc/ros/rosdep/sources.list.d
    cd /etc/ros/rosdep/sources.list.d
    touch 20-default.list

    And edit this file:

    sudo nano /etc/ros/rosdep/sources.list.d/20-default.list

    Paste the following content then save it:

    # os-specific listings first
    yaml osx
    # generic
    gbpdistro fuerte
    # newer distributions (Groovy, Hydro, ...) must not be listed anymore, they are being fetched from the rosdistro index.yaml instead

    Please notice that, when using this solution, skip sudo rosdep init command after editing the 20-default.list file. Directly executing rosdep update is sufficient.

If everything goes right, the last output will be something like:

reading in sources list data from /etc/ros/rosdep/sources.list.d
Query rosdistro index
Skip end-of-life distro "ardent"
Skip end-of-life distro "bouncy"
Skip end-of-life distro "crystal"
Skip end-of-life distro "dashing"
Skip end-of-life distro "eloquent"
Add distro "foxy"
Add distro "galactic"
Skip end-of-life distro "groovy"
Skip end-of-life distro "hydro"
Skip end-of-life distro "indigo"
Skip end-of-life distro "jade"
Skip end-of-life distro "kinetic"
Skip end-of-life distro "lunar"
Add distro "melodic"
Add distro "noetic"
Add distro "rolling"
updated cache in /home/lincoln/.ros/rosdep/sources.cache

And congratulations, ROS is successfully installed.

Written on January 15, 2022