码迷,mamicode.com
首页 > 系统相关 > 详细

Ubuntu 修改 apt-get 源为国内镜像源的方法

时间:2020-05-14 22:28:20      阅读:266      评论:0      收藏:0      [点我收藏+]

标签:bak   --   ali   tty   pos   markdown   source   阿里镜像   删除   

1、原文件备份

sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak

2、编辑源列表文件

sudo vim /etc/apt/sources.list

3、将原来的列表删除,添加如下内容(阿里镜像源)

deb http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-backports main restricted universe multivers
deb http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ bionic-proposed main restricted universe multiverse
 

4、运行 sudo apt-get update

5、如果出现以下错误:

	E: 无法获得锁 /var/lib/apt/lists/lock - open (11: 资源暂时不可用)
	E: 无法对目录 /var/lib/apt/lists/ 加锁

是因为上一次更新源的时候非常规中断导致的,解决方法如下:

sudo rm /var/lib/apt/lists/lock

Ubuntu 修改 apt-get 源为国内镜像源的方法

标签:bak   --   ali   tty   pos   markdown   source   阿里镜像   删除   

原文地址:https://www.cnblogs.com/wuzaipei/p/12891652.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!