Apache binary Compiler-free installation and parameter configuration

Source: Internet
Author: User
Tags fully qualified domain name

  • Download HTTP Related binary packages
    cd /usr/local/src/wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.34.tar.gzwget http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gzwget http://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz

    Description
    Apr and Apr-util are a common library of functions that allow httpd to be able to migrate from Linux to WinDOS without caring for the underlying operating system platform.

  • 2. Unzip the installation package

    tar zxvf  httpd-2.4.34.tar.gztar zxvf apr-1.6.3.tar.gztar zxvf  apr-util-1.6.1.tar.gz

    3. Compile and install apr-1.6.3

    cd apr-1.6.3./configure --prefix=/usr/local/apr

    Error 01:

    [[email protected] apr-1.6.3]# ./configure --prefix=/usr/local/aprchecking build system type... x86_64-pc-linux-gnuchecking host system type... x86_64-pc-linux-gnuchecking target system type... x86_64-pc-linux-gnuConfiguring APR libraryPlatform: x86_64-pc-linux-gnuchecking for working mkdir -p... yesAPR Version: 1.6.3checking for chosen layout... aprchecking for gcc... nochecking for cc... nochecking for cl.exe... noconfigure: error: in `/usr/local/apr-1.6.3‘:configure: error: no acceptable C compiler found in $PATHSee `config.log‘ for more details[[email protected] apr-1.6.3]# echo $?1

    Workaround: Install GCC

    yum install gcc -y

    Once again, config compiles successfully

    [[email protected] apr-1.6.3]# ./configure --prefix=/usr/local/apr

    [[email protected] apr-1.6.3]#make && make install[[email protected] apr-1.6.3]# echo $?0

    4. Compile and install apr-util-1.6.1

    cd /usr/local/src/apr-util-1.6.1./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprmake && make install

    Compile and install error


    Resolve Error: Install expat library

    yum install expat-devel -y

    Execute the Make && make install again to resolve the error

    5. Compile and install httpd-2.4.29

    cd /usr/local/src/httpd-2.4.29./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util --enable-so \   ##支持动态扩展模块,apache支持以一个动态模块存在,Apache本身就是一个进程服务--enable-mods-shared=most

    Compile error 01:configure:error:pcre-config for Libpcre not found. PCRE is required and available from http://pcre.org/

    解决办法:yum install pcre-devel -y

    Execute again./configure--prefix=/usr/local/apache2.4--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util-- Enable-so--enable-mods-shared=most returns to the following interface, indicating that the Configure compilation succeeded

    注:如果在编译过程中出现,缺少某个依赖包,解决思路yum list |grep 包然后安装devel关键字的软件包yum install -y 软件包

    Build && make install error

    Description: An XML-related library is missing and the Libxml2-devel package needs to be installed. Direct installation does not resolve the issue because the apr-util of the httpd call is already installed, but Apr-util does not have Libxml2-devel package support
    Workaround:

    参考78829184

    Reinstall Libxml2-devel

    yum install -y libxml2-devel

    Remove Apr-util Package

    rm -rf /usr/local/src/apr-util-1.6.1cd /usr/local/src/

    Recompile the installation Apr-util

    tar zxvf apr-util-1.6.1.tar.gzcd apr-util-1.6.1/ ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/aprmake && make install

    [[email protected] apr-util-1.6.1]# pwd/usr/local/src/apr-util-1.6.1[[email protected] apr-util-1.6.1]# cd ..[[email protected] src]#[[email protected] src]# cd httpd-2.4.34[[email protected] httpd-2.4.34]#[[email protected] httpd-2.4.34]# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most返回下面界面说明configure这步编译成功

    make && make install返回下面界面说明make && make install 执行成功

    [email protected] httpd-2.4.29]# cd /usr/local/apache2.4/[[email protected] apache2.4]# lsbin  build  cgi-bin  conf  error  htdocs  icons  include  logs  man  manual  modules说明:bin目录:命令执行conf目录:配置文件所在目录htdocs目录:默认网站访问的内容就存在这个目录下logs日志目录:访问日志,服务报错日志modules目录:存放apache需要的模块[[email protected] apache2.4]# ls ./modules/

    [[email protected] apache2.4]# ls ./htdocs/index.html[[email protected] apache2.4]# ls ./bin/

    [[email protected] apache2.4]# ls ./logs/[[email protected] apache2.4]# ls ./conf/extra  httpd.conf  magic  mime.types  original

    Check the Apache service status and return to the following prompt after executing the/USR/LOCAL/APACHE2.4/BIN/APACHECTL command

    [[email protected] apache2.4]# /usr/local/apache2.4/bin/apachectlAH00558: httpd: Could not reliably determine the server‘s fully qualified domain name, using localhost.localdomain. Set the ‘ServerName‘ directive globally to suppress this message

    Workaround:
    Compile the/usr/local/apache2.4/conf/httpd.conf file and change the parameter servername to

    ServerName localhost

    Note: localhost here represents the native hostname, and the hostname can be customized to other
    Then restart the Apache service

    [[email protected] src]# /usr/local/apache2.4/bin/apachectl restart[[email protected] src]# /usr/local/apache2.4/bin/apachectlhttpd (pid 71429) already running

    View Apache-loaded modules

    /usr/local/apache2.4/bin/httpd -M

    说明: apache会加载两种类型的模块static:静态模块shared:动态模块两者的区别在于,static模块是已经编译安装到/usr/local/apache2.4/bin/httpd配置文件中,而shared表示apache动态加载的模块

    Launch Apache Service

    /usr/local/apache2.4/bin/apachectl start

    View Apache Service Process

    [[email protected] ~]# ps aux |grep httpdroot       1463  3.0  0.2 253600  8828 ?        Ss   04:19   0:00 /usr/local/apache2.4/bin/httpd -k startdaemon     1464  2.0  0.2 540428  8916 ?        Sl   04:19   0:00 /usr/local/apache2.4/bin/httpd -k startdaemon     1465  2.0  0.2 540428  8916 ?        Sl   04:19   0:00 /usr/local/apache2.4/bin/httpd -k startdaemon     1470  1.0  0.2 540428  8912 ?        Sl   04:19   0:00 /usr/local/apache2.4/bin/httpd -k startroot       1549  0.0  0.0 112704   972 pts/1    R+   04:19   0:00 grep --color=auto httpd

    Apache binary Compiler-free installation and parameter configuration

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.