linux安装httpd软件包命令
linux安装httpd软件包命令
学习啦在线学习网 linux系统下httpd软件包的安装对于很多初学者来说是个难题,下面由学习啦小编为大家整理了linux下安装httpd软件包命令的相关知识,希望大家喜欢!
linux下安装httpd软件包命令
首先先了解一下编译安装的基本步骤 注意:可以仔细阅读README和 INSTALL文件的信息,了解有关副
学习啦在线学习网 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
出现了这种错误
/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服务
体验
用elinks 或者firefox输入自己的IP地址 登入自己的服务器。
补充:linux安装apache(http服务)
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模式(动态模块加载方式)
--enable-rewrite 支持rewrite(地址重定向)
学习啦在线学习网 等这些都装完后,打开浏览器,输入你安装apache所在的服务器地址,看起来像这个样子:
学习啦在线学习网 http://192.168.1.3/
学习啦在线学习网 如果页面显示如下:
It works!
学习啦在线学习网 恭喜你,apache安装成功了~