Linux学习笔记——Ubuntu更新软件源

时间:2014-05-03 15:57:58   收藏:0   阅读:447
0.前言
    通过修改ubuntu软件源可提高apt命令下载安装软件的速度。
    参考资料
    【官方资料】——配置文件修改方法
    【Ubuntu怎样修改软件源地址】——使用ubuntu软件中心修改(推荐)
    【at-get update错误处理

1.使用ubuntu软件中心更新
    请参考【Ubuntu怎样修改软件源地址】——来自百度经验
bubuko.com,布布扣
图1 打开软件和更新

bubuko.com,布布扣
图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更新软件源,布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!