Ubuntu进行换源
一卒2018 2024-07-17 14:37:03 阅读 53
各种源大全 在此地
<code>// 此源均只适用Ubuntu 18.04 版本,其他版本需要修改 bionic 为对应的Ubuntu版本
#阿里云源地址
deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
#华为源地址
deb https://repo.huaweicloud.com/ubuntu/ bionic main restricted
deb https://repo.huaweicloud.com/ubuntu/ bionic-updates main restricted
deb https://repo.huaweicloud.com/ubuntu/ bionic universe
deb https://repo.huaweicloud.com/ubuntu/ bionic-updates universe
deb https://repo.huaweicloud.com/ubuntu/ bionic-backports main restricted universe
deb https://repo.huaweicloud.com/ubuntu/ bionic-security main restricted
deb https://repo.huaweicloud.com/ubuntu/ bionic-security universe
#中科大源地址
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.ustc.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
#163源地址
deb http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ bionic-backports main restricted universe multiverse
#清华源地址
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-security main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
原始源进行备份。
打开终端,输入以下命令以备份原有的配置文件(可选):
sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup
编辑源文件配置文件:
sudo nano /etc/apt/sources.list
在文件中找到相应的镜像源地址,注释掉原有的地址,并添加新的地址。
例如,要将默认的镜像源修改为清华大学的镜像源,可以将原有的地址注释掉(在前面加上#),并添加以下内容:
// 接着进入清华镜像源网站: https://mirrors.tuna.tsinghua.edu.cn/help/ubuntu/
// 清华# 默认注释了源码镜像以提高 apt update 速度,如有需要可自行取消注释
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
# deb-src http://security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
# 预发布软件源,不建议启用
# deb https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
# # deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-proposed main restricted universe multiverse
/ 上海交大源
deb https://mirror.sjtu.edu.cn/ubuntu/ focal main restricted universe multiverse
# deb-src https://mirror.sjtu.edu.cn/ubuntu/ focal main restricted universe multiverse
deb https://mirror.sjtu.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
# deb-src https://mirror.sjtu.edu.cn/ubuntu/ focal-updates main restricted universe multiverse
deb https://mirror.sjtu.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
# deb-src https://mirror.sjtu.edu.cn/ubuntu/ focal-backports main restricted universe multiverse
deb https://mirror.sjtu.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb-src https://mirror.sjtu.edu.cn/ubuntu/ focal-security main restricted universe multiverse
# deb https://mirror.sjtu.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
# deb-src https://mirror.sjtu.edu.cn/ubuntu/ focal-proposed main restricted universe multiverse
保存文件并退出编辑器。更新软件包列表:
sudo apt-get update
实操中的问题与解决方案:
1、换源时的问题:
因为ROS安装采用的鱼香的快捷安装方法。
// 在换源过程中,通过修改该list内容来实现换源。
/etc/apt/sources.list
// 修改好后保存退出,然后执行update
sudo apt-get update
// 可一直在此过程报错,
403 E: 仓库 “http://mirrors.tuna.tsinghua.edu.cn/ros/ubuntu bionic InRelease”
E: 仓库 “https://mirrors.tuna.tsinghua.edu.cn/ros2/ubuntu bionic Release” 没有 Release 文件_无法解析域名“mirrors.tuna.tsinghua.edu.cn”
解决方法:
// 将如下路径下的文件进行处理
/etc/apt/sources.list.d/ros-fish.list
// 在此路径下执行:【也就是相当于将 ros-fish.list 删除】
hzx@vm:/etc/apt/sources.list.d$ sudo mv ros-fish.list ros-fish.list.bak
// 之后在/etc/apt/sources.list 文件内各种换源,然后进行 update 可以成功。
sudo apt-get update
2 sudo apt-get install ***package 无法定位软件包
在源码安装某包时,在catkin_ws/src 下执行 catkin_make时,会有出现如下报错:
很明显,就是缺少“moveit_visual_tools”包的依赖,安装即可以,
可以通过如下安装缺失的依赖包
<code>// 常规操作
sudo apt-get install ros-melodic-moveit-visual-tools
// 但出现如下问题:
这就说明在这个源下没有这个依赖包,需要换源。但此操作不同于【 经验 1、换源时的问题】,需要作如下修改:参考:ROS中无法定位软件包问题
<code>// 进入到该路径下,创建/打开这个list文件,
/etc/apt/sources.list.d/ros-latest.list
// 将如下填入文件内。【使用中科大的源,也可以尝试其他源】
deb https://mirrors.ustc.edu.cn/ros/ubuntu/ bionic main
<code>// 再次进行安装,发现有了这个依赖包
sudo apt-get install ros-melodic-moveit-visual-tools
最终,在catkin_ws/src 下执行 catkin_make时,不会出现报错。
声明
本文内容仅代表作者观点,或转载于其他网站,本站不以此文作为商业用途
如有涉及侵权,请联系本站进行删除
转载本站原创文章,请注明来源及作者。