很多人都不知道包管理器的概念,首先我们要了解软件是如何运行的,我们这里介绍C程序如何实现从代码到执行程序的过程。
程序源代码--> 预处理--> 编译--> 汇编--> 链接 -->执行
程序源码预处理后进行编译,编译成目标代码,然后汇编成二进制代码,最后将源程序所用的库代码与目标代码合并,最终形成可执行的二进制代码
但是一般情况下一个程序不止一个二进制程序,可能存在配置文件,帮助文档等相应文件,这时候我们就需要一个打包软件将程序包各组件打包,打个比方,打包软件可以根据别人通过源码包预先定义好的配置将解压后执行文件自动放到/bin,配置文件自动放到/etc/,帮助文档自动放到/usr/share/man...在Linux各发行版本中有很多打包软件可以供我们使用。
例如:
debian系:包名deb,管理工具dpkg
redhat系:包名rpm,管理工具rpm
...
本文主要介绍rpm
众所周知,组合小程序完成复杂任务是Linux哲学思想之一,再加上Linux上大部分软件就是自由软件,可以避免“重复制造轮子”这种事情发生。但是这也会引发很多问题、比如,A软件需要B和C才能运行,如果我们不看文档可能不知道A软件需要B和C软件才能运行,所以在安装A软件的时候就非常的麻烦,早期Linux用户就深受这个问题的困扰,安装一个软件需要很多时间。后来,就有很多公司或社区开发了相应包管理工具,可以通过包管理工具得知安装软件所需的软件包。
RPM(Redhat Package Manager/ RPM is Package Manager)可以将编译好的应用程序各组成文件(二进制程序、帮助文档、配置文件),从而方便快捷实现程序包的安装、卸载、查询、升级和校验等操作。
1、程序包组成清单(每个包独有)
文件清单
安装或卸载文件时运行的脚本
2、数据库(公共)
程序包名称及版本
依赖关系
功能说明
安装生产的各文件的文件路径及校验码信息
查看rpm数据库文件
对于一个运维人员来说,服务器的安全是重中之重,不可靠的软件包可能成为我们的安全隐患,那么我们应该到哪里去下可靠的软件包呢?
1、软件官网
软件的官方站点提供的软件肯定是最可靠的,可以下载源代码自行编译安装
2、发行版本官方镜像站点
发行版本的官方镜像站点中提供的软件包绝对是可靠的
3、如果是RHEL系,则去EPEL
EPEL(Extras Packages Enterprise Linux)项目是由Fedora发起的,EPEL中包含众多优秀可靠的软件,点击进入EPEL站点
4、搜索,pkgs.org,rpmfind.net
http://pkgs.org 这个网站可以搜索各大发行版中的软件,非常好用,软件包也很全
5、国内镜像站点
国内有许多公司都做了镜像站,稍后我们会教大家通过yum来实现将它们作为我们的软件仓库。
rpm命令用法
安装:
rpm {-i|--install} [install-options] PACKAGE_FILE ... -v: verbose -vv: 更多信息 -h: 以#显示程序包管理执行进度;每个#表示2%的进度 rpm -ivh PACKAGE_FILE ... [install-options] --test: 测试安装,但不真正执行安装过程;dry run模式; --nodeps:忽略依赖关系; --replacepkgs: 重新安装; --nosignature: 不检查来源合法性; --nodigest:不检查包完整性; --noscipts:不执行程序包脚本片断; %pre: 安装前脚本; --nopre %post: 安装后脚本; --nopost %preun: 卸载前脚本; --nopreun %postun: 卸载后脚本; --nopostun
升级
rpm {-U|--upgrade} [install-options] PACKAGE_FILE ... rpm {-F|--freshen} [install-options] PACKAGE_FILE ... upgrage:安装有旧版程序包,则“升级”;如果不存在旧版程序包,则“安装”; freeshen:安装有旧版程序包,则“升级”;如果不存在旧版程序包,则不执行升级操作; rpm -Uvh PACKAGE_FILE ... rpm -Fvh PACKAGE_FILE ... --oldpackage:降级; --force: 强行升级; 注意:(1) 不要对内核做升级操作;Linux支持多内核版本并存,因此,对直接安装新版本内核; (2) 如果原程序包的配置文件安装后曾被修改,长级时,新版本的提供的同一个配置文件并不会直接覆盖老版本的配置文件,而把新版本的文件重命名(FILENAME.rpmnew)后保留;
查询
rpm {-q|--query} [select-options] [query-options] [select-options] -a: 所有包 -f: 查看指定的文件由哪个程序包安装生成 -p /PATH/TO/PACKAGE_FILE:针对尚未安装的程序包文件做查询操作; --whatprovides CAPABILITY:查询指定的CAPABILITY由哪个包所提供; --whatrequires CAPABILITY:查询指定的CAPABILITY被哪个包所依赖; [query-options] --changelog:查询rpm包的changlog -c: 查询程序的配置文件 -d: 查询程序的文档 -i: information -l: 查看指定的程序包安装后生成的所有文件; --scripts:程序包自带的脚本片断 -R: 查询指定的程序包所依赖的CAPABILITY; --provides: 列出指定程序包所提供的CAPABILITY; 用法: -qi PACKAGE, -qf FILE, -qc PACKAGE, -ql PACKAGE, -qd PACKAGE -qpi PACKAGE_FILE, -qpl PACKAGE_FILE, ... -qa
卸载
rpm {-e|--erase} [--allmatches] [--nodeps] [--noscripts] [--notriggers] [--test] PACKAGE_NAME ...
校验
rpm {-V|--verify} [select-options] [verify-options] S file Size differs M Mode differs (includes permissions and file type) 5 digest (formerly MD5 sum) differs D Device major/minor number mismatch L readLink(2) path mismatch U User ownership differs G Group ownership differs T mTime differs P caPabilities differ 包来源合法性验正及完整性验正: 完整性验正:SHA256 来源合法性验正:RSA 公钥加密: 对称加密:加密、解密使用同一密钥; 非对称加密:密钥是成对儿的, public key: 公钥,公开所有人 secret key: 私钥, 不能公开 导入所需要公钥: rpm --import /PATH/FROM/GPG-PUBKEY-FILE CentOS 7发行版光盘提供的密钥文件:RPM-GPG-KEY-CentOS-7
数据库重建
rpm {--initdb|--rebuilddb} initdb: 初始化 如果事先不存在数据库,则新建之;否则,不执行任何操作; rebuilddb:重建 无论当前存在与否,直接重新创建数据库;
很多人使用rpm安装软件包时、需要解决很多依赖关系,rpm包管理器既然可以获取软件之间的依赖关系为什么不能自动解决呢?我们这里就需要使用YUM让软件安装时自动解决依赖关系。
什么是YUM?
YUM(Yellowdog Update Modiflier),yum客户端通过文件服务器获取软件仓库的元数据来分析软件仓库有哪些软件、相互的依赖关系。
yum定义仓库
yum的配置文件: /etc/yum.conf #为所有仓库提供公共配置 /etc/yum.repos.d/*.repo #为仓库的指向提供配置信息 vim /etc/yum.repos.d/repoistory.repo [repositoryID] name=Some name for this repository baseurl=url://path/to/repository mirrorlist: enable={1|0} gpgcheck={1|0} repo_gpgcheck={1|0} gpgkey=URL enablegroups={1|0} failovermethod={roundrobin | priority} cost=# 默认为1000
yum相关命令用法
yum [options] [command] [package...] 显示仓库列表 yum repolist [all|enabled|disabled] #显示repository, 第一次使用会从服务器上下载元数据 显示程序包 yum list [all | glob_exp1] [glob_exp2] [...] yum list [available | installed | updates] [glob_exp1] [...] 安装程序包 install package1 [...] reinstall package1 [...] 升级程序包 update [package1] [...] downgrade [package1] [...] #降级安装 检查可用升级: check-update 卸载程序包 remove | erase package1 [...] 查看程序的information info [...] 查看指定的特性是由哪个程序包提供 provides| whatprovieds feature [...] 清理本地缓存: clean [ packages | metadata | expire-cache | rpmdb | plugins | all] 构建缓存: makecache 以指定关键字搜索程序包名及summary信息 search string [...] 查看指定包依赖关系 deplist package1 [...] 查看yum事务历史 history [info | list | packages-list | packages-info | summary | addon-info | redo | undo | stat...] 安装及升级本地程序包: localinstall rpmfile1 localupdate rpmfile1 包组管理的相关命令: * groupinstall group1 [group2] [...] * groupupdate group1 [group2] [...] * grouplist [hidden] [groupwildcard] [...] * groupremove group1 [group2] [...] * groupinfo group1 [...] yum的命令行选项: --nogpgcheck:禁止进行gpg check -y:自动回答为"yes" -q:静默模式 --disablerepo=repoid 临时禁用此处指定的repo --enablerepo=repoid 临时启动此处启用的repo --noplugins:禁用所有插件
简单的构建一个本地仓库
尝试安装软件
repo文件中可用的变量
yum的repo配置文件中可用的变量: $releasever:当前OS发行版本的主板编号 $arch:平台 $basearch:基础平台 #YUM0-$YUM9
使用createrepo针对指定软件生成repodata
C源代码编译安装三步骤:
1、./configure
(1) 通过选项传递参数,指定启用特性、安装路径等,执行时会参考用户的指定以及Makefile.in文件生成makefile文件
(2) 检查依赖到的外部环境
2、make
根据makefile文件,构建应用程序
3、make install
执行对应脚本,将对应文件复制到相应路径中
编译安装前的建议先看INSTALL和REDME文件,各软件编译安装方式可能不同
获取源码包:
1、官方站点
apache.org
mariadb.org
...
2、代码托管
sourceForge
Github.com
code.google.com
...
编译C源代码程序:
前提:提供开发工具及开发环境
开发工具:make、gcc等
开发环境:标准库、头文件等
在RHEL系的系统中可以通过包组的形式直接安装开发环境和开发工具
CentOS 6:yum groupinstall -y "Development Tools" "Server Paltform Development "
我们现在编译安装httpd-2.2,可以通过http://httpd.apache.org 下载源码包
[root@server2 ~]# tar xf httpd-2.2.25.tar.bz2 [root@server2 ~]# yum groupinstall "Development Tools" "Server Paltform Development" -y Loaded plugins: fastestmirror, refresh-packagekit, security Setting up Group Process Loading mirror speeds from cached hostfile Package 1:make-3.81-20.el6.x86_64 already installed and latest version Package patch-2.6-6.el6.x86_64 already installed and latest version Package 1:pkgconfig-0.23-9.1.el6.x86_64 already installed and latest version Package gettext-0.17-18.el6.x86_64 already installed and latest version Package binutils-2.20.51.0.2-5.43.el6.x86_64 already installed and latest version Package elfutils-0.161-3.el6.x86_64 already installed and latest version Package cvs-1.11.23-16.el6.x86_64 already installed and latest version Warning: Group Server Paltform Development does not exist. Resolving Dependencies --> Running transaction check ---> Package autoconf.noarch 0:2.63-5.1.el6 will be installed ---> Package automake.noarch 0:1.11.1-4.el6 will be installed ---> Package bison.x86_64 0:2.4.1-5.el6 will be installed ---> Package byacc.x86_64 0:1.9.20070509-7.el6 will be installed ---> Package cscope.x86_64 0:15.6-6.el6 will be installed ---> Package ctags.x86_64 0:5.8-2.el6 will be installed ---> Package diffstat.x86_64 0:1.51-2.el6 will be installed ---> Package doxygen.x86_64 1:1.6.1-6.el6 will be installed ---> Package flex.x86_64 0:2.5.35-9.el6 will be installed ---> Package gcc.x86_64 0:4.4.7-16.el6 will be installed --> Processing Dependency: cpp = 4.4.7-16.el6 for package: gcc-4.4.7-16.el6.x86_64 --> Processing Dependency: cloog-ppl >= 0.15 for package: gcc-4.4.7-16.el6.x86_64 ---> Package gcc-c++.x86_64 0:4.4.7-16.el6 will be installed --> Processing Dependency: libstdc++-devel = 4.4.7-16.el6 for package: gcc-c++-4.4.7-16.el6.x86_64 --> Processing Dependency: libmpfr.so.1()(64bit) for package: gcc-c++-4.4.7-16.el6.x86_64 ---> Package gcc-gfortran.x86_64 0:4.4.7-16.el6 will be installed --> Processing Dependency: libgfortran = 4.4.7-16.el6 for package: gcc-gfortran-4.4.7-16.el6.x86_64 --> Processing Dependency: libgfortran.so.3()(64bit) for package: gcc-gfortran-4.4.7-16.el6.x86_64 ---> Package git.x86_64 0:1.7.1-3.el6_4.1 will be installed --> Processing Dependency: perl-Git = 1.7.1-3.el6_4.1 for package: git-1.7.1-3.el6_4.1.x86_64 中间省略 Installed: autoconf.noarch 0:2.63-5.1.el6 automake.noarch 0:1.11.1-4.el6 bison.x86_64 0:2.4.1-5.el6 byacc.x86_64 0:1.9.20070509-7.el6 cscope.x86_64 0:15.6-6.el6 ctags.x86_64 0:5.8-2.el6 diffstat.x86_64 0:1.51-2.el6 doxygen.x86_64 1:1.6.1-6.el6 flex.x86_64 0:2.5.35-9.el6 gcc.x86_64 0:4.4.7-16.el6 gcc-c++.x86_64 0:4.4.7-16.el6 gcc-gfortran.x86_64 0:4.4.7-16.el6 git.x86_64 0:1.7.1-3.el6_4.1 indent.x86_64 0:2.2.10-7.el6 intltool.noarch 0:0.41.0-1.1.el6 libtool.x86_64 0:2.2.6-15.5.el6 patchutils.x86_64 0:0.3.1-3.1.el6 rcs.x86_64 0:5.7-37.el6 redhat-rpm-config.noarch 0:9.0.3-44.el6.centos rpm-build.x86_64 0:4.8.0-47.el6 subversion.x86_64 0:1.6.11-14.el6 swig.x86_64 0:1.3.40-6.el6 systemtap.x86_64 0:2.7-2.el6 Dependency Installed: cloog-ppl.x86_64 0:0.15.7-1.2.el6 cpp.x86_64 0:4.4.7-16.el6 gettext-devel.x86_64 0:0.17-18.el6 gettext-libs.x86_64 0:0.17-18.el6 kernel-devel.x86_64 0:2.6.32-573.el6 libgcj.x86_64 0:4.4.7-16.el6 libgfortran.x86_64 0:4.4.7-16.el6 libstdc++-devel.x86_64 0:4.4.7-16.el6 mpfr.x86_64 0:2.4.1-6.el6 perl-Compress-Raw-Zlib.x86_64 1:2.021-141.el6 perl-Compress-Zlib.x86_64 0:2.021-141.el6 perl-Error.noarch 1:0.17015-4.el6 perl-Git.noarch 0:1.7.1-3.el6_4.1 perl-HTML-Parser.x86_64 0:3.64-2.el6 perl-HTML-Tagset.noarch 0:3.20-4.el6 perl-IO-Compress-Base.x86_64 0:2.021-141.el6 perl-IO-Compress-Zlib.x86_64 0:2.021-141.el6 perl-URI.noarch 0:1.40-2.el6 perl-XML-Parser.x86_64 0:2.36-7.el6 perl-libwww-perl.noarch 0:5.833-2.el6 ppl.x86_64 0:0.10.2-11.el6 systemtap-client.x86_64 0:2.7-2.el6 systemtap-devel.x86_64 0:2.7-2.el6 Complete! [root@server2 httpd-2.2.25]# ./configure --prefix=/usr/src/apache2 --sysconfdir=/etc/apache2 #设置软件主目录为/usr/src/apache2,配置文件路径为/etc/apache2 checking for library containing socket... none required checking for library containing crypt... -lcrypt checking for main in -ltruerand... no checking for library containing modf... none required Checking for Threads... checking pthread.h usability... yes checking pthread.h presence... yes checking for pthread.h... yes checking for CFLAGS needed for pthreads... -pthread adding "-pthread" to CFLAGS checking for LIBS needed for pthreads... -lpthread adding "-lpthread" to LIBS checking for pthread.h... (cached) yes checking whether pthread_getspecific takes two arguments... no checking whether pthread_attr_getdetachstate takes one argument... no checking for recursive mutex support... yes checking for pthread_key_delete... yes checking for pthread_rwlock_init... yes checking for pthread_attr_setguardsize... yes checking for pthread_yield... yes checking for pthread_rwlock_t... yes APR will use threads checking for readdir in -lc_r... no checking for gethostbyname in -lc_r... no checking for gethostbyaddr in -lc_r... no checking for getservbyname in -lc_r... no checking for gethostbyname_r... yes checking for getpwuid_r... yes checking for getgrnam_r... yes checking for getgrgid_r... yes 中间省略 Checking for Shared Memory Support... checking for library containing shm_open... -lrt checking for sys/types.h... (cached) yes checking sys/mman.h usability... yes checking sys/mman.h presence... yes checking for sys/mman.h... yes checking sys/ipc.h usability... yes checking sys/ipc.h presence... yes checking for sys/ipc.h... yes checking sys/mutex.h usability... no checking sys/mutex.h presence... no checking for sys/mutex.h... no checking sys/shm.h usability... yes checking sys/shm.h presence... yes checking for sys/shm.h... yes checking sys/file.h usability... yes checking sys/file.h presence... yes checking for sys/file.h... yes checking kernel/OS.h usability... no checking kernel/OS.h presence... no checking for kernel/OS.h... no checking os2.h usability... no checking os2.h presence... no checking for os2.h... nog docs/conf/extra/httpd-dav.conf config.status: creating docs/conf/extra/httpd-default.conf config.status: creating docs/conf/extra/httpd-info.conf config.status: creating docs/conf/extra/httpd-languages.conf config.status: creating docs/conf/extra/httpd-manual.conf config.status: creating docs/conf/extra/httpd-mpm.conf config.status: creating docs/conf/extra/httpd-multilang-errordoc.conf config.status: creating docs/conf/extra/httpd-ssl.conf config.status: creating docs/conf/extra/httpd-userdir.conf config.status: creating docs/conf/extra/httpd-vhosts.conf config.status: creating include/ap_config_layout.h config.status: creating support/apxs config.status: creating support/apachectl config.status: creating support/dbmmanage config.status: creating support/envvars-std config.status: creating support/log_server_status config.status: creating support/logresolve.pl config.status: creating support/phf_abuse_log.cgi config.status: creating support/split-logfile [root@server2 httpd-2.2.25]# make && make install #开始编译 Making install in srclib make[1]: Entering directory `/root/httpd-2.2.25/srclib‘ Making install in apr make[2]: Entering directory `/root/httpd-2.2.25/srclib/apr‘ /bin/sh /root/httpd-2.2.25/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I./include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include -o passwd/apr_getpass.lo -c passwd/apr_getpass.c && touch passwd/apr_getpass.lo/bin/sh /root/httpd-2.2.25/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I./include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include -o strings/apr_cpystrn.lo -c strings/apr_cpystrn.c && touch strings/apr_cpystrn.lo/bin/sh /root/httpd-2.2.25/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I./include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include -o strings/apr_fnmatch.lo -c strings/apr_fnmatch.c && touch strings/apr_fnmatch.lo/bin/sh /root/httpd-2.2.25/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I./include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include -o strings/apr_snprintf.lo -c strings/apr_snprintf.c && touch strings/apr_snprintf.lo/bin/sh /root/httpd-2.2.25/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I./include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include -o strings/apr_strings.lo -c strings/apr_strings.c && touch strings/apr_strings.lo/bin/sh /root/httpd-2.2.25/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I./include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include -o strings/apr_strnatcmp.lo -c strings/apr_strnatcmp.c && touch strings/apr_strnatcmp.lo/bin/sh /root/httpd-2.2.25/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I./include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include -o strings/apr_strtok.lo -c strings/apr_strtok.c && touch strings/apr_strtok.lo/bin/sh /root/httpd-2.2.25/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I./include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include -o tables/apr_hash.lo -c tables/apr_hash.c && touch tables/apr_hash.lo/bin/sh /root/httpd-2.2.25/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I./include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include -o tables/apr_tables.lo -c tables/apr_tables.c && touch tables/apr_tables.lo/bin/sh /root/httpd-2.2.25/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I./include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include -o atomic/unix/builtins.lo -c atomic/unix/builtins.c && touch atomic/unix/builtins.lo/bin/sh /root/httpd-2.2.25/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I./include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include -o atomic/unix/ia32.lo -c atomic/unix/ia32.c && touch atomic/unix/ia32.lo/bin/sh /root/httpd-2.2.25/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I./include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include -o atomic/unix/mutex.lo -c atomic/unix/mutex.c && touch atomic/unix/mutex.lo/bin/sh /root/httpd-2.2.25/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_SOURCE -I./include -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I./include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include/arch/unix -I/root/httpd-2.2.25/srclib/apr/include -o atomic/unix/ppc.lo -c atomic/unix/ppc.c && touch atomic/unix/ppc.lo/bin/sh /root/httpd-2.2.25/srclib/apr/libtool --silent --mode=compile gcc -g -O2 -pthread -DHAVE_CONFIG_H -DLINUX -D_REENTRANT -D_GNU_S 省略 编译完成后尝试启动httpd [root@server2 httpd-2.2.25]# /usr/src/apache2/bin/apachectl start httpd: Could not reliably determine the server‘s fully qualified domain name, using server2.example.com for ServerName #虽然报错,但是已经启动 [root@server2 httpd-2.2.25]# netstat -tan Active Internet connections (servers and established) Proto Recv-Q Send-Q Local Address Foreign Address State tcp 0 0 0.0.0.0:40417 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:111 0.0.0.0:* LISTEN tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:631 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN tcp 0 0 127.0.0.1:6010 0.0.0.0:* LISTEN tcp 0 0 192.168.192.129:22 192.168.192.1:5040 ESTABLISHED tcp 0 0 :::111 :::* LISTEN tcp 0 0 :::80 :::* LISTEN #80端口已监听 tcp 0 0 :::34229 :::* LISTEN tcp 0 0 :::22 :::* LISTEN tcp 0 0 ::1:631 :::* LISTEN tcp 0 0 ::1:25 :::* LISTEN tcp 0 0 ::1:6010 :::* LISTEN [root@server2 httpd-2.2.25]#
验证httpd服务
这篇文章思考的地方不多,大部分只是叙述过程,让大家知道如何使用各种姿势安装软件
本文出自 “The AnyISalIn blog” 博客,请务必保留此出处http://anyisalin.blog.51cto.com/10917514/1748879
原文地址:http://anyisalin.blog.51cto.com/10917514/1748879