1. Prepare the source package and configure the Yum source. , the required source package includes: httpd-2.4.18, apr-1.5.2.tar.gz, apr-util-1.5.4.tar.gz
2. Prepare the user
Groupadd-r Apache
Useradd-r apache-g apache-s/sbin/nologin
3. Prepare the environment, execute the following 4 commands, this step is not.
Install the following four package groups in turn:
Yum Groupinstall ' development tools '-y
Yum Install Openssl-devel-y
Yum Install Zlib-devel-y
Yum Install Pcre-devel-y
4. Compile and install Apr
TAR-XF apr-1.5.2.tar.gz && CD apr-1.5.2
./configure--PREFIX=/USR/LOCAL/APR
Make && make install
5. Compile and install Apr-util
TAR-XF apr-util-1.5.4.tar.gz && CD apr-util-1.5.4
./configure--prefix=/usr/local/apr-util--with-apr=/usr/local/apr/
Make && make install
6. Go to the Orthodox dish and start compiling and installing Apache
TAR-XF httpd-2.4.18.tar.gz && CD httpd-2.4.18
./configure--prefix=/usr/local/httpd \
--sysconfdir=/etc/httpd \
--enable-so \
--enable-rewrite \
--enable-ssl \
--enable-cgi \
--enable-cgid \
--enable-modules=all \
--enable-mods-shared=all \
--enable-mpms-shared=all \
--with-mpm=Event \
--with-apr=/usr/local/apr \
--with-apr-util=/usr/local/apr-util
Make && make install
#注释: The above Event can be replaced by other processing modules, the specific meaning can be three types of MPM models for Baidu Apache
The way the compilation is done
7. The final processing work:
Echo ' Export path= $PATH:/usr/local/httpd/bin ' >>/etc/profile.d/httpd.sh
Echo ' pidfile '/var/run/httpd.pid ' >>/etc/httpd/httpd.conf
Vim/etc/httpd/httpd.conf
Change Apache's default running user to the Apache user we created
User Daemon
Group Daemon
Change into
User Apache
Group Apache
Configure startup scripts to enable service and Chkconfig
Cp/usr/local/httpd/bin/apachectl/etc/init.d/httpd
Vim/etc/init.d/httpd
Start the service:
Test:
To this, Apache compiles the installation successfully.
LANMP Series tutorial Apache compile and install CentOS7 environment