首页 > 代码库 > [CentOS 7系列]源码包安装

[CentOS 7系列]源码包安装

    源码包相对yum的安装方式来说,是一种很复杂的安装方式。中间涉及的每一步出错,会导致安装失败。因此在安装源码包的时候,每一步我们都要使用“echo $?”命令查看运行是否正常,确保源码包能够无误的安装上。


    源码包的安装主要分为三个步骤:

        1、./configure     配置参数

        2、make            编译

        3、make install    编译安装


下面将演示安装Apache:

[root@server01 src]# ls
httpd-2.2.32  httpd-2.2.32.tar.gz
[root@server01 src]# cd httpd-2.2.32
[root@server01 httpd-2.2.32]# ./configure --prefix=/usr/local/apache2
......
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
config.status: creating build/rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands
[root@server01 httpd-2.2.32]# echo $?        ##如果显示不正常,可能是gcc没有安装
0                                     ##返回0表示运行正常
[root@server01 httpd-2.2.32]# make
......
gcc -g -O2 -pthread    -DLINUX -D_REENTRANT -D_GNU_SOURCE    -I/usr/local/src/httpd-2.2.32/srclib/pcre -I. -I/usr/local/src/httpd-2.2.32/os/unix -I/usr/local/src/httpd-2.2.32/server/mpm/prefork -I/usr/local/src/httpd-2.2.32/modules/http -I/usr/local/src/httpd-2.2.32/modules/filters -I/usr/local/src/httpd-2.2.32/modules/proxy -I/usr/local/src/httpd-2.2.32/include -I/usr/local/src/httpd-2.2.32/modules/generators -I/usr/local/src/httpd-2.2.32/modules/mappers -I/usr/local/src/httpd-2.2.32/modules/database -I/usr/local/src/httpd-2.2.32/srclib/apr/include -I/usr/local/src/httpd-2.2.32/srclib/apr-util/include -I/usr/local/src/httpd-2.2.32/srclib/apr-util/xml/expat/lib -I/usr/local/src/httpd-2.2.32/modules/proxy/../generators -I/usr/local/src/httpd-2.2.32/modules/ssl -I/usr/local/src/httpd-2.2.32/modules/dav/main  -c /usr/local/src/httpd-2.2.32/server/buildmark.c
/usr/local/src/httpd-2.2.32/srclib/apr/libtool --silent --mode=link gcc -g -O2 -pthread        -o httpd  modules.lo buildmark.o -export-dynamic server/libmain.la modules/aaa/libmod_authn_file.la modules/aaa/libmod_authn_default.la modules/aaa/libmod_authz_host.la modules/aaa/libmod_authz_groupfile.la modules/aaa/libmod_authz_user.la modules/aaa/libmod_authz_default.la modules/aaa/libmod_auth_basic.la modules/filters/libmod_include.la modules/filters/libmod_filter.la modules/loggers/libmod_log_config.la modules/metadata/libmod_env.la modules/metadata/libmod_setenvif.la modules/metadata/libmod_version.la modules/http/libmod_http.la modules/http/libmod_mime.la modules/generators/libmod_status.la modules/generators/libmod_autoindex.la modules/generators/libmod_asis.la modules/generators/libmod_cgi.la modules/mappers/libmod_negotiation.la modules/mappers/libmod_dir.la modules/mappers/libmod_actions.la modules/mappers/libmod_userdir.la modules/mappers/libmod_alias.la modules/mappers/libmod_so.la server/mpm/prefork/libprefork.la os/unix/libos.la -lm /usr/local/src/httpd-2.2.32/srclib/pcre/libpcre.la /usr/local/src/httpd-2.2.32/srclib/apr-util/libaprutil-1.la /usr/local/src/httpd-2.2.32/srclib/apr-util/xml/expat/libexpat.la /usr/local/src/httpd-2.2.32/srclib/apr/libapr-1.la -lrt -lcrypt -lpthread -ldl
make[1]: 离开目录“/usr/local/src/httpd-2.2.32”
[root@server01 httpd-2.2.32]# echo $?
0
[root@server01 httpd-2.2.32]# make install
......
Installing icons
mkdir /usr/local/apache2/icons
mkdir /usr/local/apache2/logs
Installing CGIs
mkdir /usr/local/apache2/cgi-bin
Installing header files
Installing build system files
Installing man pages and online manual
mkdir /usr/local/apache2/man
mkdir /usr/local/apache2/man/man1
mkdir /usr/local/apache2/man/man8
mkdir /usr/local/apache2/manual
make[1]: 离开目录“/usr/local/src/httpd-2.2.32”
[root@server01 httpd-2.2.32]# echo $?
0
[root@server01 httpd-2.2.32]# ls /usr/local/apache2
bin  build  cgi-bin  conf  error  htdocs  icons  include  lib  logs  man  manual  modules

源码包的卸载就是删除安装文件。


本文出自 “乱码时代” 博客,请务必保留此出处http://juispan.blog.51cto.com/943137/1942512

[CentOS 7系列]源码包安装