0.前言
通过修改ubuntu软件源可提高apt命令下载安装软件的速度。
参考资料
1.使用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
Linux学习笔记——Ubuntu更新软件源,古老的榕树,5-wow.com