Ubuntu 修改 apt-get 源为国内镜像源的方法
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Ubuntu 修改 apt-get 源为国内镜像源的方法相关的知识,希望对你有一定的参考价值。
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 源为国内镜像源的方法的主要内容,如果未能解决你的问题,请参考以下文章