Step1: Check to see if Apache software is installed and uninstall the original Apache STEP2 if available: Install GCC and make yum-y install gcc yum-y install
Yum-y Install gcc-c++ No this gcc-c++ a compile not prce
Step3: Download Apache source package from Http://httpd.apache.or httpd-2.4.4.tar.gz
Then download apr-1.4.6.tar.gz and apr-util-1.5.1.tar.gz from http://apr.apache.org
Then download pcre-8.32.tar.gz and pcre-devel-8.32.tar.gz from http://sourceforge.net/
STEP4: Use FTP software to remotely connect to a Linux server, or U-disk to pull the compressed package to the server, the download of the compressed package into a custom directory. Cut to download good source package directory, I am/root/data/compress-files
4.1 Installing Apr:
TAR-ZVXF apr-1.4.6.tar.gz
CD apr-1.4.6
./configure--PREFIX=/USR/LOCAL/APR
Make && make install
4.2 Installing Apr-util
TAR-ZVXF apr-util-1.5.1.tar.gz
CD apr-util-1.5.1
./configure--prefix=/usr/local/apr-util--WITH-APR=/USR/LOCAL/APR
Make && make install
4.3 Installing pcre
TAR-ZVXF pcre-8.32.tar.gz
CD pcre-8.32
./configure
Make && make install
4.4 Installing Pcre-devel
If it's already installed, pcre be sure to install it.
TAR–ZXVF pcre-devel-8.32.tar.gz
CD pcre-devel-8.32
./configure
Make && make install
The above several packages depend on each other, the order can not disorderly
4.5 Installation Apache must first install the above three or not compile
TAR-ZVXF httpd-2.4.4.tar.gz
CD httpd-2.4.4
./configure--PREFIX=/USR/LOCAL/APACHE–WITH-APR=/USR/LOCAL/APR--with-apr-util=/usr/local/apr-util
Make && make install
In this way, Apache is installed in the/usr/local/apache directory.
STEP5 start the Apche service. Since Apache has not been added to the Linux service startup, this time if you use the #service httpd start command to start Apache will report httpd service not found error.
After installing Apache in source code mode under Linux, booting off Apache can be accomplished by the following command:
/usr/local/apache/bin/apachectl Start | Stop | Restart
If ttpd:could not reliably determine the server ' s fully qualified domain name error, you need to modify the configuration file inside the ServiceName
Resolution steps: Vi/usr/local/apache/conf/http.conf the inside of the #servername examplename:80 comments removed, changed to ServerName localhost:80 can
Start service again:/usr/local/apache/bin/apachectl restart
HTTP://LOCALHOST:80 can then be accessed through a browser if the page displays "It works! ", which means that Apache has been installed and started successfully.
Step6 adding Apache to Linux services from startup
If you want to include httpd in a system-initiated service, you can copy the above apachectl files directly into/ETC/RC.D/INIT.D, and then add the links to the appropriate boot level, such as 3,5. The command is as follows:
Cp/usr/local/apache/bin/apachectl/etc/rc.d/init.d/httpd
Ln-s/etc/rc.d/init.d/httpd/etc/rc.d/rc3.d/s61httpd
The S61 of the linked file is the ordinal at startup. When the INIT.D directory has a httpd script, we can start off Apache by using the service command. Execute under Any path:
Service httpd Start | Stop | Restart
No hint was entered in the script, but the command was executed. The problem is this: Although Apache can start automatically, it is not visible in the list of Linux services, such as the Chkconfig--list instructions for running NTSYSV or Red Hat. To add services, generally through chkconfig--add xxx to achieve, but need to have the appropriate information in the script, otherwise chkconfig will prompt: XXX service does not support Chkconfig. So let's first edit the httpd script and add the following comment message on line 2nd:
# CHKCONFIG:35 61 61
# Description:apache
The 3 parameters for the first line are: at which RunLevel, start httpd (3,5), start sequence number (S61), and close ordinal (K61). Note: The description of the second line must be written!
Save after execution: Chkconfig--add httpd
The httpd is added to the service. S61HTTPD links will appear in the RC3.D, rc5.d path in the future, and k61httpd links will appear in other run-level paths.
Run Chkconfig--list to see the service of httpd.
STEP7 Configure the Http.conf file under/usr/local/apache/conf (backup first). Backup: #cp/usr/local/apache/conf/http.conf/usr/local/apache/conf/http.conf.bak
Then vi/usr/local/apache/conf/http.conf modify the following:
To edit httpd, add the following information to the second line:
# chkconfig:345 85 15
# description:activates/deactivates Apache Web Server
The above two sentences must be added, otherwise you will be prompted "httpd service does not support"; The first line has 3 numeric parameter meanings: Which Linux levels need to start httpd (3,4,5), start sequence number (85), turn off ordinal (15).
STEP8 Add boot information (Ubuntu differs from CentOS)
Chkconfig–add httpd
To see if a success was added
Chkconfig--list
At this point, Apache installation was successful, and Apache was added to boot.
HTTP://LOCALHOST:80 can then be accessed through a browser if the page displays "It works! ", which means that Apache has been installed and started successfully.
Linux Source extract Install Apache