debian下以光盘为apt源安装软件包

288 篇文章 0 订阅
88 篇文章 0 订阅

作者:yang_dk

转自:http://blog.csdn.net/yang_dk/article/details/1705319


在debian下,用apt方式安装软件除了可以以网络上的资源为源之外,还可以使用本地的资源。下面我就以安装GCC的过程为例,说一下整个过程。

平台:debian 4.0 图形界面
资源:CD一张 debian-40r0-i386-CD-1.iso刻录的

0,增加光盘源

使用命令#apt-cdrom add
系统会提示将你要添加为源的光盘放入光驱
然后enter继续,就自动添加好了

1,查看源列表

debian - dk: ~ # vim  / etc / apt / sources.list
deb cdrom:[Debian GNU
/ Linux  4.0  r0 _Etch_  -  Official i386 CD Binary - 1   20070407 - 11 : 55 ] /  etch contrib main

2,安装gcc

debian - dk: ~ # apt - get  install gcc
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
将会安装下列额外的软件包:
  gcc
- 4.1  libssp0
建议安装的软件包:
  manpages
- dev autoconf automake1. 9  libtool flex bison gcc - doc gcc - 4.1 - doc
  gcc
- 4.1 - locales libc6 - dev - amd64 lib64gcc1 lib64ssp0
推荐安装的软件包:
  libc6
- dev libc - dev libmudflap0 - dev
下列【新】软件包将被安装:
  gcc gcc
- 4.1  libssp0
共升级了 
0  个软件包,新安装了  3  个软件包,要卸载  0  个软件包,有  0  个软件未被升级 。
需要下载 0B
/ 470kB 的软件包。
解压缩后会消耗掉 1401kB 的额外空间。
您希望继续执行吗?[Y
/ n]y
选中了曾被取消选择的软件包 libssp0。
(正在读取数据库 ... 系统当前总共安装有 
52968  个文件和目录。)
正在解压缩 libssp0 (从 ...
/ libssp0_4. 1.1 - 21_i386.deb) ...
选中了曾被取消选择的软件包 gcc
- 4.1
正在解压缩 gcc
- 4.1  (从 ... / gcc - 4 .1_4. 1.1 - 21_i386.deb) ...
选中了曾被取消选择的软件包 gcc。
正在解压缩 gcc (从 ...
/ gcc_4. 1.1 - 15_i386.deb) ...
正在设置 libssp0 (
4.1 . 1 - 21 ) ...

正在设置 gcc
- 4.1  ( 4.1 . 1 - 21 ) ...
正在设置 gcc (
4.1 . 1 - 15 ) ...

3,查看gcc信息,看是否安装好


debian
- dk: ~ # man gcc
No manual entry 
for  gcc
See 
' man 7 undocumented '   for  help when manual pages are not available.
debian
- dk: ~ # ls
debian
- dk: ~ # find  - name gcc
debian
- dk: ~ # gcc  -- help
Usage: gcc [options] file...
Options:
  
- pass - exit - codes         Exit with highest error code from a phase
  
-- help                   Display  this  information
  
-- target - help            Display target specific command line options
  (Use 
' -v --help '  to display command line options of sub - processes)
  
- dumpspecs               Display all of the built  in  spec strings
  
- dumpversion             Display the version of the compiler
  
- dumpmachine             Display the compiler ' s target processor
   - print - search - dirs       Display the directories  in  the compiler ' s search path
   - print - libgcc - file - name  Display the name of the compiler ' s companion library
   - print - file - name =< lib >    Display the full path to library  < lib >
  
- print - prog - name =< prog >   Display the full path to compiler component  < prog >
  
- print - multi - directory   Display the root directory  for  versions of libgcc
  
- print - multi - lib         Display the mapping between command line options and
                           multiple library search directories
  
- print - multi - os - directory Display the relative path to OS libraries
  
- Wa, < options >             Pass comma - separated  < options >  on to the assembler
  
- Wp, < options >             Pass comma - separated  < options >  on to the preprocessor
  
- Wl, < options >             Pass comma - separated  < options >  on to the linker
  
- Xassembler  < arg >         Pass  < arg >  on to the assembler
  
- Xpreprocessor  < arg >      Pass  < arg >  on to the preprocessor
  
- Xlinker  < arg >            Pass  < arg >  on to the linker
  
- combine                 Pass multiple source files to compiler at once
  
- save - temps              Do not delete intermediate files
  
- pipe                    Use pipes rather than intermediate files
  
- time                    Time the execution of each subprocess
  
- specs =< file >             Override built - in  specs with the contents of  < file >
  
- std =< standard >           Assume that the input sources are  for   < standard >
  
-- sysroot =< directory >     Use  < directory >   as  the root directory  for  headers
                           
for  headers and libraries
  
- < directory >            Add  < directory >  to the compiler ' s search paths
   - < machine >              Run gcc  for  target  < machine > if  installed
  
- < version >              Run gcc version number  < version > if  installed
  
- v                       Display the programs invoked by the compiler
  
- ###                     Like  - v but options quoted and commands not executed
  
- E                       Preprocess only;  do  not compile, assemble or link
  
- S                       Compile only;  do  not assemble or link
  
- c                       Compile and assemble, but  do  not link
  
- < file >                 Place the output into  < file >
  
- < language >             Specify the language of the following input files
                           Permissible languages include: c c
++  assembler none
                           
' none '  means revert to the  default  behavior of
                           guessing the language based on the file
' s extension

Options starting with 
- g,  - f,  - m,  - O,  - W, or  -- param are automatically
 passed on to the various sub
- processes invoked by gcc.  In order to pass
 other options on to these processes the 
- W < letter >  options must be used.

For bug reporting instructions, please see:
< URL:http: // gcc.gnu.org/bugs.html>.
For Debian GNU / Linux specific bug reporting instructions, please see:
< URL:file: ///usr/share/doc/gcc-4.1/README.Bugs>.

4,ok,写个helloworld试试gcc

debian - dk: ~ # ls
debian
- dk: ~ # vim hello.c
debian
- dk: ~ # gcc  - o hello hello.c
hello.c:
1 : 19 : error: stdio.h: 没有那个文件或目录
hello.c: In function ‘main’:
hello.c:
4 : warning: incompatible  implicit  declaration of built - in  function ‘printf’

出问题了,找不到stdio.h,那是因为没装库,装上libc6-dev就行了,往下走

5,安装libc库

debian - dk: ~ # apt - get  install libc - dev
正在读取软件包列表... 完成
正在分析软件包的依赖关系树... 完成
注意,我选了 libc6
- dev 而非 libc - dev
将会安装下列额外的软件包:
  libc6
- dev linux - kernel - headers
建议安装的软件包:
  glibc
- doc manpages - dev
下列【新】软件包将被安装:
  libc6
- dev linux - kernel - headers
共升级了 
0  个软件包,新安装了  2  个软件包,要卸载  0  个软件包,有  0  个软件未被升级。
需要下载 0B
/ 4591kB 的软件包。
解压缩后会消耗掉 
22 .2MB 的额外空间。
您希望继续执行吗?[Y
/ n]y
选中了曾被取消选择的软件包 linux
- kernel - headers。
(正在读取数据库 ... 系统当前总共安装有 
53056  个文件和目录。)
正在解压缩 linux
- kernel - headers (从 ... / linux - kernel - headers_2. 6.18 - 7_i386.deb) ...
选中了曾被取消选择的软件包 libc6
- dev。
正在解压缩 libc6
- dev (从 ... / libc6 - dev_2. 3.6 .ds1 - 13_i386.deb) ...
正在设置 linux
- kernel - headers ( 2.6 . 18 - 7 ) ...
正在设置 libc6
- dev ( 2.3 . 6 .ds1 - 13 ) ...

6,ok装好了,再来看看helloworld

debian - dk: ~ # gcc  - o hello hello.c
debian
- dk: ~ # ls
hello  hello.c
debian
- dk: ~ # . / hello
hello debian world!

7,finished!


  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值