Compile and install httpd Apache server

Source: Internet
Author: User
Tags install openssl openssl version

One, download the source package
1.1 Downloads apr-util-1.6.1.tar.gz and apr-1.6.3.tar.gz
http://apr.apache.org/
1.2 Download httpd Source installation package httpd-2.4.33.tar.gz
http://httpd.apache.org/download.cgi
two, copy to server and unzip
SCP downloads/httpd-2.4.33 [Email protected]:/root
SCP downloads/apr-[Email protected]:/root
TAR-ZXVF apr-1.6.3.tar.gz
TAR-ZXVF apr-util-1.6.1.tar.gz
TAR-ZXVF httpd-2.4.33.tar.gz
third, compile and install Apr and Apr-util
Cp-r HTTPD-2.4.33/USR/LOCAL/SRC
3.1 Installing Apr
Yum-y Install GCC #安装gcc
CD apr-1.6.3
./configure--PREFIX=/USR/LOCAL/APR
Make
Make install
3.2 Installing Apr-utiL
CD apr-util-1.6.1
./configure--WITH-APR=/USR/LOCAL/APR--prefix=/usr/local/apr-util
Make
Issue: Xml/apr_xml.c:35:19: Fatal error: expat.h: No file or directory #include <expat.h>

Workaround: Missing Expat-devel Package

Yum Install Expat-devel

Make install
3.3 Installing httpd
cd/usr/local/src/httpd-2.4.33/
./configure--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/--prefix=/usr/local/apache--sysconfdir =/ETC/HTTPD--enable-so--enable-rewirte--enable-ssl--enable-cgi--enable-cgid--enable-modules=most-- Enable-mods-shared=most--enable-mpms-shared=all
Problem 1:checking for Pcre-config ... false
Solution: Yum-y Install Pcre-devel
Issue 2:checking for OpenSSL version >= 0.9.8a ... FAILED
Solution: Yum Install Openssl-devel
Make
Question 3:make[2]: Bison: Command not found MAKE[2]: Flex: Command not Found
FIX: Yum-y Install Bison Flex

Question 4:collect2:error:ld returned 1 exit status
MAKE[2]: [HTPASSWD] Error 1
MAKE[2]: Leave directory "/usr/local/src/httpd-2.4.33/support"
MAKE[1]: [all-recursive] Error 1
MAKE[1]: Leave directory "/usr/local/src/httpd-2.4.33/support"
Make: [all-recursive] Error 1

Resolution: After adding--WITH-INCLUDE-APR after the./configure
Cp-r APR-1.6.3/USR/LOCAL/SRC/HTTPD-2.4.33/SRCLIB/APR #拷贝apr

Cp-r apr-util-1.6.1/usr/local/src/httpd-2.4.33/srclib/apr-util Copy Apr-util

./configure--with-apr=/usr/local/apr--with-apr-util=/usr/local/apr-util/--prefix=/usr/local/apache--sysconfdir =/ETC/HTTPD--enable-so--enable-rewirte--enable-ssl--enable-cgi--enable-cgid--enable-modules=most-- Enable-mods-shared=most--enable-mpms-shared=all -with-included-apr

Make install

Four, start the test

/usr/local/apache/bin/apachectl Start #启动httpd
/usr/local/apache/bin/apachectl Stop #停止httpd
/usr/local/apache/bin/apachectl Restart #重启httpd
Add Environment variables
Vim/etc/profile
Path= $PATH:/usr/local/apache/bin
Apachectl Start #启动httpd
Apachectl Stop #停止httpd
Apachectl Restart #重启httpd

Cp/usr/local/apache/bin/apachectl/etc/rc.d/init.d/httpd

/ETC/INIT.D/HTTPD operation

Ps-ef |grep httpd

Root 18005 1 0 17:53? 00:00:00/usr/local/apache/bin/httpd-k start is turned on

Access Http://yourip example http://10.100.5.57 in a browser

Compile and install httpd Apache server

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.