树莓派之更新系统源
树莓派的服务器实在太慢了!会导致你安装一个几M的东西都要等大半天!肿么办!
好在树莓派官方有提供一个镜像列表:http://www.raspbian.org/RaspbianMirrors
国内源列表:http://shumeipai.nxez.com/2013/08/31/raspbian-chinese-software-source.html
面找到了几个国内的镜像一些软件无法更新,经过几番尝试,建议国内的阿里云更新源。
镜像主页:http://mirrors.aliyun.com/
阿里云镜像由阿里巴巴技术保障部基础系统组提供支持。
覆盖了Debian、Ubuntu、 Fedora、Arch Linux、 CentOS、openSUSE、Scientific Linux、Gentoo、Raspbian 等多个发行版的软件源镜像。
搭建此开源镜像的目的在于宣传自由软件的价值,提高自由软件社区文化氛围, 推广自由软件在国内应用。
同步频率为每天一次,每天凌晨2:00-4:00为镜像的同步时间
根据教程,咱们来编辑 /etc/apt/sources.list 文件。这里推荐用 nano 命令编辑。命令如下:
 sudo cp /etc/apt/sources.list /etc/apt/sources.list.bak  #备份为 sources.list.bak
 sudo cp /etc/apt/sources.list.d/raspi.list /etc/apt/sources.list.d/raspi.list.bak修改 sources.list:sudo nano /etc/apt/sources.list     #编辑sources.list  文件
deb http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib
deb-src http://mirrors.aliyun.com/raspbian/raspbian/ jessie main non-free contrib修改 raspi.list
sudo nano /etc/apt/sources.list.d/raspi.list    #编辑raspi.list文件
deb http://mirrors.aliyun.com/debian/ jessie main ui其中jessie是版本号,早期的版本是wheezy。
// 更新软件索引清单
sudo apt-get update
// 比较索引清单更新依赖关系
sudo apt-get upgrade -y或者
$ sudo aptitude update 
$ sudo aptitude upgrade 
$ sudo aptitude dist-upgrade 过程中可能遇到问题:
1.Hash Sum mismatch 
关于这个问题的原因,答案挺多,不过总的来说就是提供源的服务器的问题。可能是因为网络问题导致tcp包没有发送完整,也有可能是因为服务器那边繁忙所以没有处理你的请求,也有可能是因为服务器那边进行了缓存导致软件列表不是最新的,等等。。。(如果哪里说错说漏了,欢迎批评指正补充~)
网上的解决方法挺多的:
    sudo apt-get clean  
    sudo apt-get update --fix-missing  或者
    # 删除  
    sudo rm -fR /var/lib/apt/lists/*  
    # 新建相应文件夹  
    sudo mkdir /var/lib/apt/lists/partial  
    # 重新update  
    sudo apt-get update  再或者换源。
2.Some index files failed to download 错误
W: 无法下载 http://ubuntu.dormforce.net/ubuntu/dists/quantal/Release Unable to find expected entry '-updates/source/Sources' in Release file (Wrong sources.list entry or malformed file) E: Some index files failed to download. They have been ignored, or old ones used instead.
错误描述是说“有一些索引文件不能下载,它们可能被忽略了,也可能转而使用了旧的索引文件。”
解决办法:
注释掉deb-src相应的行就可以了。
sudo vi /etc/apt/sources.list
#deb-src http://ubuntu.dormforce.net/ubuntu/ quantal main restricted universe multiverse
#deb-src http://ubuntu.dormforce.net/ubuntu/ quantal-backports main restricted universe multiverse
#deb-src http://ubuntu.dormforce.net/ubuntu/ quantal-proposed main restricted universe multiverse
#deb-src http://ubuntu.dormforce.net/ubuntu/ quantal-security main restricted universe multiverse
#deb-src http://ubuntu.dormforce.net/ubuntu/ quantal -updates main restricted universe multiverse3.No address associated with hostname
dns 解析问题修改dns 
    echo 'nameserver 192.168.0.1' >> /etc/resolv.conf  
    echo 'nameserver 88.8.8.8' >> /etc/resolv.conf  
      
    //然后重启网卡  
    /etc/init.d/networking restart  树莓派各种问题详见 
http://shumeipai.nxez.com/2015/08/17/raspberry-pi-troubleshooting.html
						   	