linux安装http命令,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安装成功了~

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值