色综合图-色综合图片-色综合图片二区150p-色综合图区-玖玖国产精品视频-玖玖香蕉视频

您的位置:首頁技術(shù)文章
文章詳情頁

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

瀏覽:153日期:2023-03-07 14:40:24
目錄
  • 源碼包編譯實(shí)例
    • 下載編譯工具,httpd以及其兩個(gè)依賴包的源碼包
    • 安裝apr
    • 安裝apr-util
    • 安裝httpd
    • 源碼編譯報(bào)錯(cuò)信息處理
  • init程序的三種風(fēng)格
    • init程序三種風(fēng)格的特點(diǎn)

      源碼包編譯實(shí)例

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

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

      //源碼包建議到官方網(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]# lsapr-1.7.0.tar.gz  apr-util-1.6.1.tar.gz  httpd-2.4.54.tar.gz

      安裝apr

      [root@lnh xbz]# lsapr-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]# lsapr-config.in  build-outputs.mk  helpers       misc   stringsapr.depCHANGES   include       mmap   supportapr.dspCMakeLists.txt    libapr.dep    network_io     tablesapr.dswconfig.layout     libapr.dsp    NOTICE testapr.makconfigure libapr.mak    NWGNUmakefile  threadprocapr.pc.in      configure.in      libapr.rc     passwd timeapr.spec       docs      LICENSE       poll   toolsatomic dso       locks random userbuild  emacs-modeMakefile.in   READMEbuild.conf     encoding  Makefile.win  README.cmakebuildconf      file_io   memoryshmem//進(jìn)入這個(gè)源碼包可以看見里面被解壓出來的東西[root@lnh apr-1.7.0]# ./configure --prefix=/usr/local/src/apr...configure: creating ./config.statusconfig.status: creating Makefileconfig.status: creating include/apr.hconfig.status: creating build/apr_rules.mkconfig.status: creating build/pkg/pkginfoconfig.status: creating apr-1-configconfig.status: creating apr.pcconfig.status: creating test/Makefileconfig.status: creating test/internal/Makefileconfig.status: creating include/arch/unix/apr_private.hconfig.status: executing libtool commandsrm: cannot remove "libtoolT": No such file or directoryconfig.status: executing default commands//生成Makefile一般常用的有 --prefix=PREFIX 這個(gè)選項(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.expsed "s,^\(location=\).*$,\1installed," < apr-1-config > apr-config.outsed -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.outmake[1]: Leaving directory "/root/xbz/apr-1.7.0"http://編譯生成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-1for 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]# lsbin  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為后綴名的文件,而后把要增添的路徑直接寫至此文件中。此時(shí)庫文件增添的搜索路徑重啟后有效,若要使用增添的路徑立即生效則要使用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//切換到前一個(gè)工作目錄[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 4drwxr-xr-x. 2 root root 4096 Jul 12 20:18 apr-1lrwxrwxrwx. 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//需要先安裝這個(gè)依賴[root@lnh xbz]# lsapr-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]# lsapr-1.7.0 apr-util-1.6.1 httpd-2.4.54.tar.gzapr-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]# lsaprutil.dep       CHANGES    include NWGNUmakefileaprutil.dsp       CMakeLists.txt     ldap    READMEaprutil.dsw       config.layout      libaprutil.dep  README.cmakeaprutil.mak       configure  libaprutil.dsp  README.FREETDSapr-util.pc.in    configure.in       libaprutil.mak  redisapr-util.spec     crypto     libaprutil.rc   renames_pendingapu-config.in     dbdLICENSE strmatchbuckets   dbmMakefile.in     testbuild     docs       Makefile.win    uribuild.confencoding   memcachexlatebuildconf export_vars.sh.in  misc    xmlbuild-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.statusconfig.status: creating Makefileconfig.status: creating export_vars.shconfig.status: creating build/pkg/pkginfoconfig.status: creating apr-util.pcconfig.status: creating apu-1-configconfig.status: creating include/private/apu_select_dbm.hconfig.status: creating include/apr_ldap.hconfig.status: creating include/apu.hconfig.status: creating include/apu_want.hconfig.status: creating test/Makefileconfig.status: creating include/private/apu_config.hconfig.status: executing default commands//生成Makefile文件,需要伴隨著上一個(gè)指定的依賴[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.expgcc -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.expsed "s,^\(location=\).*$,\1installed," < apu-1-config > apu-config.outmake[1]: Leaving directory "/root/xbz/apr-util-1.6.1"http://編譯生成的Makefile文件,出現(xiàn)make[1]: Leaving directory "/root/xbz/apr-util-1.6.1"這個(gè)沒有關(guān)系可以繼續(xù)進(jìn)行下一步安裝[root@lnh apr-util-1.6.1]# make install...See any operating system documentation about shared libraries formore 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]# lsbin  include  lib//切換到apr-util安裝目錄進(jìn)行查看,默認(rèn)情況下,系統(tǒng)搜索庫文件的路徑只有/lib,/usr/lib,我們需要進(jìn)行修改在/etc/ld.so.conf.d/中創(chuàng)建以.conf為后綴名的文件,而后把要增添的路徑直接寫至此文件中。此時(shí)庫文件增添的搜索路徑重啟后有效,若要使用增添的路徑立即生效則要使用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//切換到上一個(gè)工作目錄[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]# lsapr-1.7.0 apr-util-1.6.1 httpd-2.4.54apr-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]# lsABOUT_APACHE     CMakeLists.txt  InstallBin.dsp  READMEacinclude.m4     config.layout   LAYOUT  README.CHANGESApache-apr2.dsw  configure       libhttpd.dep    README.cmakeApache.dsw       configure.in    libhttpd.dsp    README.platformsapache_probes.d  docs    libhttpd.mak    ROADMAPap.d     emacs-style     LICENSE serverbuild    httpd.dep       Makefile.in     srclibBuildAll.dsp     httpd.dsp       Makefile.win    supportBuildBin.dsp     httpd.mak       modules testbuildconfhttpd.spec      NOTICE  VERSIONINGCHANGES  include NWGNUmakefilechanges-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.shconfig.status: creating include/ap_config_auto.hconfig.status: executing default commandsconfigure: 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"http://編譯生成Makefile文件,出現(xiàn)的一些沒有讀取到的問題沒有關(guān)系,繼續(xù)進(jìn)行下一步[root@lnh httpd-2.4.54]# make install...Installing man pages and online manualmkdir /usr/local/src/httpd/manmkdir /usr/local/src/httpd/man/man1mkdir /usr/local/src/httpd/man/man8mkdir /usr/local/src/httpd/manualmake[1]: Leaving directory "/root/xbz/httpd-2.4.54"http://進(jìn)行安裝[root@lnh httpd-2.4.54]# cd /usr/local/src/httpd/[root@lnh httpd]# lsbin    cgi-bin  error   icons    logs  manualbuild  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/httpdlrwxrwxrwx. 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.confMANDATORY_MANPATH /usr/manMANDATORY_MANPATH /usr/share/manMANDATORY_MANPATH /usr/local/share/manMANDATORY_MANPATH /usr/local/src/httpd/man//添加后面這一行[root@lnh ~]# httpdAH00558: 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 messagehttpd (pid 35719) already running//啟動(dòng)服務(wù)[root@lnh ~]# ss -antlState   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端口

      源碼編譯報(bào)錯(cuò)信息處理

      checking for APR... noconfigure: 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提前把這兩個(gè)依賴包安裝好才可以進(jìn)行生成Makefile文件無法進(jìn)行生成兩個(gè)依賴包的Makefile文件//解決方案[root@lnh xbz]# dnf -y install gcc gcc-c++ make wget提前下載編譯工具

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

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

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

      SysV?格特點(diǎn):

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

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

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

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

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

      標(biāo)簽: Linux Apache
      主站蜘蛛池模板: 精品无码久久久久久国产 | 精品国产免费观看 | 欧美在线观看一区二区三区 | 久久精品国产半推半就 | 韩国精品欧美一区二区三区 | 国产成人亚洲综合欧美一部 | 国产精品麻豆一区二区三区v视界 | 手机看片1024精品国产 | 中文一区二区在线观看 | 午夜黄色福利视频 | 亚洲一区二区在线免费观看 | 欧美精品一区二区三区免费播放 | 欧美在线视频 一区二区 | 亚洲一级在线 | 中文字幕欧美一区 | 欧美亚洲国产精品久久高清 | 成人精品视频在线观看 | www.99在线观看 | 中国一级特黄剌激爽毛片 | 亚洲免费片| 九九色网 | 国产成人精品福利网站人 | 亚洲一级高清在线中文字幕 | 亚洲精品第一区二区三区 | 一级免费视频 | 国产欧美精品三区 | 91久久线看在观草草青青 | 91在线免费观看网站 | 欧美亚洲在线 | 欧美日韩中文一区二区三区 | 亚洲第一成年网站大全亚洲 | 国产欧美一区二区精品久久久 | 九色福利 | 一级视频在线免费观看 | 成人免费视频69 | 三级网站在线免费观看 | 国内成人免费视频 | 久久在线免费观看视频 | 亚洲欧洲日本天天堂在线观看 | 亚洲国产激情在线一区 | 国产成人综合手机在线播放 |