Ubuntu18.04 更换apt源

Ubuntu使用apt-get下载软件时,一般速度非常慢,因为apt默认的下载源(服务器地址)是国外的。不过国内有些学校、组织、企业提供了国内的下载源,速度基本能跑满你的带宽。
闲话少叙,开始演示更换过程。

1、确定Ubuntu的版本代号

在终端输入命令lsb_release -c
在这里插入图片描述

Ubuntu 12.04 (LTS)代号为precise。
Ubuntu 14.04 (LTS)代号为trusty。
Ubuntu 15.04 代号为vivid。
Ubuntu 15.10 代号为wily。
Ubuntu 16.04 (LTS)代号为xenial。
Ubuntu 18.04 (LTS)代号为bionic。

不同的系统版本,源设置不同,这里只演示Ubuntu18.04更换apt-install源。

2、编辑/etc/apt/sources.list文件

首先进入/etc/apt/文件夹,命令cd /etc/apt/
在这里插入图片描述
然后备份sources.list文件,防止修改错了。命令sudo cp sources.list sources.list.backup
在这里插入图片描述
再编辑sources.list文件,命令sudo gedit sources.list(如果你会vi/vim也可以用它,只要能编辑就行)
在这里插入图片描述
在这里插入图片描述
清空所有内容后,粘贴为下面的内容,并保存

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 multiverse
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

在这里插入图片描述

3、更新获取 阿里软件源 提供的软件列表

保存后,直接关掉编辑窗口,回到终端执行命令sudo apt-get update,更新获取 阿里软件源 提供的软件列表。
在这里插入图片描述
在这里插入图片描述
以上就是Ubuntu18.04 更换apt源主要内容。

发布了976 篇原创文章 · 获赞 230 · 访问量 20万+

猜你喜欢

转载自blog.csdn.net/qq_41855420/article/details/104194640
今日推荐