[Only 3 steps] install and configure Apache manually (which is feasible for test), and 3 steps for apache
Author: wavelet/QQ463431476. Please reprint it!
Redhat6 uses the centos yum source.
Step 1 download and install the software package on which apache depends
Install apr
:Http://apr.apache.org/download.cgi
Decompress the package:Tar-jxvf apr-1.5.0.Tar.bz2 note: the format of the package here is tar.bz2format. If it is in the .tar format, decompress it with the tar-zxvf + package name command.
Enter the folder of the package and execute the following commands in sequence:
./Configure -- prefix =/work/installed/apr (Note: You can customize the folder directory for configure installation)
Make
Make install
Install apr-util
:Http://apr.apache.org/download.cgi
Decompress the package:Tar-jxvfApr-util-1.5.3.Tar.bz2
Go to the folder and execute:
./Configure -- prefix =/work/installed/apr-util -- with-apr =/Work/installed/apr
Make
Make install
Install pcre
: Http://pcre.org/
Decompress the package:Tar-jxvf pcre-8.35.Tar.bz2
./Configure -- prefix =/work/installed/pcre
Make
Make install
Note:: If You encounter problems when installing pcre: configure: error: You need a C ++ compiler for C ++ support.
UbuntuSolution:Sudo apt-Get install build-Essential
Redhat6/centos6 solution: yum installation package: yum install gcc-c ++ kernel-devel
Step 2 install Apache and configure:
Installation:
: Http://httpd.apache.org/
Extract: tar-jxvf httpd-2.4.9.tar.bz2
Enter the decompressed file and execute:
. /Configure -- prefix =/work/installed/apache -- with-apr =/work/installed/apr -- with-apr-util =/work/installed/apr-util --- pcre =/work/installed/pcre -- enable-module = shared
-- Enable-module = shared indicates that Apache can dynamically load modules, paving the way for future php installation.
Make
Make install
NOTE: If an installation error occurs and you want to reinstall the package, first Delete the installed folder, and then clear the compilation in the decompressed Folder: make clean all
Step 3 configure Apache:
Modify the configuration file. If the apache service is started without modification, the following problems may occur:
AH00558: httpd: cocould not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'servername' directive globally to suppress this message
Solution:
Modify the file in the installed directory:
Command: vim/work/installed/apache/conf/httpd. conf
Put:
# ServerName www.example.com: 80
Changed:
ServerName localhost: 80
You can also configure your own homepage directory:
You can also add the php homepage:
If there is a hosts file under/etc/, modify it:
Modify the file: vi/etc/hosts
Enter 192.168.8.119 server.example.com
Change the ip address to your own ip address.
Start the apache service:
Enter the command:/work/installed/apache/Bin/apachectl start
Automatic Start upon startup: vim etc/rc. local
Add:/Work/installed/apache/bin/apachectl start this is the configuration file in the apache installation directory. Let it start automatically when it is started!
If not, disable the firewall: iptables-F
Enter the IP address and you will see: it works!
However, in this case, you must disable the firewall, so you need to configure the firewall:
Open the iptables configuration file vi/etc/sysconfig/iptables.
Add a port 80: (if you have customized the port, enter your own port)
-A RH-Firewall-1-INPUT-m state-state NEW-m tcp-p tcp-dport 80-j ACCEPT
Another yum configuration for installing Apache and Apache is for reference only:
Http://www.cnblogs.com/xiaobo-Linux/p/4631675.html