在ubuntu14.05.04中,出现ubuntu软件源更新不了,可以通过更换软件源来解决。
编辑sources.list,最好在编辑之前,先备份sources.list,以防万一修改错误,还能恢复。
vi /etc/apt/sources.list
清空sources.list,粘贴以下内容到sources.list:
deb http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ trusty-backports main restricted universe multiverse
trusty为ubuntu14.04.5的版本代号,其他版本的ubuntu需要修改为对应的版本代号。
在vi编辑器的命令行模式中,输入命令替换字符串:
:%s/precise/trusty
%s/precise/trusty表示替换每一行中所有的precise为trusty。
如果安装了图形界面,也可以通过ubuntu的系统设置来修改软件源。