更换Ubuntu 14.04 LTS的apt-get源
更换Ubuntu 14.04的apt-get 源
一、 概述
安装完Ubuntu系统,系统默认选择了Ubuntu的repositoy源,有3个,security、archive、extra。但是这3个源无法用于apt-get update。会有报错,所以需要更改源。
二、 报错信息:
W: GPG error: http://extras.ubuntu.com trusty Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192
三、分析
应该是所指向的源需要有正确的pubkey,所以简单的说就是这个源不可用。
四、 解决方案
更换源
4.1 备份源的配置文件
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
4.2 编辑源的配置文件
vim /etc/apt/sources.list
把所有内容都删除,只保留最上面的注释就行了(因为怕有格式的问题而不可用,所以就想保留格式。)
#
#deb cdrom `````````
#deb cdrom
4.3 把如下的内容复制进文件
deb http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ trusty-backports main restricted universe multiverse
4.4 保存并推出即可。
4.5 更新一下
sudo apt-get update.
4.6 大功告成