ubuntu替換阿里源

---------------------------------------------------------ubuntu

參考文章:https://www.jianshu.com/p/97c35d569aa3vim

---------------------------------------------------------bash

由於Ubuntu自帶的源服務器在國外,下載和更新軟件的時候速度很慢,不穩定,因此須要將源更新爲國內的源。國內的源比較多,經常使用的就是阿里的源。服務器

1.備份原有源文件,方便在替換出問題時回滾ionic

sudo cp /etc/apt/sources.list /etc/apt/source.list.bk

2.更改sources.list文件rest

vim /etc/apt/sources.list

替換裏面的內容爲code

# 阿里源
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  

這裏須要注意的是不一樣的ubuntu發行版本對應的源也是不同的,主要的區別在版本號blog

Ubuntu 12.04 (LTS)代號爲precise。ci

Ubuntu 14.04 (LTS)代號爲trusty。it

Ubuntu 15.04 代號爲vivid。

Ubuntu 15.10 代號爲wily。

Ubuntu 16.04 (LTS)代號爲xenial。

Ubuntu 18.04 (LTS)代號爲bionic。

目前個人版本是18.04因此裏面的版本號是bionic,若是是其餘版本號直接替換裏面的版本編號便可。

查看本身ubuntu的版本號:

lsb_release -c

3.更新源

sudo apt update
相關文章
相關標籤/搜索