Linux service Apache source installation (CentOS)

Source: Internet
Author: User

  1. The first part: pre-preparation needs to download things
  2. Download Apache Source Bundle: http://httpd.apache.org/download.cgi i downloaded httpd-2.4.20.tar.gz
  3. Download apr:http://archive.apache.org/dist/apr/apr-1.5.0.tar.gz i downloaded the apr-1.5.0.tar.gz
  4. 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
  5. 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.
  6. Well, then, let's start the installation!
  7. First step: Unzip the downloaded Apache package
  8. [Email protected] ~]# TAR-ZXVF httpd-2.4.20.tar.gz
  9. Go to the directory to compile the extracted original files
  10. [Email protected] httpd-2.4.20]#/configure--prefix=/usr/local/apache2/#配置安装目录
  11. 1. Normal execution (indicates that your Linux has installed Apache, or that you have installed the required dependency packages)
  12. 2. Abnormal execution, the following error message will appear
  13. Configure
  14. Checking for APR ... no
  15. Configure:error:APR not found. Please read the documentation.
  16. 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)
  17. Step two: Unzip the downloaded APR package.
  18. [Email protected] ~]# TAR-ZXVF apr-1.5.1.tar.gz
  19. Go to the directory to compile the extracted original files
  20. [Email protected] apr-1.5.1]#/configure--prefix=/usr/local/apr/#配置安装目录
  21. Install directory configuration complete create directory and file at specified address on make && make install
  22. [[email protected] apr-1.5.1]# make && make install
  23. Step three: Unzip the downloaded Apr-util bag.
  24. [Email protected] ~]# TAR-ZXVF apr-util-1.5.4.tar.gz
  25. Go to the directory to compile the extracted original files
  26. [Email protected] apr-util-1.5.4]#/configure--prefix=/usr/local/apr-util/#配置安装目录
  27. Errors See error messages Now you know that, don't you?--with-apr
  28. [Email protected] apr-util-1.5.4]#/configure--prefix=/usr/local/apr-util/--with-apr=/usr/local/apr/
  29. Install directory configuration complete create directory and file at specified address on make && make install
  30. [[email protected] apr-util-1.5.4]# make && make install
  31. Fourth step: Continue installing Apache
  32. Switch to Apache source file
  33. [Email protected] httpd-2.4.20]#/configure--prefix=/usr/local/apache24/--with-apr=/usr/local/apr/-- with-apr-util=/usr/local/apr-util/
  34. The following error can also occur because of a lack of environment PCRE
  35. Checking for pcre-config ... false
  36. Configure:error:pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
  37. 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
  38. [[email protected] ~]# wget http://jaist.dl.sourceforge.net/project/pcre/pcre/8.39/pcre-8.39.tar.gz
  39. [Email protected] ~]# TAR-ZXVF pcre-8.39.tar.gz
  40. [Email protected] pcre-8.39]#/configure--prefix=/usr/local/pcre/
  41. [[email protected] pcre-8.39]# make && make install
  42. Fifth step: Continue installing Apache
  43. [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/
  44. [[email protected] httpd-2.4.20]# make && make install
  45. Sixth step: Test Apache
  46. CENTOS7 uses systemctl instead of chkconfig management services, and the firewall is replaced by Iptables Firewalld
  47. First shut down the firewall with Systemctl:
  48. Systemctl Stop Firewalld.service
  49. Systemctl Disable Firewalld.service
  50. Turn on Apache services stop Stop
  51. [[Email protected]~]# cd/usr/local/apache24/bin/
  52. [[email protected] bin]#./apachectl start
  53. Seventh Step: Enter your IP address in the client browser to see if you can access Apache successfully.
  54. Successful display of It works! On behalf of the server has successfully started ~\ (≧▽≦)/~.
  55. 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!
  56. Attach: If you are using this command when you install Apache, you can do it.
  57. ./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
  58. Because installing the Apache server is the option of installing support OpenSSL, and by the way, how to configure Openss in Apache
  59. First, modify it in the/etc/httpd/http.conf file:
  60. ServerName to Www.example.com:80
  61. Remove LoadModule Ssl_module modules/mod_ssl.so before the #
  62. Remove LoadModule Socache_shmcb_module modules/mod_socache_shmcb.so before the #
  63. Remove the # before include/etc/httpd/extra/httpd-ssl.conf
  64. To generate a server certificate:
  65. 1. Generate the private key file for the server Server.key
  66. OpenSSL genrsa-out Server.key 1024
  67. 2. Generate unsigned SERVER.CSR
  68. OpenSSL req-new-key server.key-out SERVER.CSR
  69. The program prompts to enter a series of parameters, including country, province name, city name ... , follow the prompts to enter
  70. 3. Sign the server certificate file server.crt
  71. OpenSSL req-x509-days 365-key server.key-in server.csr-out server.crt
  72. Then copy the generated Server.key, SERVER.CSR, SERVER.CRT to the/ETC/HTTPD directory
  73. /usr/local/apache/bin/apachectl restart
  74. 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)

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.