请认清ubuntu的apt-get命令(肤浅版)

因工作需要,想必有些童鞋会和我一样,需要装个虚拟机,里面搭个linux环境,我用的是ubuntu的10.04版本---Lucid.

ubuntu里安装软件很简单:

1.在线安装。

2.手动安装。

3.XX安装。(忘记叫啥了,想起来的童鞋可以提醒我下)

 

很多帖子都会忽略第一个方法(在线安装),因为它太简单太简单,但就是这么“简单”,整了我半天。

所以,我这里只介绍我在使用第一个方法时碰到的问题:

 

在线安装

在线安装,一般只要用如下命令就能下载并安装想要的软件,这也就是为什么很多帖子不介绍这个方法的原因,太简单:

       sudo apt-get install 软件名

其中,sudo的意思顾名思义就是让你快速能有root权限,而apt-get 就是一个命令,它适用于deb包管理式的操作系统,主要用于自动从互联网的软件仓库中搜索、安装、升级、卸载软件或操作系统。具体用法可以参照各个网站的百科^_*

但是,在使用这个命令进行安装的时候,我们经常会碰到诸如依赖包问题啦,404 NOT FOUND 啦各种问题。

这些问题归根到底都出在同一个原因上:/etc/apt/source.list里的“源”不匹配,或者不是最新的,如果能在这个文件里找到合适的内容并更新,那么之前的下载安装操作就可以成功了。

 

 -怎样更新source.list?

每个ubuntu都有个版本,可以点击系统->关于ubuntu 来查看,一般来说,你装的ubuntu是最新版的话,应该不会出现这个问题,出问题的大都像我一样,装这个老版本,找到适合自己的source.list(不知道怎么找?百度搜索 ubuntu + 你的版本号 + source.list,就有好多好多好多啊)

现在具体操作了:

cd /etc/apt      #进入source.list所在的目录

cp source.list source.list_back    #备份

gedit source.list      #利用gedit软件打开source.list,或者可以用其他形式打开,实在不懂,就用vi打开呗。

....         #把原来source.list的内容全删掉,然后添加你刚才在网上找到的可以用的“源”

sudo apt-get update     #这步非常重要,只有用这个命令才能更新你刚才写进去的“源”

sudo apt-get install 你要装的软件名   #基本成功了啊亲

 

拍手.........成功了。由于这是肤浅版讲解,所以别的没碰到的问题,我这里就没写,没帮到忙就见谅了。

 

 

附10.04版本可用的source.list内容吧:

 

#deb cdrom:[Ubuntu 10.04.1 LTS _Lucid Lynx_ - Release i386 (20100816.1)]/ lucid main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb http://us.archive.ubuntu.com/ubuntu/ lucid main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid main restricted

## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates main restricted

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
## review or updates from the Ubuntu security team.
deb http://us.archive.ubuntu.com/ubuntu/ lucid universe
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid universe
deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates universe
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates universe

## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu 
## team, and may not be under a free licence. Please satisfy yourself as to 
## your rights to use the software. Also, please note that software in 
## multiverse WILL NOT receive any review or updates from the Ubuntu
## security team.
deb http://us.archive.ubuntu.com/ubuntu/ lucid multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid multiverse
deb http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-updates multiverse

## Uncomment the following two lines to add software from the 'backports'
## repository.
## N.B. software from this repository may not have been tested as
## extensively as that contained in the main release, although it includes
## newer versions of some applications which may provide useful features.
## Also, please note that software in backports WILL NOT receive any review
## or updates from the Ubuntu security team.
# deb http://us.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse
# deb-src http://us.archive.ubuntu.com/ubuntu/ lucid-backports main restricted universe multiverse

## Uncomment the following two lines to add software from Canonical's
## 'partner' repository.
## This software is not part of Ubuntu, but is offered by Canonical and the
## respective vendors as a service to Ubuntu users.
# deb http://archive.canonical.com/ubuntu lucid partner
# deb-src http://archive.canonical.com/ubuntu lucid partner

deb http://security.ubuntu.com/ubuntu lucid-security main restricted
deb-src http://security.ubuntu.com/ubuntu lucid-security main restricted
deb http://security.ubuntu.com/ubuntu lucid-security universe
deb-src http://security.ubuntu.com/ubuntu lucid-security universe
deb http://security.ubuntu.com/ubuntu lucid-security multiverse
deb-src http://security.ubuntu.com/ubuntu lucid-security multiverse


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值