- The first part: pre-preparation needs to download things
- Download Apache Source Bundle: http://httpd.apache.org/download.cgi i downloaded httpd-2.4.20.tar.gz
- Download apr:http://archive.apache.org/dist/apr/apr-1.5.0.tar.gz i downloaded the apr-1.5.0.tar.gz
- Download apr-util:http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz i downloaded the apr-util-1.5.4.tar.gz
- Caveats: wget vim gcc gcc-c++ cmake These are also the small environments required to install Apache. Some small environment, general Cnetos self-bring, I personally suggest or manually again with yum install or update.
- Well, then, let's start the installation!
- First step: Unzip the downloaded Apache package
- [Email protected] ~]# TAR-ZXVF httpd-2.4.20.tar.gz
- Go to the directory to compile the extracted original files
- [Email protected] httpd-2.4.20]#/configure--prefix=/usr/local/apache2/#配置安装目录
- 1. Normal execution (indicates that your Linux has installed Apache, or that you have installed the required dependency packages)
- 2. Abnormal execution, the following error message will appear
- Configure
- Checking for APR ... no
- Configure:error:APR not found. Please read the documentation.
- Solution: Install the APR that was just downloaded. Apache needs some preparation environment during installation, there is a need to install another APR (Apache portable runtime)
- Step two: Unzip the downloaded APR package.
- [Email protected] ~]# TAR-ZXVF apr-1.5.1.tar.gz
- Go to the directory to compile the extracted original files
- [Email protected] apr-1.5.1]#/configure--prefix=/usr/local/apr/#配置安装目录
- Install directory configuration complete create directory and file at specified address on make && make install
- [[email protected] apr-1.5.1]# make && make install
- Step three: Unzip the downloaded Apr-util bag.
- [Email protected] ~]# TAR-ZXVF apr-util-1.5.4.tar.gz
- Go to the directory to compile the extracted original files
- [Email protected] apr-util-1.5.4]#/configure--prefix=/usr/local/apr-util/#配置安装目录
- Errors See error messages Now you know that, don't you?--with-apr
- [Email protected] apr-util-1.5.4]#/configure--prefix=/usr/local/apr-util/--with-apr=/usr/local/apr/
- Install directory configuration complete create directory and file at specified address on make && make install
- [[email protected] apr-util-1.5.4]# make && make install
- Fourth step: Continue installing Apache
- Switch to Apache source file
- [Email protected] httpd-2.4.20]#/configure--prefix=/usr/local/apache24/--with-apr=/usr/local/apr/-- with-apr-util=/usr/local/apr-util/
- The following error can also occur because of a lack of environment PCRE
- Checking for pcre-config ... false
- Configure:error:pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
- Solution: http://jaist.dl.sourceforge.net/project/pcre/pcre/8.39/pcre-8.39.tar.gz Download the latest version I downloaded pcre-8.39.tar.gz
- [[email protected] ~]# wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.39/pcre-8.39.tar.gz
- [Email protected] ~]# TAR-ZXVF pcre-8.39.tar.gz
- [Email protected] pcre-8.39]#/configure--prefix=/usr/local/pcre/
- [[email protected] pcre-8.39]# make && make install
- Fifth step: Continue installing Apache
- [Email protected] httpd-2.4.20]#/configure--prefix=/usr/local/apache24/--with-apr=/usr/local/apr/-- with-apr-util=/usr/local/apr-util/--with-pcre=/usr/local/pcre/
- [[email protected] httpd-2.4.20]# make && make install
- Sixth step: Test Apache
- CENTOS7 uses systemctl instead of chkconfig management services, and the firewall is replaced by Iptables Firewalld
- First shut down the firewall with Systemctl:
- Systemctl Stop Firewalld.service
- Systemctl Disable Firewalld.service
- Turn on Apache services stop Stop
- [[Email protected]~]# cd/usr/local/apache24/bin/
- [[email protected] bin]#./apachectl start
- Seventh Step: Enter your IP address in the client browser to see if you can access Apache successfully.
- Successful display of It works! On behalf of the server has successfully started ~\ (≧▽≦)/~.
- In their own step by step operation, very high heart success. It is not a waste of readers ' patience to read! Thank you for your praise!
- Attach: If you are using this command when you install Apache, you can do it.
- ./configure--prefix=/usr/local/apache--sysconfdir=/etc/httpd--enable-so--enable-cgi--enable-ssl-- Enable-rewrite--with-ssl=/usr/local/openssl--with-pcre=/usr/local/pcre--with-z=/usr/local/zlib--with-apr=/usr/ LOCAL/APR--with-apr-util=/usr/local/apr-util--with-ssl=/usr/local/openssl--enable-modules=most-- Enable-mpms-shared=all--with-mpm=event
- Because installing the Apache server is the option of installing support OpenSSL, and by the way, how to configure Openss in Apache
- First, modify it in the/etc/httpd/http.conf file:
- ServerName to Www.example.com:80
- Remove LoadModule Ssl_module modules/mod_ssl.so before the #
- Remove LoadModule Socache_shmcb_module modules/mod_socache_shmcb.so before the #
- Remove the # before include/etc/httpd/extra/httpd-ssl.conf
- To generate a server certificate:
- 1. Generate the private key file for the server Server.key
- OpenSSL genrsa-out Server.key 1024
- 2. Generate unsigned SERVER.CSR
- OpenSSL req-new-key server.key-out SERVER.CSR
- The program prompts to enter a series of parameters, including country, province name, city name ... , follow the prompts to enter
- 3. Sign the server certificate file server.crt
- OpenSSL req-x509-days 365-key server.key-in server.csr-out server.crt
- Then copy the generated Server.key, SERVER.CSR, SERVER.CRT to the/ETC/HTTPD directory
- /usr/local/apache/bin/apachectl restart
- Browser access: http://192.168.1.75/The browser prompts you to install the certificate and displays the page it works! after installation to prove that the SSL module is working properly.
Linux service Apache source installation (CentOS)