常用命令1——更新命令

更新命令:

$sudo apt-get update  #更新
$sudo apt-get upgrade  #升级,需要用update更新完才能upgrade

更多详细信息,可运行命令

 $man apt-get

记录更新源的文件:/etc/apt/sources.list

默认sources.list中的更新源为官方的,下载速度慢,因此有时需要寻找符合自己需要的更新源。

  • 获取更新源:google“linux更新源”,选择在自己所在的网中比较快的更新源(教育网、网通、电信等等)。

  • 修改默认的更新源:

  1. $sudo cp /etc/apt/sources.list etc/apt/sources.list_backup // 备份更新源
  2. $sudo gedit /etc/apt/sources.list // 打开更新源文件,进行修改
  •  更新源的格式

    deb URI distribution component [component2] [component3]

    deb-src URI distribution component [component2] [component3]

    其中deb是debian包目录,deb-src是源码目录,后者根据需要使用。

        例如,在sources.list文件中可能有如下内容:

            deb http://security.ubuntu.com/ubuntu maverick-security main restricted

            deb-src http://security.ubuntu.com/ubuntu maverick-security main restricted

更新源的格式举例:以更新源http://cn.archive.ubuntu.com/ubuntu/为例

1.  找到一个镜像的URI,如http://cn.archive.ubuntu.com/ubuntu/;

2.  进入dists文件夹,找到自己安装的distribution对应的目录,进入。

这里有dapper, hardy, jaunty, karmic, lucid, maverick, natty等等,下面以maverick为例

进入http://cn.archive.ubuntu.com/ubuntu/dists/maverick/;

3.  记录提供的components名(以/结尾的),这里有main, multiverse, restricted;

4.  则对应的更新源写法为:

dev http://cn.archive.ubuntu.com/ubuntu maverick main multiverse restricted

dev-src http://cn.archive.ubuntu.com/ubuntu maverick main multiverse restricted

注意:每行一个distribution, 多个components。因为每行只能有一个distribution, 所以同一个uri可能写多个更新源。


转载于:https://my.oschina.net/u/2255071/blog/378417

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值