源碼安裝linux軟件

咱們如今以源代碼方式安裝apache httpdapache

首先咱們下載apache httpdtar.gz的源碼安裝包,在http://mirror.bjtu.edu.cn/apache//httpd/httpd-2.2.25.tar.gz/下載less

解壓ide

[root@station129 tmp]# tar xf httpd-2.2.25.tar.bz2 工具

編譯安裝以前,首先安裝3個開發包ui

[root@station129httpd-2.2.25]# yum groupinstall "Desktop Platform Development" "ServerPlatform Development" 「Development tools」spa

進入到安裝目錄下,首先閱讀README文件日誌

而後檢查環境環境(編譯器,頭文件,庫文件)而且設置編譯的配置code

首先查看幫助文檔,看都支持哪些參數orm

[root@station129 httpd-2.2.25]# ./configure --helpblog

這裏咱們看幾個比較經常使用的參數之後供你們編譯的時候使用

--bindir=DIRuser  executables [EPREFIX/bin]

二進制文件安裝位置

--libdir=DIRobject  code libraries [EPREFIX/lib 

指定庫文件安裝位置

--includedir=DIRC header files [PREFIX/include] 

頭文件安裝位置

--mandir=DIRman documentation [DATAROOTDIR/man] man

配置文件所在位置

--prefix=PREFIXinstall architecture-independent files in  PREFIX

默認安裝包安裝的位置

--sysconfdir=DIRread-only single-machine data  [PREFIX/etc] 

配置文件安裝位置

咱們來正式的安裝apache httpd 

爲了解釋清楚庫文件的配置,MAN,頭文件的配置,咱們將再也不次指定,待會手動修改

[root@station129httpd-2.2.25]# ./configure --prefix=/usr/local/apache --enable-so--enable-rewrite 

這裏咱們隊httpd 啓用了動態連接庫和URL重寫功能

configure 腳本結合 makefile.in文件生成makefile文件

automake是一種生成makefile.in的工具

autoconf是一種生成configure的文件

咱們還能夠查看咱們剛纔日誌

[root@station129 httpd-2.2.25]# less config.log 查看配置的日誌文件

接下來咱們完成編譯,make工具找到makefile文件完成編譯

咱們還能夠查看makefile文件

[root@station129 httpd-2.2.25]# make

make 其實就是包含了編譯連接等功能

編譯好了就能夠安裝了

[root@station129 httpd-2.2.25]# make install

安裝完成

咱們來查看安裝目錄

[root@station129 apache]# ls

binbuildcgi-binconferrorhtdocsiconsincludeliblogsmanmanualmodules

這裏面默認安裝的着配置文件,頭文件,庫文件,man 配置手冊

若是一個程序找不到庫文件,他會報錯,咱們制定庫文件的位置

[root@station129 conf]# cat /etc/ld.so.conf.d/apache.conf

/usr/local/apache/lib

查看 PATH 路徑,咱們發現不包含咱們安裝後可執行文件的位置,咱們添加進去

[root@station129 apache]# echo $PATH

/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/binpro

/etc/profile.d/中添加一個文件

[root@station129 profile.d]# cat /etc/profile.d/apache.sh

export PATH=/usr/local/apache/bin:$PATH

使環境變量生效:

[root@station129 profile.d]# . /etc/profile.d/apache.sh

編輯man配置的文件,添加一行

MANPATH /usr/local/apache/man

系統找到頭文件,建立軟鏈接

[root@station129 include]# ln -s/usr/local/apache/include/ /usr/include/

啓動apachectl而且查看

[root@station129 profile.d]# apachectl start

[root@station129 profile.d]# hash

hits        command

3        /usr/local/apache/bin/apachectl

咱們來看咱們的成果

Apachectl工做正常

相關文章
相關標籤/搜索