Note that this post is the method of the ros official website, using the original official source of ros, not a domestic mirror image, suitable for friends with a better network environment.
add source
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
sudo apt update
Install
sudo apt install ros-noetic-desktop-full
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
sudo apt install python3-rosdep
sudo rosdep init
rosdep update
Install other ros packages (not required)
Install other instances of ros packages, for example, plotjuggler needs to be installed
sudo apt install ros-noetic-plotjuggler
Find instructions for the ros package:
apt search ros-noetic
Configure environment variables
Note that you need to run this line of command to configure environment variables every time you open the terminal.
source /opt/ros/noetic/setup.bash
If you don’t want to configure it every time, and your computer only has this version of ros, you can enter the following command to automatically load the environment variable
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc