欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

詳解apache編譯安裝httpd-2.4.54及三種風(fēng)格的init程序特點(diǎn)和區(qū)別

 更新時間:2022年07月13日 15:00:50   作者:涂山布  
這篇文章主要介紹了apache編譯安裝httpd-2.4.54以及三種風(fēng)格的init程序特點(diǎn)和區(qū)別?,通過編譯安裝httpd來深入理解源碼包安裝(httpd-2.4.54),本文給大家介紹的非常詳細(xì),需要的朋友可以參考下

源碼包編譯實(shí)例

下面通過編譯安裝httpd來深入理解源碼包安裝(httpd-2.4.54)

下載編譯工具,httpd以及其兩個依賴包的源碼包

//源碼包建議到官方網(wǎng)站下載

[root@lnh ~]# mkdir xbz
[root@lnh ~]# cd xbz/
[root@lnh xbz]# dnf -y install gcc gcc-c++ make wget
[root@lnh xbz]# wget https://mirrors.aliyun.com/apache/httpd/httpd-2.4.54.tar.gz
[root@lnh xbz]# wget https://mirrors.aliyun.com/apache/apr/apr-1.7.0.tar.gz
[root@lnh xbz]# wget https://mirrors.aliyun.com/apache/apr/apr-util-1.6.1.tar.gz
[root@lnh xbz]# ls
apr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz  httpd-2.4.54.tar.gz

安裝apr

[root@lnh xbz]# ls
apr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz  httpd-2.4.54.tar.gz
[root@lnh xbz]# tar -xf apr-1.7.0.tar.gz 
[root@lnh xbz]# ls 
apr-1.7.0  apr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz  httpd-2.4.54.tar.gz
//將apr解壓到當(dāng)前目錄
[root@lnh xbz]# cd apr-1.7.0/
[root@lnh apr-1.7.0]# ls
apr-config.in  build-outputs.mk  helpers       misc           strings
apr.dep        CHANGES           include       mmap           support
apr.dsp        CMakeLists.txt    libapr.dep    network_io     tables
apr.dsw        config.layout     libapr.dsp    NOTICE         test
apr.mak        configure         libapr.mak    NWGNUmakefile  threadproc
apr.pc.in      configure.in      libapr.rc     passwd         time
apr.spec       docs              LICENSE       poll           tools
atomic         dso               locks         random         user
build          emacs-mode        Makefile.in   README
build.conf     encoding          Makefile.win  README.cmake
buildconf      file_io           memory        shmem
//進(jìn)入這個源碼包可以看見里面被解壓出來的東西
[root@lnh apr-1.7.0]# ./configure --prefix=/usr/local/src/apr
...
configure: creating ./config.status
config.status: creating Makefile
config.status: creating include/apr.h
config.status: creating build/apr_rules.mk
config.status: creating build/pkg/pkginfo
config.status: creating apr-1-config
config.status: creating apr.pc
config.status: creating test/Makefile
config.status: creating test/internal/Makefile
config.status: creating include/arch/unix/apr_private.h
config.status: executing libtool commands
rm: cannot remove 'libtoolT': No such file or directory
config.status: executing default commands
//生成Makefile
一般常用的有 --prefix=PREFIX 這個選項(xiàng)的意思是定義軟件包安裝到哪里
建議,源碼包都是安裝在/opt/目錄下或者/usr/local/src目錄下面
[root@lnh apr-1.7.0]# make
...
gcc -E -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I./include -I/root/xbz/apr-1.7.0/include/arch/unix -I./include/arch/unix -I/root/xbz/apr-1.7.0/include/arch/unix -I/root/xbz/apr-1.7.0/include -I/root/xbz/apr-1.7.0/include/private -I/root/xbz/apr-1.7.0/include/private  export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$/d' >> apr.exp
sed 's,^\(location=\).*$,\1installed,' < apr-1-config > apr-config.out
sed -e 's,^\(apr_build.*=\).*$,\1/usr/local/src/apr/build-1,' -e 's,^\(top_build.*=\).*$,\1/usr/local/src/apr/build-1,' < build/apr_rules.mk > build/apr_rules.out
make[1]: Leaving directory '/root/xbz/apr-1.7.0'
//編譯生成Makefile,此處雖然出現(xiàn)了make[1]: Leaving directory '/root/xbz/apr-1.7.0',但是沒關(guān)系可以繼續(xù)進(jìn)行下一步安裝
[root@lnh apr-1.7.0]# make install
...
/usr/bin/install -c -m 755 /root/xbz/apr-1.7.0/build/mkdir.sh /usr/local/src/apr/build-1
for f in make_exports.awk make_var_export.awk; do \
    /usr/bin/install -c -m 644 /root/xbz/apr-1.7.0/build/${f} /usr/local/src/apr/build-1; \
done
/usr/bin/install -c -m 644 build/apr_rules.out /usr/local/src/apr/build-1/apr_rules.mk
/usr/bin/install -c -m 755 apr-config.out /usr/local/src/apr/bin/apr-1-config
//進(jìn)行安裝
[root@lnh apr-1.7.0]# cd /usr/local/src/apr/
[root@lnh apr]# ls
bin  build-1  include  lib
//進(jìn)入apr的路徑進(jìn)行查看,默認(rèn)情況下,系統(tǒng)搜索庫文件的路徑只有/lib,/usr/lib,我們需要進(jìn)行修改在/etc/ld.so.conf.d/中創(chuàng)建以.conf為后綴名的文件,而后把要增添的路徑直接寫至此文件中。此時庫文件增添的搜索路徑重啟后有效,若要使用增添的路徑立即生效則要使用ldconfig命令
[root@lnh apr]# cd /etc/ld.so.conf.d/
[root@lnh ld.so.conf.d]# echo /usr/local/src/apr/lib/ >apr.conf
[root@lnh ld.so.conf.d]# cd -
/usr/local/src/apr
//切換到前一個工作目錄
[root@lnh apr]# ldconfig 
//使命令生效
[root@lnh apr]# ln -s /usr/local/src/apr/include/ /usr/include/apr
[root@lnh apr]# ll /usr/include/apr/
total 4
drwxr-xr-x. 2 root root 4096 Jul 12 20:18 apr-1
lrwxrwxrwx. 1 root root   27 Jul 12 20:44 include -> /usr/local/src/apr/include/
將頭文件軟鏈接到/usr/include目錄下

折疊

安裝apr-util

[root@lnh xbz]# dnf -y install expat-devel libxml2-devel pcre-devel
//需要先安裝這個依賴
[root@lnh xbz]# ls
apr-1.7.0  apr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz  httpd-2.4.54.tar.gz
[root@lnh xbz]# tar -xf apr-util-1.6.1.tar.gz 
[root@lnh xbz]# ls
apr-1.7.0         apr-util-1.6.1         httpd-2.4.54.tar.gz
apr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz
//解壓到當(dāng)前目錄
[root@lnh xbz]# cd apr-util-1.6.1/
[root@lnh apr-util-1.6.1]# ls
aprutil.dep       CHANGES            include         NWGNUmakefile
aprutil.dsp       CMakeLists.txt     ldap            README
aprutil.dsw       config.layout      libaprutil.dep  README.cmake
aprutil.mak       configure          libaprutil.dsp  README.FREETDS
apr-util.pc.in    configure.in       libaprutil.mak  redis
apr-util.spec     crypto             libaprutil.rc   renames_pending
apu-config.in     dbd                LICENSE         strmatch
buckets           dbm                Makefile.in     test
build             docs               Makefile.win    uri
build.conf        encoding           memcache        xlate
buildconf         export_vars.sh.in  misc            xml
build-outputs.mk  hooks              NOTICE
//進(jìn)入源碼包查看被解壓出來的東西
[root@lnh apr-util-1.6.1]# ./configure --prefix=/usr/local/src/apr-util --with-apr=/usr/local/src/apr
...
configure: creating ./config.status
config.status: creating Makefile
config.status: creating export_vars.sh
config.status: creating build/pkg/pkginfo
config.status: creating apr-util.pc
config.status: creating apu-1-config
config.status: creating include/private/apu_select_dbm.h
config.status: creating include/apr_ldap.h
config.status: creating include/apu.h
config.status: creating include/apu_want.h
config.status: creating test/Makefile
config.status: creating include/private/apu_config.h
config.status: executing default commands
//生成Makefile文件,需要伴隨著上一個指定的依賴
[root@lnh apr-util-1.6.1]# make
...
gcc -E -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/root/xbz/apr-util-1.6.1/include -I/root/xbz/apr-util-1.6.1/include/private  -I/usr/local/src/apr/include/apr-1    exports.c | grep "ap_hack_" | sed -e 's/^.*[)]\(.*\);$/\1/' >> aprutil.exp
gcc -E -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/root/xbz/apr-util-1.6.1/include -I/root/xbz/apr-util-1.6.1/include/private  -I/usr/local/src/apr/include/apr-1    export_vars.c | sed -e 's/^\#[^!]*//' | sed -e '/^$/d' >> aprutil.exp
sed 's,^\(location=\).*$,\1installed,' < apu-1-config > apu-config.out
make[1]: Leaving directory '/root/xbz/apr-util-1.6.1'
//編譯生成的Makefile文件,出現(xiàn)make[1]: Leaving directory '/root/xbz/apr-util-1.6.1'這個沒有關(guān)系可以繼續(xù)進(jìn)行下一步安裝
[root@lnh apr-util-1.6.1]# make install
...
See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
/usr/bin/install -c -m 644 aprutil.exp /usr/local/src/apr-util/lib
/usr/bin/install -c -m 755 apu-config.out /usr/local/src/apr-util/bin/apu-1-config
//進(jìn)行安裝
[root@lnh apr-util-1.6.1]# cd /usr/local/src/apr-util/
[root@lnh apr-util]# ls
bin  include  lib
//切換到apr-util安裝目錄進(jìn)行查看,默認(rèn)情況下,系統(tǒng)搜索庫文件的路徑只有/lib,/usr/lib,我們需要進(jìn)行修改在/etc/ld.so.conf.d/中創(chuàng)建以.conf為后綴名的文件,而后把要增添的路徑直接寫至此文件中。此時庫文件增添的搜索路徑重啟后有效,若要使用增添的路徑立即生效則要使用ldconfig命令
[root@lnh apr-util]# cd /etc/ld.so.conf.d/
[root@lnh ld.so.conf.d]# echo /usr/local/src/apr-util/ >apr-util.conf 
[root@lnh ld.so.conf.d]# cd -
/usr/local/src/apr-util
//切換到上一個工作目錄
[root@lnh apr-util]# ln -s /usr/local/src/apr-util/include/ /usr/include/apr
-util
//將頭文件軟鏈接到/usr/include目錄下

折疊

安裝httpd

[root@lnh xbz]# tar -xf httpd-2.4.54.tar.gz 
[root@lnh xbz]# ls
apr-1.7.0         apr-util-1.6.1         httpd-2.4.54
apr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz  httpd-2.4.54.tar.gz
//解壓到當(dāng)前目錄
[root@lnh xbz]# cd httpd-2.4.54/
[root@lnh httpd-2.4.54]# ls
ABOUT_APACHE     CMakeLists.txt  InstallBin.dsp  README
acinclude.m4     config.layout   LAYOUT          README.CHANGES
Apache-apr2.dsw  configure       libhttpd.dep    README.cmake
Apache.dsw       configure.in    libhttpd.dsp    README.platforms
apache_probes.d  docs            libhttpd.mak    ROADMAP
ap.d             emacs-style     LICENSE         server
build            httpd.dep       Makefile.in     srclib
BuildAll.dsp     httpd.dsp       Makefile.win    support
BuildBin.dsp     httpd.mak       modules         test
buildconf        httpd.spec      NOTICE          VERSIONING
CHANGES          include         NWGNUmakefile
changes-entries  INSTALL         os
//查看被解壓出來的東西
[root@lnh httpd-2.4.54]# ./configure --prefix=/usr/local/src/httpd --with-apr=/usr/local/src/apr --with-apr-util=/usr/local/src/apr-util
...
config.status: creating build/config_vars.sh
config.status: creating include/ap_config_auto.h
config.status: executing default commands
configure: summary of build options:

    Server Version: 2.4.54
    Install prefix: /usr/local/src/httpd
    C compiler:     gcc
    CFLAGS:          -g -O2 -pthread  
    CPPFLAGS:        -DLINUX -D_REENTRANT -D_GNU_SOURCE  
    LDFLAGS:           
    LIBS:             
    C preprocessor: gcc -E

//生成Makefile文件
[root@lnh httpd-2.4.54]# make
...
/usr/local/src/apr/build-1/libtool --silent --mode=link gcc  -g -O2 -pthread           -o mod_rewrite.la -rpath /usr/local/src/httpd/modules -module -avoid-version  mod_rewrite.lo 
make[4]: Leaving directory '/root/xbz/httpd-2.4.54/modules/mappers'
make[3]: Leaving directory '/root/xbz/httpd-2.4.54/modules/mappers'
make[2]: Leaving directory '/root/xbz/httpd-2.4.54/modules'
make[2]: Entering directory '/root/xbz/httpd-2.4.54/support'
make[2]: Leaving directory '/root/xbz/httpd-2.4.54/support'

make[1]: Leaving directory '/root/xbz/httpd-2.4.54'
//編譯生成Makefile文件,出現(xiàn)的一些沒有讀取到的問題沒有關(guān)系,繼續(xù)進(jìn)行下一步
[root@lnh httpd-2.4.54]# make install
...
Installing man pages and online manual
mkdir /usr/local/src/httpd/man
mkdir /usr/local/src/httpd/man/man1
mkdir /usr/local/src/httpd/man/man8
mkdir /usr/local/src/httpd/manual
make[1]: Leaving directory '/root/xbz/httpd-2.4.54'
//進(jìn)行安裝
[root@lnh httpd-2.4.54]# cd /usr/local/src/httpd/
[root@lnh httpd]# ls
bin    cgi-bin  error   icons    logs  manual
build  conf     htdocs  include  man   modules
//切換到httpd的安裝目錄進(jìn)行查看,默認(rèn)情況下,系統(tǒng)搜索庫文件的路徑只有/lib,/usr/lib
[root@lnh httpd]# ln -s /usr/local/src/httpd/include/ /usr/include/httpd
[root@lnh httpd]# ll  /usr/include/httpd
lrwxrwxrwx. 1 root root 29 Jul 12 21:23 /usr/include/httpd -> /usr/local/src/httpd/include/
//將頭文件軟鏈接到/usr/include目錄下
[root@lnh httpd]# echo "export PATH=$PATH:/usr/local/src/httpd/bin" > /etc/profile.d/httpd.sh
[root@lnh httpd]# source /etc/profile.d/httpd.sh 
//配置httpd的全局環(huán)境變量,并生成效果
[root@lnh httpd]# which httpd 
/usr/local/src/httpd/bin/httpd
[root@lnh httpd]# vim /etc/man_db.conf
MANDATORY_MANPATH                 /usr/man
MANDATORY_MANPATH                 /usr/share/man
MANDATORY_MANPATH                 /usr/local/share/man
MANDATORY_MANPATH                 /usr/local/src/httpd/man
//添加后面這一行
[root@lnh ~]# httpd
AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using fe80::20c:29ff:fe57:f6f5%ens33. Set the 'ServerName' directive globally to suppress this message
httpd (pid 35719) already running
//啟動服務(wù)
[root@lnh ~]# ss -antl
State   Recv-Q  Send-Q   Local Address:Port     Peer Address:Port  Process  
LISTEN  0       128            0.0.0.0:22            0.0.0.0:*              
LISTEN  0       128                  *:80                  *:*              
LISTEN  0       128               [::]:22               [::]:*
//查看端口              
[root@lnh ~]# systemctl stop firewalld.service
//關(guān)閉防火墻

折疊

服務(wù)80端口

源碼編譯報錯信息處理

checking for APR... no
configure: error: APR not found.  Please read the documentation.
//解決方案
[root@lnh xbz]# wget https://mirrors.aliyun.com/apache/apr/apr-1.7.0.tar.gz
[root@lnh xbz]# wget https://mirrors.aliyun.com/apache/apr/apr-util-1.6.1.tar.gz
提前把這兩個依賴包安裝好才可以進(jìn)行生成Makefile文件

無法進(jìn)行生成兩個依賴包的Makefile文件
//解決方案
[root@lnh xbz]# dnf -y install gcc gcc-c++ make wget
提前下載編譯工具

init程序的三種風(fēng)格

  • SysV?格:init(centos5),實(shí)現(xiàn)系統(tǒng)初始化時,隨后的初始化操作都是借助于腳本來實(shí)現(xiàn)的,(/etc/inittab)
  • Upstart風(fēng)格:init(centos6),由ubuntu研發(fā)的,通過總線形式以接近于并行的方式工作,效率比SysV高,配置文件(/etc/inittab,/etc/init/*.conf)
  • Systemd風(fēng)格:systemd(centos7),啟動速度快,系統(tǒng)引導(dǎo)時實(shí)現(xiàn)服務(wù)并行啟動,比前兩者的效率都高,配置文件(/usr/lib/systemd/system,/etc/systemd/system)

init程序三種風(fēng)格的特點(diǎn)

SysV?格特點(diǎn):

  • 腳本中含有大量的命令,每個命令都要啟動一個進(jìn)程,命令執(zhí)行完以后就要終止這個進(jìn)程。如此一來,系統(tǒng)初始化時將大量的創(chuàng)建進(jìn)程,銷毀進(jìn)程,工作效率會非常低
  • 服務(wù)間可能會存在依賴關(guān)系,必須嚴(yán)格按照一定的順序來啟動服務(wù),前一個服務(wù)沒啟動完后面的服務(wù)就無法執(zhí)行啟動過程。不能并行進(jìn)行

Upstart風(fēng)格特點(diǎn):

  • 基于總線方式能夠讓進(jìn)程間互相通信的一個應(yīng)用程序
  • 不用等服務(wù)啟動完成,只要一初始化就可以把自己的狀態(tài)返回給其他進(jìn)程

Systemd風(fēng)格特點(diǎn):

  • 啟動速度比SysV和Upstart都快
  • 不需要通過任何腳本來啟動服務(wù),systemd自身就可以啟動服務(wù),其本身就是一個強(qiáng)大的解釋器,啟動服務(wù)時不需要sh/bash的參與
  • systemd不真正在系統(tǒng)初始化時去啟動任何一個服務(wù)只要服務(wù)沒用到,它告訴你啟動了,實(shí)際上并沒有啟動。僅當(dāng)?shù)谝淮稳ピL問時才會真正啟動服務(wù)

到此這篇關(guān)于apache編譯安裝httpd-2.4.54以及三種風(fēng)格的init程序特點(diǎn)和區(qū)別的文章就介紹到這了,更多相關(guān)apache編譯安裝httpd-2.4.54內(nèi)容請搜索腳本之家以前的文章或繼續(xù)瀏覽下面的相關(guān)文章希望大家以后多多支持腳本之家!

相關(guān)文章

  • Linux中dd命令使用實(shí)例教程

    Linux中dd命令使用實(shí)例教程

    dd命令用指定大小的塊拷貝一個文件,并在拷貝的同時進(jìn)行指定的轉(zhuǎn)換。下面這篇文章主要給大家介紹了關(guān)于Linux中dd命令使用的相關(guān)資料,對大家具有一定的參考學(xué)習(xí)價值,需要的朋友們下面來一起看看吧。
    2017-05-05
  • Apache之AllowOverride參數(shù)使用說明

    Apache之AllowOverride參數(shù)使用說明

    通常利用Apache的rewrite模塊對 URL 進(jìn)行重寫的時候, rewrite規(guī)則會寫在 .htaccess 文件里。但要使 apache 能夠正常的讀取.htaccess 文件的內(nèi)容,就必須對.htaccess 所在目錄進(jìn)行配置。
    2011-01-01
  • Linux密碼安全防護(hù)操作詳解

    Linux密碼安全防護(hù)操作詳解

    這篇文章主要為大家詳細(xì)介紹了一些Linux密碼的安全防護(hù)操作,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-04-04
  • 詳解Linux下你所不知道的7個SSH命令用法

    詳解Linux下你所不知道的7個SSH命令用法

    這篇文章主要介紹了Linux SSH命令,文中通過示例代碼介紹的非常詳細(xì),對大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2019-05-05
  • CentOS上搭建Nginx+Mono運(yùn)行asp.net環(huán)境的配置方法

    CentOS上搭建Nginx+Mono運(yùn)行asp.net環(huán)境的配置方法

    這篇文章主要介紹了CentOS上搭建Nginx+Mono運(yùn)行asp.net環(huán)境的配置方法,需要的朋友可以參考下
    2017-03-03
  • 詳解ubuntu下安裝Docker

    詳解ubuntu下安裝Docker

    本篇文章主要介紹了ubuntu下安裝Docker,詳細(xì)的介紹了安裝Docker的情況,具有一定的參考價值,有需要的一起來了解一下。
    2016-12-12
  • Centos7升級glibc導(dǎo)致系統(tǒng)異常(無法開機(jī))解決方法

    Centos7升級glibc導(dǎo)致系統(tǒng)異常(無法開機(jī))解決方法

    大家好,本篇文章主要講的是Centos7升級glibc導(dǎo)致系統(tǒng)異常(無法開機(jī))解決方法,感興趣的同學(xué)趕快來看看吧,希望對你有幫助
    2021-11-11
  • Apache2.4.2編譯安裝2個常見錯誤和解決方法

    Apache2.4.2編譯安裝2個常見錯誤和解決方法

    這篇文章主要介紹了Apache2.4.2編譯安裝2個常見錯誤和解決方法,需要的朋友可以參考下
    2014-06-06
  • 在CentOS / RHEL上設(shè)置 SSH 免密碼登錄的方法

    在CentOS / RHEL上設(shè)置 SSH 免密碼登錄的方法

    本篇文章主要介紹了在CentOS / RHEL上設(shè)置 SSH 免密碼登錄的方法,自動登錄配置好以后,你可以通過它使用 SSH (Secure Shell)和安全復(fù)制 (SCP)來移動文件。
    2017-03-03
  • Centos7.2 編譯安裝方式搭建 phpMyAdmin

    Centos7.2 編譯安裝方式搭建 phpMyAdmin

    這篇文章主要介紹了Centos7.2 編譯安裝方式搭建 phpMyAdmin ,具有一定的參考價值,感興趣的小伙伴們可以參考一下
    2017-08-08

最新評論