一 打开源的文件

命令如下:

sudo gedit /etc/apt/sources.list

打开后删除或注释里面所有代码。

二 更换下载源

1

.进入阿里云源的网址:阿里云源
选择你的电脑Ubuntu的版本,我用的Ubuntu16.04,下滑鼠标找到它,如下图

Ubuntu16.04的软件源网址全部复制到/etc/apt/sources.list里面,保存退出。

2

进入 系统设置>软件和更新,打勾如图所示,再直接关闭,退出,不要重新载入。

3 更新

命令如下:

sudo apt-get update

4.软件升级

命令如下:

sudo apt-get upgrade

三 ubuntu16.04 安装ros-kinetic

3.1装ROS-kinetic
阿里云源,命令如下:

sudo apt-get update
再输入下面中的一个(2选1):
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.ustc.edu.cn/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'
或
sudo sh -c '. /etc/lsb-release && echo "deb http://mirrors.aliyun.com/ros/ubuntu/ $DISTRIB_CODENAME main" > /etc/apt/sources.list.d/ros-latest.list'再输入下面中的一个(3选1):
sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key F42ED6FBAB17C654
或
sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys F42ED6FBAB17C654
或
sudo apt-key adv --keyserver 'hkp://keyserver.ubuntu.com:80' --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654sudo apt-get update
sudo apt-get install ros-kinetic-desktop-full

四 创建本地rosdistro

4.1.添加地址,防止出错
一般是:无法访问raw.githubusercontent.com
然后会报错
ERROR: cannot download default sources list from:
https://raw.githubusercontent.com/ros/rosdistro/master/rosdep/sources.list.d/20-default.list
Website may be down.

解决办法:访问IPAddress.com查询raw.githubusercontent.com真实IP,通常是199.232.28.133
打开文件,命令如下:

sudo gedit /etc/hosts

在最后一行添加以下内容
199.232.28.133 raw.githubusercontent.com
再输入命令:

sudo rosdep init

若出现以下错误
ERROR: default sources list file already exists:
/etc/ros/rosdep/sources.list.d/20-default.list
Please delete if you wish to re-initialize

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

再输入
sudo rosdep init

然后:

rosdep update

因为github网站不太好进,导致rosdep update很容易出错,所以选择下载rosdistro到本地。

1.下载

链接:https://pan.baidu.com/s/1hEwepV_1rPjDMFvxFUcVpQ
提取码:edpk

2、配置

将rosdistro.zip压缩包解压到home下,并且文件夹名字改为rosdistro,并打开文件,命令如下:

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

打开后的内容全部替换成如下5行,其中xx是你的电脑名字。

yaml file:///home/xx/rosdistro/rosdep/osx-homebrew.yaml osx
yaml file:///home/xx/rosdistro/rosdep/base.yaml
yaml file:///home/xx/rosdistro/rosdep/python.yaml
yaml file:///home/xx/rosdistro/rosdep/ruby.yaml
gbpdistro file:///home/xx/rosdistro/releases/fuerte.yaml fuerte

3.修改

3.1修改sourceslist.py,命令如下:

 sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/sources_list.py

注释掉DEFAULT_SOURCES_LIST_URL一行(前面加#)添加以下:

DEFAULT_SOURCES_LIST_URL = 'file:///home/xx/rosdistro/rosdep/sources.list.d/20-default.list'

其中 xx 是你的电脑名。

3.2.修改 rep3.py,命令如下:

sudo gedit /usr/lib/python2.7/dist-packages/rosdep2/rep3.py

注释REP3_TARGETS_URL 一行,添加以下:

REP3_TARGETS_URL = 'file:///home/xx/rosdistro/releases/targets.yaml'

其中 xx 是你的电脑名。

3.3.修改 __init.py,命令如下:

sudo gedit /usr/lib/python2.7/dist-packages/rosdistro/__init__.py

注释 DEFAULT_INDEX_URL 一行,添加以下:

DEFAULT_INDEX_URL = 'file:///home/xx/rosdistro/index-v4.yaml'

其中 xx 是你的电脑名。

3.4.测试一下,命令如下:

rosdep update

出现以下就说明rosdistro配置成功:

reading in sources list data from /etc/ros/rosdep/sources.list.d
Hit file:///home/xx/rosdistro/rosdep/osx-homebrew.yaml
Hit file:///home/xx/rosdistro/rosdep/base.yaml
Hit file:///home/xx/rosdistro/rosdep/python.yaml
Hit file:///home/xx/rosdistro/rosdep/ruby.yaml
Hit file:///home/xx/rosdistro/releases/fuerte.yaml
Query rosdistro index file:///home/xx/rosdistro/index-v4.yaml
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/xx/.ros/rosdep/sources.cache

安装rosinstall等工具
sudo apt-get install python-rosinstall python-rosinstall-generator python-wstool build-essential

执行下面语句,HOME下隐藏文件(ctrl+H显示出来):.bashrc最后一行添加source /opt/ros/kinetic/setup.bash,用命令添加如下:
echo “source /opt/ros/kinetic/setup.bash” >> ~/.bashrc
source .bashrc
roscore

若rosdep update出现以下错误(没有错误可忽略下面切换的步骤),说明是你有多个python版本,当前使用Python版本不对,我们要用Python2.7而非3.0以上,(如果安裝了Python3.5,一般安裝Ubuntu16.04後默認是Python2.7)。

此时需要切换Python为2.7版:

sudo update-alternatives --config python

再输入Python2.7前面的序号(我的是1),回车。不放心是否成功切换,可输入命令:

python --version

图中可以看到 Python 2.7.12。説明切换成功。
如果切换失败,就先设置版本使用的优先级:

sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 1

"python2.7 1"表示把python2.7设置为第一优先级。
以上步骤就完成安装ros的全部步骤。

输入命令

roscore

出现如下图,就是装好了:

轉載自以下4個:
https://blog.csdn.net/qq_41585680/article/details/112984671?spm=1001.2014.3001.5501

https://blog.csdn.net/qq_41585680/article/details/118368114?spm=1001.2014.3001.5501

https://blog.csdn.net/qq_41585680/article/details/106843393?spm=1001.2014.3001.5501
https://blog.csdn.net/qq_41585680/article/details/106501652?spm=1001.2014.3001.5501

1/3 Ubuntu更换ROS的源(阿里云)相关推荐

  1. Ubuntu更换apt镜像源

    原文:Ubuntu更换apt镜像源 在ubuntu中,默认使用 ubuntu 的官方源http://archive.ubuntu.com/,但是这个官方源在国内下载的速度太慢,甚至只有几十k.于是考虑 ...

  2. ubuntu更换软件安装源

    ubuntu更换软件安装源 1.首先是备份软件安装源 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak 2.更换软件安装源 sudo vi ...

  3. pip 更换国内安装源 阿里源 清华源 豆瓣源等等

    pip 更换国内安装源 阿里源 清华源 豆瓣源等等 十分想念顺店杂可... 对于Python开发用户来讲,PIP安装软件包是家常便饭.但国外的源下载速度实在太慢,浪费时间.而且经常出现下载后安装出错问 ...

  4. ubuntu 22.04 国内镜像阿里云/163源/清华大学/中科大--转--已验证

    Ubuntu 22.04 LTS 五年长期支持版本,直到2027年4月 1- 备份原配置 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak ...

  5. CentOS配置本地yum源/阿里云yum源/163yuan源

    CentOS配置本地yum源/阿里云yum源/163yuan源 https://blog.csdn.net/kangvcar/article/details/73477730 https://blog ...

  6. Ubuntu更换国内安装源

    对于默认安装的Ubuntu系统,有时候通过命令行下载软件或更新软件时,偶尔会出现下载速度极慢的情况,可以通过更换软件安装源为国内镜像地址来解决这一问题.(腾讯云主机默认下载地址为腾讯的镜像源,见下图, ...

  7. linux系统Centos7更换下载源阿里云

    进入yum下载源目录 cd /etc/yum.repos.d/ 备份原下载源 mv CentOS-Base.repo CentOS-Base.repo.bak 安装阿里云下载源 wget -O /et ...

  8. Ubuntu 更换清华大学镜像源

    Ubuntu 更换镜像源 通常我们使用ubunntu的时候总是出现网络过慢导致的更新下载失败等问题. Ubuntu默认的服务器是在国外,自然连接就很慢. 这里我们更换成国内的镜像源,这里使用清华镜像源 ...

  9. 将Centos的yum源更换为国内的阿里云源

    为什么80%的码农都做不了架构师?>>>    CentOS系统更换软件安装源 第一步:备份你的原镜像文件,以免出错后可以恢复. mv /etc/yum.repos.d/CentOS ...

最新文章

  1. numpy meshgrid用法
  2. Vim 在 windows 环境下的初步配置
  3. 有特殊步长适应的自适应差分脉码调制语音编码系统
  4. python读取html文件中的表格数据_使用解析html表pd.read_html文件其中单元格本身包含完整表...
  5. 一个小案例精通lamda表达式与函数式接口
  6. 敏捷开发人员结构_开发人员可以在敏捷外观方面发表意见的4种方法
  7. 解决IntelliJ Idea 集成TortoiseSVN 时找不到svn.exe,也就是 svn安装失败 找不到指定
  8. GDAL工具使用示例(一)
  9. vim java.dict_配置 VIM 英语字典
  10. NP、OSPF基本配置
  11. ubunut 安装 pyqt5
  12. 小波分析及相应MATLAB实现
  13. Python求正态分布曲线下面积
  14. c语言编程照抄能学好吗,C语言I作业12—学期总结
  15. 【paper笔记】Personalized Top-N Sequential Recommendation via Convolutional Sequence Embedding
  16. 双摄像头深度剖析 (1):双Camera都能做什么?
  17. Java爬虫Ins博主所有帖子的点赞和评论导出excel
  18. mybatis批量入库
  19. Unity中替换模型的方法
  20. nodejs 工作线程的基本使用(worker_threads)

热门文章

  1. 3.7寸黑白电子工牌【蓝牙版】
  2. Linux-如何正确清理大文件
  3. webService之发布与请求
  4. 【无标题】22222
  5. 权威报告:近两年融资租赁案件达13万件,电子合同证据力凸显
  6. Jquery 防止事件冒泡
  7. 为联想刃7000新增硬盘
  8. KEIL5软件编程中遇到很多关键固件库函数报错如
  9. vue项目中:PC端导出csv或excel数据表方法及其移动端导出表格方法
  10. 钉钉和企业微信使用情况调查