Apache 2.4.x手动构建并安装在RHEL 6.4上 [英] Apache 2.4.x manual build and install on RHEL 6.4

查看:104
本文介绍了Apache 2.4.x手动构建并安装在RHEL 6.4上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

OS:Red Hat Enterprise Linux Server 6.4版(圣地亚哥)

OS: Red Hat Enterprise Linux Server release 6.4 (Santiago)

在此操作系统上,当前的apum yum安装为2.2.15.我需要最新的2.4.x分支,所以已经开始手动安装了.我已经注意到了我执行的完整过程,包括事先将aprapr-util源解压缩到apache源中,但是我想以下是该过程中最重要的部分:

The current yum installation of apache on this OS is 2.2.15. I require the latest 2.4.x branch so have gone about installing it manually. I have noted the complete procedure I undertook, including unpacking apr and apr-util sources into the apache sources beforehand, but I guess the following is the most important part of the procedure:

GATHER LATEST APACHE AND APR
$ cd ~
$ mkdir apache-src
$ cd apache-src
$ wget http://apache.insync.za.net//httpd/httpd-2.4.6.tar.gz
$ tar xvf httpd-2.4.6.tar.gz
$ cd httpd-2.4.6
$ cd srclib
$ wget http://apache.insync.za.net//apr/apr-1.5.0.tar.gz
$ tar -xvzf apr-1.5.0.tar.gz
$ mv apr-1.5.0 apr
$ rm -f apr-1.5.0.tar.gz
$ wget http://apache.insync.za.net//apr/apr-util-1.5.3.tar.gz
$ tar -xvzf apr-util-1.5.3.tar.gz 
$ mv apr-util-1.5.3 apr-util

INSTALL DEVEL PACKAGES
yum update --skip-broken (There is a dependency issue with the latest Chrome needing the latest libstdc++, which is not available for RHEL and CentOS)
yum install apr-devel
yum install apr-util-devel
yum install pcre-devel

INSTALL
$ cd ~/apache-src/httpd-2.4.6
$ ./configure --prefix=/etc/httpd --enable-mods-shared="all" --enable-rewrite --with-included-apr
$ make
$ make install

注意:在执行上述操作时,/etc/http为空.

在我尝试启动httpd服务之前,这似乎还不错.似乎httpd.conf中包含的每个模块都失败,并显示与mod_rewrite相同的消息:

This seems to have gone fine until I attempt to start the httpd service. It seems that every module include in httpd.conf fails with a message similar to this one for mod_rewrite:

httpd: Syntax error on line 148 of /etc/httpd/conf/httpd.conf: Cannot load /etc/httpd/modules/mod_rewrite.so into server: /etc/httpd/modules/mod_rewrite.so: undefined symbol: ap_global_mutex_create

我已经遍历了httpd.conf中启用的模块列表,并一次将它们注释掉了.所有这些都会触发如上所述的错误,但是未定义的符号:值"通常是不同的(因此并不总是ap_global_mutex_create).

I've gone right through the list of enabled modules in httpd.conf and commented them out one at a time. All trigger an error as above, however the "undefined symbol: value" is often different (so not always ap_global_mutex_create).

我错过了一步吗?尽管我在Google上发现了部分错误,但大多数解决方案都是围绕.so文件无法访问.在这里这似乎不是问题,并且模块在/etc/http/modules中存在.

Am I missing a step? Although I find a some portion of that error on Google, most of the solutions centre around the .so files not being reachable. That doesn't seem to be an issue here and the modules are present in /etc/http/modules.

注意:在执行上述操作时,/etc/http为空.

推荐答案

您的步骤正确,但程序不完整.

You have the correct procedure but it's incomplete.

安装后,您必须在 httpd.conf 中启用SSL.并生成 server.crt server.key 文件. 下面是完整步骤:

After the installation you have to enable SSL in httpd.conf. and generate server.crt and server.key file. Below the complete procedure :

1.下载Apache

cd /usr/src
wget http://www.apache.org/dist/httpd/httpd-2.4.23.tar.gz
tar xvf httpd-2.4.23.tar.gz

2.下载APR和APR-Util

cd /usr/src
wget -c http://mirror.cogentco.com/pub/apache/apr/apr-1.5.2.tar.gz
wget -c http://mirror.cogentco.com/pub/apache/apr/apr-util-1.5.4.tar.gz
tar xvf apr-1.5.2.tar.gz
tar xvf apr-util-1.5.4.tar.gz

现在将您下载的APR和APR-Util放入apache源文件中.

Now put the APR and APR-Util you downloaded into your apache source files.

mv apr-1.5.2 /usr/src/httpd-2.4.23/srclib/apr
mv apr-util-1.5.4 /usr/src/httpd-2.4.23/srclib/apr-util

3.编译

cd /usr/src/httpd-2.4.23
./configure --enable-so --enable-ssl --with-mpm=prefork --with-included-apr --with-included-apr-util
make
make install

您可以在./configure命令中看到,我们指定了命令行选项以包含apr和apr-utils.

As you can see in the ./configure command we specify command line options to include apr and apr-utils.

4.在httpd.conf

Apache配置文件 httpd.conf 位于/usr/local/apache2/conf 下.

Apache configuration file httpd.conf is located under /usr/local/apache2/conf.

nano /usr/local/apache2/conf/httpd.conf

取消注释/usr/local/apache2/conf/httpd.conf 文件中的 httpd-ssl.conf 包含行和LoadModule ssl_module行:

Uncomment the httpd-ssl.conf Include line and the LoadModule ssl_module line in the /usr/local/apache2/conf/httpd.conf file :

# LoadModule ssl_module modules/mod_ssl.so
# Include conf/extra/httpd-ssl.conf

查看 httpd-ssl.conf 以查看所有默认的SSL配置.
在大多数情况下,您无需修改​​此文件中的任何内容.

View the httpd-ssl.conf to review all the default SSL configurations.
For most cases, you don’t need to modify anything in this file.

nano /usr/local/apache2/conf/extra/httpd-ssl.conf

启动Apache之前,需要SSL证书和密钥.
httpd-ssl.conf 中提到的 server.crt server.key 文件需要先创建,然后再继续.

The SSL certificate and key are required before we start the Apache.
The server.crt and server.key file mentioned in the httpd-ssl.conf needs to be created before we move forward.

cd /usr/local/apache2/conf/extra
egrep 'server.crt|server.key' httpd-ssl.conf

SSLCertificateFile "/usr/local/apache2/conf/server.crt"
SSLCertificateKeyFile "/usr/local/apache2/conf/server.key"

5.生成server.crt和server.key文件

首先,使用openssl生成 server.key .

First, Generate the server.key using openssl.

cd /usr/src
openssl genrsa -des3 -out server.key 1024

以上命令将要求输入密码.确保记住该密码.您需要在稍后启动Apache时使用它.

The above command will ask for the password. Make sure to remember this password. You need this while starting your Apache later.

接下来,使用上面的 server.key 文件生成一个证书请求文件( server.csr ).

Next, generate a certificate request file (server.csr) using the above server.key file.

openssl req -new -key server.key -out server.csr

最后,使用上述 server.key server.csr 文件生成一个自签名的ssl证书( server.crt ).

Finally, generate a self signed ssl certificate (server.crt) using the above server.key and server.csr file.

openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt

server.key server.crt 文件复制到相应的Apache配置目录位置.

Copy the server.key and server.crt file to appropriate Apache configuration directory location.

cp server.key /usr/local/apache2/conf/
cp server.crt /usr/local/apache2/conf/

6.启动Apache

/usr/local/apache2/bin/apachectl start

如果收到以下错误消息:

If you are getting the below error message :

AH00526: Syntax error on line 51 of /usr/local/apache2/conf/extra/httpd-ssl.conf:
Invalid command 'SSLCipherSuite', perhaps misspelled or defined by a module not included in the server configuration

确保取消注释 httpd.conf 中下面显示的行:

Make sure to uncomment the line shown below in httpd.conf :

vi /usr/local/apache2/conf/httpd.conf

# LoadModule socache_shmcb_module modules/mod_socache_shmcb.so

最后,这将提示您在启动apache之前输入私钥的密码. 验证Apache httpd进程是否在后台运行.

Finally, this will prompt you to enter the password for your private key before starting up the apache. Verify that the Apache httpd process is running in the background.

ps -ef | grep http

您应该看到类似的内容:

You should see something like that :

root    29529 1     0 13:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
antoine 29530 29529 0 13:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
antoine 29531 29529 0 13:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
antoine 29532 29529 0 13:08 ? 00:00:00 /usr/local/apache2/bin/httpd -k start
root    29616 18260 0 13:09 pts/0 00:00:00 grep http

默认情况下,Apache SSL在443端口上运行.打开Web浏览器,并确认您可以使用 https://{您的IP地址}

By default Apache SSL runs on 443 port. Open a web browser and verify that you can access your Apache using https://{your-ip-address}

希望获得帮助,否则我建议您去看看:

I hope this help, else I advise you to go see : http://jasonpowell42.wordpress.com/2013/04/05/install-apache-2-4-4-on-centos-6-4/

这篇关于Apache 2.4.x手动构建并安装在RHEL 6.4上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆