修改Ubuntu的aptget源为阿里源的方法
程序员文章站
2022-07-03 17:06:25
...
1、复制原文件备份
sudo cp /etc/apt/source.list /etc/apt/source.list.bak
2、编辑源列表文件
sudo vim /etc/apt/source.list
3、将原来的列表删除,添加如下内容
deb http://mirrors.aliyun.com/ubuntu/ vivid main restricteduniverse multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-security mainrestricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-updates main restricteduniverse multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-proposed mainrestricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ vivid-backports mainrestricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid main restricteduniverse multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-security mainrestricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-updates mainrestricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-proposed mainrestricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ vivid-backports mainrestricted universe multiverse
备注:vivid 为系统的版本关键字Codename,修改为自己系统相对应的,
如果不知道Codename也没关系,只要在Ubuntu命令行中输入命令“lsb_release-a”,即可显示其Codename。如下,trusty即为14.04的Codename。
# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04LTS
Release: 14.04
Codename: trusty
4、运行
sudo apt-get update
5、运行
sudo apt-get upgrade