80.LAMP中的apache安裝
Apache是世界使用排名第一的Web服務器軟件。它可以運行在幾乎所有廣泛使用的計算機平臺上,由於其跨平臺和安全性被廣泛使用,是最流行的Web服務器端軟件之一。它快速、可靠並且可通過簡單的API擴充,將Perl/Python等解釋器編譯到服務器中。同時Apache音譯為阿帕奇,是北美印第安人的一個部落,叫阿帕奇族,在美國的西南部。也是一個基金會的名稱、一種武裝直升機等等
操作系統版本
[root@localhost src]# uname -a
Linux localhost.localdomain 3.10.0-123.el7.x86_64 #1 SMP Mon Jun 30 12:09:22 UTC 2014 x86_64 x86_64 x86_64 GNU/Linux
獲取鏈接
apache官方網址:www.apache.org
2.2源碼包: http://mirrors.cnnic.cn/apache/httpd/httpd-2.2.34.tar.gz
2.4源碼包: http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz
apr: http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz
apr-util: https://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz
PS:apr和apr-util是一個通用的函數庫,它讓httpd可以不關心底層的操作系統平臺,可以方便移植(Linux移植到Windows)
apache安裝條件:必須先安裝gcc包、pcre包、apr與apr-util;
一:安裝下列7個包 yum -y install gcc yum -y install expat-devel yum install -y pcre-devel yum install -y libxml2-devel wget http://mirrors.cnnic.cn/apache/httpd/httpd-2.4.29.tar.gz wget apr: http://mirrors.cnnic.cn/apache/apr/apr-1.6.3.tar.gz wget apr-util: https://mirrors.cnnic.cn/apache/apr/apr-util-1.6.1.tar.gz
二:進行安裝apr包,
[root@localhost apr-1.6.3]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.6.3]# echo $?
[root@localhost apr-1.6.3]# 0
[root@localhost apr-1.6.3]# make $$ install make
[root@localhost apr-1.6.3]# ls /usr/local/apr/
bin build-1 include lib
[root@localhost apr-1.6.3]#
三:安裝apr-util包
[root@localhost src]# cd apr-util-1.6.1
[root@localhost apr-util-1.6.1]#
[root@localhost apr-util-1.6.1]# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
[root@localhost apr-util-1.6.1]# echo $?
[root@localhost apr-util-1.6.1]# 0
[root@localhost apr-util-1.6.1]#make
[root@localhost apr-util-1.6.1]#echo $?
[root@localhost apr-util-1.6.1]#make install
[root@localhost apr-util-1.6.1]# ls /usr/local/apr-util/
bin include lib
[root@localhost apr-util-1.6.1]#
四:安裝apache(http)
[root@localhost src]#
[root@localhost src]# cd httpd-2.4.29/
[root@localhost httpd-2.4.29]# ./configure --prefix=/usr/local/apache2.4 --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-mods-shared=most
[root@localhost httpd-2.4.29]# echo $?
[root@localhost httpd-2.4.29]# make
[root@localhost httpd-2.4.29]# echo $?
[root@localhost httpd-2.4.29]# make install
五:開啟apache
/usr/local/apache2.4/bin/apachectl start
PS:如果在啟動過程中遇到錯誤的話 參考 下面的鏈接
http://blog.csdn.net/zhaomininternational/article/details/42293511
檢測端口
[root@localhost conf]# ps aux |grep httpd
root 34738 0.0 0.4 71400 2136 ? Ss 02:30 0:00 /usr/local/apache2.4/bin/httpd -k start
daemon 34739 0.0 0.8 360364 4248 ? Sl 02:30 0:00 /usr/local/apache2.4/bin/httpd -k start
daemon 34740 0.0 0.8 360364 4248 ? Sl 02:30 0:00 /usr/local/apache2.4/bin/httpd -k start
daemon 34741 0.0 0.8 360364 4248 ? Sl 02:30 0:00 /usr/local/apache2.4/bin/httpd -k start
root 34824 0.0 0.1 112676 984 pts/0 S+ 02:30 0:00 grep --color=auto http
[root@localhost conf]#
查看所加載的模塊
[root@localhost conf]# /usr/local/apache2.4/bin/httpd -M
Loaded Modules:
core_module (static)
so_module (static)
http_module (static)
mpm_event_module (static)
authn_file_module (shared)
authn_core_module (shared)
authz_host_module (shared)
authz_groupfile_module (shared)
authz_user_module (shared)
authz_core_module (shared)
access_compat_module (shared)
auth_basic_module (shared)
reqtimeout_module (shared)
filter_module (shared)
mime_module (shared)
log_config_module (shared)
env_module (shared)
headers_module (shared)
setenvif_module (shared)
version_module (shared)
unixd_module (shared)
status_module (shared)
autoindex_module (shared)
dir_module (shared)
alias_module (shared)
[root@localhost conf]#
80.LAMP中的apache安裝