ubuntu 怎么更新?ubuntu更新命令及方法,ubuntu更新命令


 


                

                 ubuntu 怎么更新?ubuntu更新命令及方法

 

 

ubuntu 怎么更新?ubuntu更新命令及方法

      安装Ubuntu系统后,第一件事就是更新系统源。由于系统安装的默认源地址在英国,作为Ubuntu的主源,国内连接速度非常慢,所以我们要将它换成就近的快速源。

      网上有些人说CN99是国内最快的源,但不同的网络状况连接以下源的速度不同, 所以cn99并不一定是最快的源, 建议在添加前手动验证一下源的连接速度(ping下就行),比如说北京网通ADSL用户连接cn99就非常慢,而ftp.sjtu.edu.cn则相对较快,选择最快的源可以节省大批下载时间。

      首先备份源列表,而后用gedit或其他编辑器打开源列表文件:

      sudo cp /etc/apt/sources.list /etc/apt/sources.list_backup

      sudo gedit /etc/apt/sources.list

      从下面列表中选择合适的源,替换掉文件中所有的内容,保存编辑好的文件然后执行源的更新(注意:不同的Ubuntu版本对应的源是不同的,千万不要弄错了):

      sudo apt-get update

      如果更新很慢,可以用上面的方法换一个源,然后再试,直到成功为止。然后,执行真正的系统更新:sudo apt-get upgrade;如下图所示:

    ubuntu 怎么更新?ubuntu更新命令及方法

常用的源列表如下:

ubuntu 8.04的163源为:

deb http://mirrors.163.com/ubuntu/ hardy main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ hardy-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ hardy-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ hardy-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ hardy main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ hardy-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ hardy-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ hardy-backports main restricted universe multiverse

#Mirror.lupaworld.com 源更新服务器(浙江省杭州市双线服务器,网通同电信都可以用,亚洲地区官方更新服务器):
deb http://mirror.lupaworld.com/ubuntu gutsy main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu gutsy-security main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu gutsy-updates main restricted universe multiverse
deb http://mirror.lupaworld.com/ubuntu gutsy-backports main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu gutsy main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu gutsy-security main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu gutsy-updates main restricted universe multiverse
deb-src http://mirror.lupaworld.com/ubuntu gutsy-backports main restricted universe multiverse

Ubuntu 官方源 推荐北方网通用户添加
deb http://archive.ubuntu.com/ubuntu/ gutsy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ gutsy-security main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ gutsy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ gutsy-proposed main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ gutsy-backports main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ gutsy main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ gutsy-security main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ gutsy-updates main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ gutsy-proposed main restricted universe multiverse
deb-src http://archive.ubuntu.com/ubuntu/ gutsy-backports main restricted universe multiverse

台湾的官方源速度也相当不错,有时甚至快于内地的:
deb http://tw.archive.ubuntu.com/ubuntu gutsy main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu gutsy-security main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu gutsy-updates main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu gutsy-backports main restricted universe multiverse
deb http://tw.archive.ubuntu.com/ubuntu gutsy-proposed main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu gutsy main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu gutsy-security main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu gutsy-updates main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu gutsy-backports main restricted universe multiverse
deb-src http://tw.archive.ubuntu.com/ubuntu gutsy-proposed main restricted universe multiverse
 

再加个中国电信源科技大学的源(能用速度还不 错)

deb http://ubuntu.uestc.edu.cn/ubuntu/ intrepid main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ intrepid-backports main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ intrepid-proposed main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ intrepid-security main restricted universe multiverse
deb http://ubuntu.uestc.edu.cn/ubuntu/ hardy-updates main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ intrepid main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ intrepid-backports main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ intrepid-proposed main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ intrepid-security main restricted universe multiverse
deb-src http://ubuntu.uestc.edu.cn/ubuntu/ intrepid-updates main restricted universe multiverse

防止非官方源中软件包不全的问题,请在sources.list文件中尾部添加下面这个官方源。

deb http://archive.ubuntu.org.cn/ubuntu-cn/ feisty main restricted universe multiverse

如果没有这个源,下面安装某些软件的时候会提示找不到,比如w32codecs

台湾源可能会慢一些,耐心等一下,换源后一般下载速度都有几十K,上百K也很正常。

ubuntu更新命令

       常用的APT命令参数:
  apt-cache search package 搜索包
  apt-cache show package 获取包的相关信息,如说明、大小、版本等
  sudo apt-get install package 安装包
  sudo apt-get install package - - reinstall 重新安装包
  sudo apt-get -f install 修复安装"-f = ——fix-missing"
  sudo apt-get remove package 删除包
  sudo apt-get remove package - - purge 删除包,包括删除配置文件等
  sudo apt-get update 更新源
  sudo apt-get upgrade 更新已安装的包
  sudo apt-get dist-upgrade 升级系统
  sudo apt-get dselect-upgrade 使用 dselect 升级
  apt-cache depends package 了解使用依赖
  apt-cache rdepends package 是查看该包被哪些包依赖
  sudo apt-get build-dep package 安装相关的编译环境
  apt-get source package 下载该包的源代码
  sudo apt-get clean && sudo apt-get autoclean 清理无用的包
  sudo apt-get check 检查是否有损坏的依赖

相关内容