ubuntu的镜像源+bionic版本

本文指导如何在Ubuntu系统中查找并替换与你的版本匹配的镜像源,包括阿里云、清华大学和中国科技大学的官方镜像地址,以及如何编辑sources.list文件进行设置。
摘要由CSDN通过智能技术生成

首先第一步

查找和你自己ubuntu版本匹配的版本号

匹配代号如下

在终端输入lsb_release -a查看自己系统上的版本号

可以看到我这个版本号的代号是bionic。

每个版本的镜像文件都是有规律的。

 bionic版本的源如下

#  阿里源
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://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
#  中科大源
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

 

只需要在终端中输入下面的命令,会打开一个文件,然后把上面的镜像源复制粘贴到里面即可

sudo gedit /etc/apt/sources.list

Ubuntu 的软件源设置文件位于 `/etc/apt/sources.list`,我们可以通过修改该文件来更换镜像源。 以下是更换为阿里云镜像源的步骤: 1. 备份原有的软件源设置文件 ```bash sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak ``` 2. 使用文本编辑器打开 `/etc/apt/sources.list` 文件 ```bash sudo nano /etc/apt/sources.list ``` 3. 将原有的内容注释掉,添加阿里云镜像源的内容 ```bash # 以下为原有的内容,注释掉 # deb http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse # deb-src http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse # deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse # deb-src http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse # deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse # deb-src http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse # deb http://archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse # deb-src http://archive.ubuntu.com/ubuntu bionic-security main restricted universe multiverse # 以下为阿里云镜像源的内容 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-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-security main restricted universe multiverse deb-src http://mirrors.aliyun.com/ubuntu/ bionic-security main restricted universe multiverse ``` 4. 保存并退出编辑器 按下 `Ctrl + X`,然后按下 `Y` 确认保存。 5. 更新软件源 ```bash sudo apt update ``` 现在,你已经成功更换 Ubuntu镜像源了。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值