The first step is to open the terminal, type the following code, and automatically open the download source text editor
sudo gedit /etc/apt/sources.list
Replace the download source, and replace all the download sources with the following sources of China University of science and technology
deb http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse deb http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-security main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-updates main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-proposed main restricted universe multiverse deb-src http://mirrors.ustc.edu.cn/ubuntu/ xenial-backports main restricted universe multiverse deb http://ros.exbot.net/rospackage/ros/ubuntu/ xenial main
After saving, close and exit
Step 2: set up Ubuntu sources.list
Open the terminal and enter 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'
The third step is to add a key, which is the key required to install ros. It's free here
Under the operation just now, enter the following command:
sudo apt-key adv --keyserver hkp://ha.pool.sks-keyservers.net:80 --recv-key 0xB01FA116
I have a problem when running and can't connect to the server. If you have the same problem, you can use it hkp://pgp.mit.edu:80 perhaps hkp://keyserver.ubuntu.com:80 Replace the command above hkp://ha.pool.sks-keyservers.net:80 It can be solved!
Step 4: update the package. It needs to be updated after changing the source
1) . input the following two commands at one time at the terminal:
sudo apt-get update
2) . after the above command is executed, enter the following command:
sudo apt-get upgrade
Note: the execution time of this step may take a little time, about five minutes, so you can do something else!
It is recommended to execute these two commands before installing all software to update expired software in time
Step 5: install aptitude, which is a powerful downloader. It can analyze various dependency problems when installing the program. It is recommended to use this. Of course, you can directly use apt get without downloading
sudo apt-get install aptitude
Step 6 install the full version of ROS kinetic
This step takes the longest time, which may take dozens of minutes or even higher. It is a normal phenomenon. It depends on everyone's network speed. Wait, don't close it, and you can change the network halfway, because the later one will be downloaded. Don't be afraid!
sudo aptitude install ros-kinetic-desktop-full
Step 7 initialize rosdep
Initialization must be carried out before using ros. Input the following commands in sequence at the terminal for initialization:
sudo rosdep init
rosdep update
Step 8 configure the environment
The terminal inputs the following two commands in sequence:
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
Step 9 install the dependencies of the building package
The terminal inputs the command:
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential
Step 10 test the successful installation of ROS and open three terminals continuously
1) . the terminal inputs a command to open ROS
roscore
2) After waiting for the program to stop moving, enter the following command at the second terminal (note that the front terminal window cannot be closed):
rosrun turtlesim turtlesim_node
3) . a little turtle appears. On the third terminal (the front terminal window still needs to be closed), enter the following command:
rosrun turtlesim turtle_teleop_key
At this time, you can control the movement of the little turtle through the direction key in the terminal window! Note that the mouse must stop in the last terminal window, and then control the direction key of the keyboard to move!