首页 > 系统服务 > 详细

18.【原创】Ubuntu下切换apt的源为阿里源

时间:2020-07-11 00:16:08      阅读:117      评论:0      收藏:0      [点我收藏+]

1.先查看当前系统的版本号,ubuntu的每个大版本所对应的代号(Codename的值后面会用到)是不一样的,需要使用如下命令查看:

root@ubuntu-xenial:/etc/apt# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.6 LTS
Release:        16.04
Codename:       xenial

  1.1.各个版本对应的代号(Codename

序号 版本号 代号(Codename)
1

Ubuntu 12.04 (LTS)

precise
2

Ubuntu 14.04 (LTS)

trusty
3

Ubuntu 15.04

vivid
4

Ubuntu 15.10

wily
5

Ubuntu 16.04 (LTS)

xenial
6

Ubuntu 18.04 (LTS)

bionic
7 Ubuntu 19.10 eoan

 

2.找切换到源配置文件的目录,对源文件进行备份,出错时可回滚。如果没有配置文件,则需要创建:

root@ubuntu-xenial:/# cd /etc/apt
root@ubuntu-xenial:/etc/apt# sudo mv sources.list sources.list.bak
root@ubuntu-xenial:/etc/apt# 

  

3.使用“sudo vi sources.list”指令,将如下阿里的源镜像地址写入到源配置文件中,我目前所有的版本代号为“xenial”所以源地址配置中会带代号标识符,其他版本的可对应替换标识符即可:

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

  

4.更新apt的源配置:

sudo apt-get update

  

18.【原创】Ubuntu下切换apt的源为阿里源

原文:https://www.cnblogs.com/Nick-Hu/p/13282051.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!