热门标签 | HotTags
当前位置:  开发笔记 > 运维 > 正文

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

debian下以光盘为apt源安装软件包--Linux发行版技术-Debian信息,下面是详情阅读。
这里我以安装gcc为例。

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= Display the full path to library
-print-prog-name= Display the full path to compiler component
-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, Pass comma-separated on to the assembler
-Wp, Pass comma-separated on to the preprocessor
-Wl, Pass comma-separated on to the linker
-Xassembler Pass on to the assembler
-Xpreprocessor Pass on to the preprocessor
-Xlinker Pass 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= Override built-in specs with the contents of
-std= Assume that the input sources are for
--sysroot= Use as the root directory for headers
for headers and libraries
-B Add to the compiler's search paths
-b Run gcc for target , if installed
-V Run gcc version number , 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
-o Place the output into
-x 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 options must be used.

For bug reporting instructions, please see:
http://gcc.gnu.org/bugs.html>.
For Debian GNU/Linux specific bug reporting instructions, please see:
.

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!
推荐阅读
  • 在Docker中,将主机目录挂载到容器中作为volume使用时,常常会遇到文件权限问题。这是因为容器内外的UID不同所导致的。本文介绍了解决这个问题的方法,包括使用gosu和suexec工具以及在Dockerfile中配置volume的权限。通过这些方法,可以避免在使用Docker时出现无写权限的情况。 ... [详细]
  • Linux服务器密码过期策略、登录次数限制、私钥登录等配置方法
    本文介绍了在Linux服务器上进行密码过期策略、登录次数限制、私钥登录等配置的方法。通过修改配置文件中的参数,可以设置密码的有效期、最小间隔时间、最小长度,并在密码过期前进行提示。同时还介绍了如何进行公钥登录和修改默认账户用户名的操作。详细步骤和注意事项可参考本文内容。 ... [详细]
  • 本文介绍了在rhel5.5操作系统下搭建网关+LAMP+postfix+dhcp的步骤和配置方法。通过配置dhcp自动分配ip、实现外网访问公司网站、内网收发邮件、内网上网以及SNAT转换等功能。详细介绍了安装dhcp和配置相关文件的步骤,并提供了相关的命令和配置示例。 ... [详细]
  • 图解redis的持久化存储机制RDB和AOF的原理和优缺点
    本文通过图解的方式介绍了redis的持久化存储机制RDB和AOF的原理和优缺点。RDB是将redis内存中的数据保存为快照文件,恢复速度较快但不支持拉链式快照。AOF是将操作日志保存到磁盘,实时存储数据但恢复速度较慢。文章详细分析了两种机制的优缺点,帮助读者更好地理解redis的持久化存储策略。 ... [详细]
  • Ubuntu 9.04中安装谷歌Chromium浏览器及使用体验[图文]
    nsitionalENhttp:www.w3.orgTRxhtml1DTDxhtml1-transitional.dtd ... [详细]
  • 本文详细介绍了Vim编辑器中的三种模式(命令模式、末行模式和编辑模式)以及它们之间的操作区别和切换方法。Vim编辑器凭借其多种命令快捷键和高效率的操作方式,得到了广大厂商和用户的认可。对于想要高效操作文本的用户来说,了解这些模式的使用方法是必不可少的。 ... [详细]
  • mac php错误日志配置方法及错误级别修改
    本文介绍了在mac环境下配置php错误日志的方法,包括修改php.ini文件和httpd.conf文件的操作步骤。同时还介绍了如何修改错误级别,以及相应的错误级别参考链接。 ... [详细]
  • 本文介绍了在CentOS 6.4系统中更新源地址的方法,包括备份现有源文件、下载163源、修改文件名、更新列表和系统,并提供了相应的命令。 ... [详细]
  • 本文介绍了5个基本Linux命令行工具的现代化替代品,包括du、top和ncdu。这些替代品在功能上进行了改进,提高了可用性,并且适用于现代化系统。其中,ncdu是du的替代品,它提供了与du类似的结果,但在一个基于curses的交互式界面中,重点关注占用磁盘空间较多的目录。 ... [详细]
  • 进入配置文件目录:[rootlinuxidcresin-4.0.]#cdusrlocalresinconf查看都有哪些配置文件:[rootlinuxid ... [详细]
  • 1、打开etcsysconfiggrub,   #vimetcsysconfiggrub   内容如下: ... [详细]
  • Linux 服务器修改用户名
    Linux服务器修改用户名1、编辑名称vimetchostname2、保存编辑并退出wq3、重 ... [详细]
  • 找到JDK下载URL当然去官网找了。目前最新的1.8的下载URL(RPM)如下:http:download.oracle.comotn-pubjavajdk8u161-b122f3 ... [详细]
  • 对于一般的扩展包,我们一般直接pipinstallxxx即可安装,但是unrar直接安装后,发现并不能通过Python程序实现解压的功能& ... [详细]
  • 基于SSL的mysql服务器的主从架构实现说明:本文选用172.16.22.1作为主服务器,172.16.22.3作为从服务器从服务器的mysql软件版 ... [详细]
author-avatar
停止离开静悄悄
这个家伙很懒,什么也没留下!
PHP1.CN | 中国最专业的PHP中文社区 | DevBox开发工具箱 | json解析格式化 |PHP资讯 | PHP教程 | 数据库技术 | 服务器技术 | 前端开发技术 | PHP框架 | 开发工具 | 在线工具
Copyright © 1998 - 2020 PHP1.CN. All Rights Reserved | 京公网安备 11010802041100号 | 京ICP备19059560号-4 | PHP1.CN 第一PHP社区 版权所有