Install the source code Apache package on CentOS 7 and enable the service, including the solution
How to install the source Apache package and enable the service on CentOS 7
Step 1: download the latest Apache package from Apache's official website, and then upload it to remote Centos 7 via WinSCP
Mount the iso CentOS 7 image of VMware and deploy the local yum source-
Automatically mount the DVD in VMware 12 and add the following statement to / etc/fstab
[root@Franklin13 ~] # cat / etc/fstab | grep cdrom
/ dev/cdrom / media/cdrom auto defaults 0 0
-the compilation and installation process is as follows-
Step 2: check the INSTALL or readme file in the source package and use the yum command to see if the Development Tools package is installed
(because. / configure compiles to call some software installed by Development Tools, such as GCC)
[root@Franklin13 httpd-2.4.41] # ls-l | grep IN*
-rw-r--r--. 1 root dip 3782 May 18 2016 INSTALL
Sometimes, the following error occurs in yum groupinstall "Development tools", and this error still occurs after using yum clean all; yum makecache
After Google, it is found that it needs to be installed in the following way:
Yum groupinstall "Development Tools"-- setopt=group_package_types=mandatory,default,optional
There are many reasons for this, see the following URL
Https://access.redhat.com/solutions/1310043
Step 3: enter the unzipped httpd directory and run the compiled trilogy. / configure-- prefix=...&make&make install:
But sometimes there are errors, such as the "checking for APR... no" I met.
[root@Franklin13 httpd-2.4.41] # / configure-- prefix=/usr/local/apache2.4.41-- sysconfdir=/etc/httpd2
Checking for chosen layout... Apache
Checking for working mkdir-p. Yes
Checking for grep that handles long lines and-e. / usr/bin/grep
Checking for egrep... / usr/bin/grep-E
Checking build system type... X86_64-pc-linux-gnu
Checking host system type... X86_64-pc-linux-gnu
Checking target system type... X86_64-pc-linux-gnu
Configure:
Configure: Configuring Apache Portable Runtime library...
Configure:
Checking for APR... No
After passing through Baidu, it is found that the reasons are as follows:
Reference article-https://www.cnblogs.com/yewandemty/p/5396338.html
Install these modules (apr and apr-util before installing httpd)
Download address of Apr: http://archive.apache.org/dist/
Download of Apr-util: http://archive.apache.org/dist/apr/
(note: install apr first, then install apr-uti, and add-- with-apr= followed by the installation path where apr was compiled before installing apr-uti)
The following figure shows how to right-click to download the apr-util module
Then when you compile and install httpd, you must add the following two with parameters, which is also drunk:
[root@Franklin13 httpd-2.4.41] # / configure-- prefix=/usr/local/apache2.4.41-- sysconfdir=/etc/httpd2-- with-apr=/usr/local/apr-- with-apr-util=/usr/local/apr-util
[root@Franklin13 httpd-2.4.41] #
But there is the following new error "pcre-config for libpcre not found"
So you have to download the pcre module, and then compile and install it.
After that, the httpd source package can be installed successfully
[root@Franklin13 httpd-2.4.41] # history 5
/ configure-- prefix=/usr/local/apache2.4.41-- sysconfdir=/etc/httpd2-- with-apr=/usr/local/apr-- with-apr-util=/usr/local/apr-util-- with-pcre=/usr/local/pcre
503 make
504 history 5
505 make install
506 history 5
After the installation is successful, you can run apachectl start under the installation directory / bin.
[root@Franklin13 bin] # pwd
/ usr/local/apache2.4.41/bin
[root@Franklin13 bin] # apachectl start
[root@Franklin13 bin] #
[root@Franklin13 bin] # netstat-tan | grep 80
Tcp6 0 0: 80: * LISTEN
[root@Franklin13 bin] #
[root@Franklin13 bin] #
[root@Franklin13 bin] # ps-ef | grep httpd
Root 59193 1 0 16:27? 00:00:01 / usr/sbin/httpd-DFOREGROUND
Apache 59199 59193 0 16:27? 00:00:00 / usr/sbin/httpd-DFOREGROUND
Apache 59201 59193 0 16:27? 00:00:00 / usr/sbin/httpd-DFOREGROUND
Apache 59203 59193 0 16:27? 00:00:00 / usr/sbin/httpd-DFOREGROUND
Apache 59204 59193 0 16:27? 00:00:00 / usr/sbin/httpd-DFOREGROUND
Apache 59205 59193 0 16:27? 00:00:00 / usr/sbin/httpd-DFOREGROUND
Root 63802 19545 0 17:46 pts/5 00:00:00 grep-color=auto httpd
[root@Franklin13 bin] #
-end of the full text--