ubuntu16安装ros,并解决常见的一些科学网络问题导致的错误

文献来源

命令行

首先换科大源,打开系统设置开启以下几个选项:
ubuntu16安装ros,并解决常见的一些科学网络问题导致的错误_第1张图片

# 更新系统
sudo apt-get update
sudo apt-get upgrade
# 添加source.list
sudo sh -c 'echo "deb https://mirrors.ustc.edu.cn/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
# 添加公钥
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654
# 更新系统
sudo apt-get update
# 安装ros
sudo apt-get install ros-kinetic-desktop-full
## 上面这一步可能会报错,我直接忽略了,最后也可以安装。
# 初始化:一般会报错
sudo rosdep init
rosdep update
# 这一步一般会出错,除非你的网络比较科学,不科学的就要操作一下
sudo gedit /etc/hosts

添加以下内容,添加完成后再次运行上面两条初始化命令。

192.30.253.118 gist.github.com
185.199.110.153 github.io
 
151.101.113.194 github.global.ssl.fastly.net
52.216.227.168 github-cloud.s3.amazonaws.com
52.74.223.119 github.com
 
199.232.28.133 avatars1.githubusercontent.com
199.232.28.133 avatars2.githubusercontent.com
199.232.28.133 avatars0.githubusercontent.com
199.232.28.133 avatars3.githubusercontent.com
199.232.28.133 raw.githubusercontent.com
199.232.28.133 user-images.githubusercontent.com
199.232.28.133 avatars.githubusercontent.com
199.232.28.133 github.map.fastly.net
199.232.28.133 avatars7.githubusercontent.com
 
# Amazon AWS Start
54.239.31.69	aws.amazon.com
54.239.30.25	console.aws.amazon.com
54.239.96.90	ap-northeast-1.console.aws.amazon.com
54.240.226.81	ap-southeast-1.console.aws.amazon.com
54.240.193.125	ap-southeast-2.console.aws.amazon.com
54.239.54.102	eu-central-1.console.aws.amazon.com
177.72.244.194	sa-east-1.console.aws.amazon.com
176.32.114.59	eu-west-1.console.aws.amazon.com
54.239.31.128	us-west-1.console.aws.amazon.com
54.240.254.230	us-west-2.console.aws.amazon.com
54.239.38.102	s3-console-us-standard.console.aws.amazon.com
54.231.49.3	s3.amazonaws.com
52.219.0.4	s3-ap-northeast-1.amazonaws.com
54.231.242.170	s3-ap-southeast-1.amazonaws.com
54.231.251.21	s3-ap-southeast-2.amazonaws.com
54.231.193.37	s3-eu-central-1.amazonaws.com
52.218.16.140	s3-eu-west-1.amazonaws.com
52.92.72.2	s3-sa-east-1.amazonaws.com
54.231.236.6	s3-us-west-1.amazonaws.com
54.231.168.160	s3-us-west-2.amazonaws.com
52.216.80.48	github-cloud.s3.amazonaws.com
54.231.40.3	github-com.s3.amazonaws.com
52.216.20.171	github-production-release-asset-2e65be.s3.amazonaws.com
52.216.228.168	github-production-user-asset-6210df.s3.amazonaws.com
# 初始化
sudo rosdep init
rosdep update
# 环境配置
echo "source /opt/ros/kinetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
# 构建依赖
sudo apt-get install python-rosinstall
# 测试
## 打开ros
roscore
rosrun turtlesim turtlesim_node
rosrun turtlesim turtle_teleop_key

常见错误

E: 有几个软件包无法下载,要不运行 apt-get update 或者加上 --fix-missing 的选项再试试?
解决办法:这个我直接忽略了,最后也没啥问题。

你可能感兴趣的:(ubuntu)