Rate This Document
Findability
Accuracy
Completeness
Readability

Installing Apache by Compiling the Source Code

Software Version

Whether to Support CentOS 7.6

Whether to Support CentOS 8.1

Whether to Support openEuler 20.03 (LTS-SP1)

Apache httpd 2.4.39

Yes

Yes

Yes

  1. Obtain the Apache source code.
    1. Download the source code from the local browser.

      Download address: https://archive.apache.org/dist/httpd/httpd-2.4.39.tar.bz2

    2. Upload the source package to the /home directory on the server.
      If the server is connected to the Internet, run the wget command to download the source code.
      1
      2
      cd /home
      wget https://archive.apache.org/dist/httpd/httpd-2.4.39.tar.bz2 --no-check-certificate
      
  2. Decompress the Apache installation package.
    1
    2
    cd /home/
    tar -xvf httpd-2.4.39.tar.bz2
    

  3. Go to the httpd-2.4.39 directory and view files in it.
    1
    2
    cd /home/httpd-2.4.39/
    ls
    

  4. Configure Apache.
    1
    ./configure --build=arm --prefix=/usr/local/apache2 --enable-so  --with-mpm=worker
    
    • --prefix=PATH: specifies the Apache installation directory.
    • --with-mpm=worker: specifies the Apache working mode.
  5. Perform compilation.
    1
    make -j60
    

    -j60 leverages the multi-core CPUs to speed up the compilation.

  6. Start the installation.
    1
    make install
    

  7. View the installation directory.
    1
    ls /usr/local/apache2
    
  8. View the version.
    1
    /usr/local/apache2/bin/apachectl -v