linux安裝httpd軟件包命令
linux安裝httpd軟件包命令
linux系統(tǒng)下httpd軟件包的安裝對于很多初學(xué)者來說是個難題,下面由學(xué)習(xí)啦小編為大家整理了linux下安裝httpd軟件包命令的相關(guān)知識,希望大家喜歡!
linux下安裝httpd軟件包命令
首先先了解一下編譯安裝的基本步驟 注意:可以仔細(xì)閱讀README和 INSTALL文件的信息,了解有關(guān)副
INSTALL文件里說明的步驟
$ ./configure --prefix=PREFIX
$ make
$ make install
$ PREFIX/bin/apachectl start
以httpd軟件為例。
1.首先獲得
httpd-2.4.4.tar.gz
apr-1.5.0.tar.gz
pcre-8.21.tar.bz2
apr-util-1.5.3.tar.gz
2.解壓
[root@localhost http]# tar xf httpd-2.4.9.tar.bz2
3.安裝
[root@localhost httpd-2.4.4]# ./configure --help 可以查看你需要那些功能,以更好的滿足你的需求
[root@localhost httpd-2.4.9]# ./configure --prefix=/usr/local/ --enable-so --enable-cache
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... no
configure: error: APR not found. Please read the documentation.
此時缺少APR包,缺什么就裝什么
[root@localhost http]# tar xf apr-1.5.0.tar.gz
[root@localhost apr-1.5.0]# ./configure --prefix=/usr/local/apr
[root@localhost apr-1.5.0]# make
[root@localhost apr-1.5.0]# make install
再次進入http-2.4.9的文件夾進行編譯
[root@localhost httpd-2.4.9]# ./configure --prefix=/usr/local/ --enable-so --enable-cache
checking for chosen layout... Apache
checking for working mkdir -p... yes
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking target system type... x86_64-unknown-linux-gnu
configure:
configure: Configuring Apache Portable Runtime library...
configure:
checking for APR... yes
setting CC to "gcc"
setting CPP to "gcc -E"
setting CFLAGS to " -g -O2 -pthread"
setting CPPFLAGS to " -DLINUX -D_REENTRANT -D_GNU_SOURCE"
setting LDFLAGS to " "
configure:
configure: Configuring Apache Portable Runtime Utility library...
configure:
checking for APR-util... no
configure: error: APR-util not found. Please read the documentation.
此時缺少APR-util包,缺什么裝什么
[root@localhost http]# tar xf apr-util-1.5.3.tar.gz
[root@localhost apr-util-1.5.3]# ./configure --with-apr=/usr/local/apr/ 此處需要注意選項
[root@localhost apr-util-1.5.3]# make
[root@localhost apr-util-1.5.3]# make install
再次進入http-2.4.9安裝
[root@localhost httpd-2.4.9]# ./configure --prefix=/usr/local/ --enable-so --enable-cache
出現(xiàn)了這種錯誤
/apache --enable-cache --enable-so
......
configure: error: pcre-config for libpcre not found. PCRE is required and available from http://pcre.org/
此時需要安裝pcre-8.21.tar.bz2
[root@localhost httpd]# tar xf pcre-8.21.tar.bz2
[root@localhost pcre-8.21]# ./configure
[root@localhost pcre-8.21]# make ;make install
libtool: compile: unrecognized option `-DHAVE_CONFIG_H‘
libtool: compile: Try `libtool --help‘ for more information.
make[1]: *** [pcrecpp.lo] 錯誤 1
make[1]: Leaving directory `/meng/httpd/pcre-8.21‘
make: *** [all] 錯誤 2
source=‘pcrecpp.cc‘ object=‘pcrecpp.lo‘ libtool=yes \
DEPDIR=.deps depmode=none /bin/sh ./depcomp \
/bin/sh ./libtool --tag=CXX --mode=compile -DHAVE_CONFIG_H -I. -c -o pcrecpp.lo pcrecpp.cc
libtool: compile: unrecognized option `-DHAVE_CONFIG_H‘
libtool: compile: Try `libtool --help‘ for more information.
make: *** [pcrecpp.lo] 錯誤 1
[root@localhost pcre-8.21]# yum install gcc-c++
再來一次
[root@localhost httpd]# rm -rf pcre-8.21
[root@localhost httpd]# tar xf pcre-8.21.tar.bz2
[[root@localhost pcre-8.21]# ./configure [root@localhost pcre-8.21]# make ;make install
[root@localhost httpd-2.4.9]# ./configure --prefix=/usr/local/apache --enable-so --enable-cache
總算成功了
[root@localhost httpd-2.4.9]# make;make install 安裝成功
[root@localhost httpd-2.4.9]# vim /usr/local/apache/conf/httpd.conf
189G
ServerName www.feng.com:80 去掉#,增加域名
[root@localhost httpd-2.4.9]# /usr/local/bin/apachectl start 啟動httpd服務(wù)
體驗
用elinks 或者firefox輸入自己的IP地址 登入自己的服務(wù)器。
補充:linux安裝apache(http服務(wù))
1. 從apache.org下載源碼安裝包
2. 解壓縮
# tar zxf httpd-2.2.4.tar.gz
# cd httpd-2.2.4
3. 安裝apache依賴包apr和apr-util,他們都在srclib目錄中
3.1 安裝apr
# cd srclib/apr
# ./configure --prefix=/usr/local/apr
# make
# make install
3.2 安裝apr-util
# cd ../apr-util
# ./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr
# make
# make install
4.安裝httpd
# cd ../../
# ./configure --prefix=/usr/local/httpd --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so --enable-rewrite
# make
# make install
--enable-so 支持DSO模式(動態(tài)模塊加載方式)
--enable-rewrite 支持rewrite(地址重定向)
等這些都裝完后,打開瀏覽器,輸入你安裝apache所在的服務(wù)器地址,看起來像這個樣子:
http://192.168.1.3/
如果頁面顯示如下:
It works!
恭喜你,apache安裝成功了~