ubuntu无网环境下建立build-essential开发环境

菜鸟玩ubuntu(4)--ubuntu无网环境下建立build-essential开发环境                2010-01-26 18:55:59
标签: UBUNTU
 
2009/4/23
ubuntu无网环境下建立build-essential开发环境

我只用过ubuntu 8.04与8.10,采用的是默认安装方式。
8.04默认情况下连gcc都没有安装。8.10 gcc是有了,但是东西不全,比如没有libstdc++6-4.3-dev g++-4.3。
有人说,连上网,一句sudo apt-get install build-essential就什么都建好了。
这有个前提,连网,在有的地方,上网是要用客户端的,这个客户端并不是总能找到deb包或者rpm包方便安装,很多情况下还是要自己make编译。
悖论就来了,要上网才能装gcc,要有gcc才能上网。

其实光盘里面已经有了build-essential。只要把光盘加入apt-get源里面就行。
这里要用到apt-cdrom命令。

过程如下

1.把光盘插入cdrom,执行sudo apt-cdrom ident命令(可做可不做)。它只是扫描一下,检查安装光盘内容是否完整,进行MD5校验,并识别出光盘标签。

atom@atom-desktop:~$ sudo apt-cdrom ident
Using CD-ROM mount point /cdrom/
Mounting CD-ROM
Identifying.. [ac20a1ac35626cb607897968f3dd2440-2]
Stored label: Ubuntu 8.10 _Intrepid Ibex_ - Release i386 (20081029.5)
Unmounting CD-ROM...

2.输入sudo apt-cdrom add,正式将光盘源写入/etc/apt/sources.list

atom@atom-desktop:~$ sudo apt-cdrom add
Using CD-ROM mount point /cdrom/
Unmounting CD-ROM
Waiting for disc...
Please insert a Disc in the drive and press enter
(未插入光盘则插入;以插入则直接按回车)

Mounting CD-ROM...
Identifying.. [ac20a1ac35626cb607897968f3dd2440-2]
Scanning disc for index files..
Found 2 package indexes, 0 source indexes, 0 translation indexes and 1 signatures
This disc is called:
'Ubuntu 8.10 _Intrepid Ibex_ - Release i386 (20081029.5)'
Copying package lists...gpgv: Signature made Thu 30 Oct 2008 07:24:11 AM CST using DSA key ID FBB75451
gpgv: Good signature from "Ubuntu CD Image Automatic Signing Key <cdimage@ubuntu.com>"
Reading Package Indexes... Done
Writing new source list
Source list entries for this disc are:
deb cdrom:[Ubuntu 8.10 _Intrepid Ibex_ - Release i386 (20081029.5)]/ intrepid main restricted
Unmounting CD-ROM...
Repeat this process for the rest of the CDs in your set.
W: Skipping non-exisiting file /cdrom/dists/intrepid/main/binary-i386/Packages
W: Skipping non-exisiting file /cdrom/dists/intrepid/restricted/binary-i386/Packages

至此,光盘源建立好了,你可以看到sources.list开头多了一些这么东西
atom@atom-desktop:~$ head -8 /etc/apt/sources.list
#deb cdrom:[Ubuntu 8.10 _Intrepid Ibex_ - Release i386 (20081029.5)]/ intrepid main restricted
# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.

deb cdrom:[Ubuntu 8.10 _Intrepid Ibex_ - Release i386 (20081029.5)]/ intrepid main restricted
deb http://cn.archive.ubuntu.com/ubuntu/ intrepid main restricted
deb-src http://cn.archive.ubuntu.com/ubuntu/ intrepid main restricted

看到这里,你是不是说,直接把上面的内容手动添加进sources.list不就行了,添加cn99源不就这么做的吗?
但是man 8 apt-cdrom里面说了:
“It is necessary to use apt-cdrom to add CDs to the APT system, it cannot be done by hand.”

接下来就可以直接安装build-essential
atom@atom-desktop:~$ sudo apt-get install build-essential

至此,基本开发环境建立,虽然man 手册不全,但毕竟好办事多了。

本文同样适用于在虚拟机为ubuntu安装vmware-tools。(虽然虚拟机联网很方便,使用NAT方式一定连得上)
安装vmware-tools失败,基本上是由于build-essential未安装全。
在虚拟机下面就不要真的拔插光盘了,指定ISO就可以了
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值