0.前言
通过改动ubuntu软件源可提高apt命令下载安装软件的速度。
參考资料
【官方资料】——配置文件改动方法
【Ubuntu如何改动软件源地址】——使用ubuntu软件中心改动(推荐)
1.使用ubuntu软件中心更新
请參考【Ubuntu如何改动软件源地址】——来自百度经验
图1 打开软件和更新
图2 选择国内软件源
2.使用指令方法改动
【1】首先备份源列表
sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup
【2】gedit打开 并替换全部内容
sudo gedit /etc/apt/sources.list
【2.1】 若ubunt版本号为13.04
【163源】
deb http://mirrors.163.com/ubuntu/ raring main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ raring-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ raring-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ raring-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ raring-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ raring-backports main restricted universe multiverse
【阿里云源】
deb http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
deb http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-security main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-updates main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-proposed main restricted universe multiverse
deb-src http://mirrors.aliyun.com/ubuntu/ raring-backports main restricted universe multiverse
【2.2】 若ubuntu版本号为12.04
将上述列表地址中的 raring 替换为 precise 就可以
【3】刷新列表
sudo apt-get update
【3.1】若运行apt-get update产生错误
【错误现象】
E: Could not get lock /var/lib/apt/lists/lock - open (11 Resource temporarily unavailable)
E: Unable to lock the list directory
【错误原因】可能为之前操作使用ctrl+c强制退出apt-get 指令。而实际apt-get进程依旧存在。
【解决方法】
【a】查看进程(使用grep指令过滤其它进程)
ps -e | grep apt
【b】apt-get进程依旧存在
6362 ? 00:00:00 apt
6934 ? 00:00:00 apt-get
【c】销毁进程
sudo killall apt
sudo killall apt-get
【d】又一次运行
sudo apt-get update