Deploy apache2 craters online from 0 to 1

Download the Apache installation package

Directly to the website to download package httpd.apache.org/download.cg…

Upload it to the /root directory on the server and decompress it from the root directory on the command line (for example, I used version 2.4.46 here)

#Unzip the. Gz fileGzip - d HTTPD - 2.4.46. Tar. Gz#Decompress the. Tar fileThe tar XVF HTTPD - 2.4.46. TarCopy the code

configure

CD HTTPD - 2.4.46. / configureCopy the code

The result is that it has not been successful. After several attempts, it is found that the three dependency packages of APR, APr-util and PCRE are missing

Install depends on APR, apr-util, pcRE

Go to the website to download and install apr.apache.org/download.cg… ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/ but pcre website seems to be a wall can not access, here is my qq share pcre 8.39 share.weiyun.com/ThS9mZWR cloud

Execute in sequence:

apr

Tar XVF apr-1.7.0.tar CD apr-1.7.0 make make installCopy the code

apr-util

Tar XVF apr-util-1.6.1.tar CD apr-util-1.6.1. /configure --with-apr=/usr/local/apr make make installCopy the code

Apr-util is successfully installed in /usr/local/apr/lib

pcre

Tar XVF pcl-8.39.tar CD pcl-8.39./configure make make installCopy the code

Continue configuring Apache

Perform:

CD httpd-2.4.46./configure make make installCopy the code

Wait patiently. The installation is successful

CD to root and try to start Apache:

/usr/local/apache2/bin/apachectl start
Copy the code

Error again, don’t panic to read the error message

/usr/local/apache2/bin/httpd: error while loading shared libraries: libpcre.so1.: cannot open shared object file: No such file or directory
Copy the code

Libpcre.so.1: libpcre.so.1: libpcre.so.1: libpcre.so. Go back to the root directory and find the libc.conf file in /etc/ld.so.conf.d (if not, create a new one) and add a line to the libc.conf file.

To dynamically link the library back to the root directory, run:

sudo ldconfig
Copy the code

Add the server IP address to apache

Performed again/usr/local/apache2 / bin/apachectl start an error again

httpd: Could not reliably determine the server's fully qualified domain name
Copy the code

Go to /usr/local/apache2/conf and edit httpd.conf to find **#ServerName**

Performed again/usr/local/apache2 / bin/apachectl start

666 has finally succeeded!

Don’t forget to enable port 80 on the cloud server