ubuntu14.04怎么更换源?ubuntu更新源修改方法

发布时间:2020-08-15编辑:脚本学堂
本文介绍了ubuntu14.04下修改更新源的方法,ubuntu14.04更换源的具体操作方法,替换为163的源,需要的朋友参考下。

1、备份 旧的更新源
 

复制代码 代码示例:
sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak 
sudo vim /etc/apt/sources.list 

2、删除/etc/apt/sources.list文件中的全部内容
增加:
 

复制代码 代码示例:
deb http://mirrors.163.com/ubuntu/ precise main restricted 
deb-src http://mirrors.163.com/ubuntu/ precise main restricted 
deb http://mirrors.163.com/ubuntu/ precise-updates main restricted 
deb-src http://mirrors.163.com/ubuntu/ precise-updates main restricted 
deb http://mirrors.163.com/ubuntu/ precise universe 
deb-src http://mirrors.163.com/ubuntu/ precise universe 
deb http://mirrors.163.com/ubuntu/ precise-updates universe 
deb-src http://mirrors.163.com/ubuntu/ precise-updates universe 
deb http://mirrors.163.com/ubuntu/ precise multiverse 
deb-src http://mirrors.163.com/ubuntu/ precise multiverse 
deb http://mirrors.163.com/ubuntu/ precise-updates multiverse 
deb-src http://mirrors.163.com/ubuntu/ precise-updates multiverse 
deb http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse 
deb-src http://mirrors.163.com/ubuntu/ precise-backports main restricted universe multiverse 
deb http://mirrors.163.com/ubuntu/ precise-security main restricted 
deb-src http://mirrors.163.com/ubuntu/ precise-security main restricted 
deb http://mirrors.163.com/ubuntu/ precise-security universe 
deb-src http://mirrors.163.com/ubuntu/ precise-security universe 
deb http://mirrors.163.com/ubuntu/ precise-security multiverse 
deb-src http://mirrors.163.com/ubuntu/ precise-security multiverse 
deb http://extras.ubuntu.com/ubuntu precise main 
deb-src http://extras.ubuntu.com/ubuntu precise main 

3、更新
 

复制代码 代码示例:
sudo apt-get update 

报错:
The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192 

解决方法:
这个非官方源是不可信任的,解决办法是导入该源的公钥。
 

复制代码 代码示例:
gpg --keyserver subkeys.pgp.net --recv 16126D3A3E5C1192 
gpg --export --armor 16126D3A3E5C1192 | sudo apt-key add - 
sudo apt-get update 
sudo apt-get upgrade