Linux Centos7 Apache2.4 离线安装步骤详情

【安装步骤】

下载地址:

apcahe: http://httpd.apache.org/download.cgi#apache24

apr/apr-util:http://apr.apache.org/download.cgi

http://mirror.centos.org/centos/7/os/x86_64/Packages/expat-devel-2.1.0-11.el7.x86_64.rpm

http://mirror.centos.org/centos/7/os/x86_64/Packages/pcre-devel-8.32-17.el7.x86_64.rpm

下载Apache安装包,解压到指定目录
下载apr和apr-util压缩包 解压后移动至apache下面的srclib目录中即可

  1. mv /mnt/apr-1.6.3 /mnt/httpd-2.4.33/srclib/apr

  2. mv /mnt/apr-util-1.6.1 /mnt/httpd-2.4.33/srclib/apr-util

下载 pcre-devel-8.32-17.el7.x86_64.rpm 并安装

rpm -ivh pcre-devel-8.32-17.el7.x86_64.rpm --nodeps


下载expat-devel-2.1.0-10.el7_3.x86_64.rpm 并安装

rpm -ivh expat-devel-2.1.0-10.el7_3.x86_64.rpm --nodeps

切换目录到Apache-2.4.33下,执行:

  1. ./configure --prefix=/usr/local/apache  --with-included-apr

  2. make && make install

启动apache 切换到/usr/local/apache,

修改conf/http.conf 中的ServerName为localhost

bin/apachectl start

访问ip查看Apache是否安装成功;
注意开放防火墙端口: firewall-cmd --zone=public --add-port=80/tcp --permanent

Apache设为服务并开机自启:


cp /usr/local/apache/bin/apachectl /etc/rc.d/init.d/httpd


编辑/etc/rc.d/init.d/httpd 文件,增加

#chkconfig:35 61 61

#description:Apache


测试:service httpd stop //关闭 然后访问ip 发现页面无法访问;

service httpd start 访问ip 页面恢复正常,It works!

文档中提到的文件包下载链接:https://download.csdn.net/download/qq_36896749/10942001 

也可在官网直接下载相应文件使用

 

【安装报错】:

1、apache安装报错undefined reference ssl

因为SSL发现漏洞,需要更换openssl-1.0.1g版本,编译安装后,apache httpd2.4.9提示还是旧版本的SSL,于是重新编译安装apache httpd,configure没有报错,但make的时候报如下错误:

/software/httpd-2.4.9/support/ab.c:735: undefined reference to `SSL_write'
ab.o: In function `ssl_proceed_handshake':
/software/httpd-2.4.9/support/ab.c:650: undefined reference to `SSL_do_handshake'
/software/httpd-2.4.9/support/ab.c:651: undefined reference to `SSL_get_error'
ab.o: In function `ssl_print_info':
/software/httpd-2.4.9/support/ab.c:623: undefined reference to `SSL_get_peer_cert_chain'
/software/httpd-2.4.9/support/ab.c:631: undefined reference to `SSL_get_peer_certificate'
ab.o: In function `ssl_print_connection_info':
/software/httpd-2.4.9/support/ab.c:572: undefined reference to `SSL_get_version'
/software/httpd-2.4.9/support/ab.c:574: undefined reference to `SSL_get_current_cipher'
/software/httpd-2.4.9/support/ab.c:575: undefined reference to `SSL_CIPHER_get_version'
/software/httpd-2.4.9/support/ab.c:576: undefined reference to `SSL_CIPHER_get_name'
/software/httpd-2.4.9/support/ab.c:578: undefined reference to `SSL_CIPHER_get_bits'
ab.o: In function `ssl_print_info':
/software/httpd-2.4.9/support/ab.c:640: undefined reference to `SSL_get_session'
/software/httpd-2.4.9/support/ab.c:640: undefined reference to `SSL_SESSION_print'
ab.o: In function `ssl_proceed_handshake':
/software/httpd-2.4.9/support/ab.c:662: undefined reference to `SSL_get_current_cipher'
/software/httpd-2.4.9/support/ab.c:663: undefined reference to `SSL_CIPHER_get_bits'
/software/httpd-2.4.9/support/ab.c:664: undefined reference to `SSL_get_peer_certificate'
/software/httpd-2.4.9/support/ab.c:671: undefined reference to `SSL_CIPHER_get_name'
/software/httpd-2.4.9/support/ab.c:671: undefined reference to `SSL_get_version'
ab.o: In function `start_connect':
/software/httpd-2.4.9/support/ab.c:1278: undefined reference to `SSL_new'
/software/httpd-2.4.9/support/ab.c:1286: undefined reference to `SSL_set_bio'
/software/httpd-2.4.9/support/ab.c:1287: undefined reference to `SSL_set_connect_state'
ab.o: In function `close_connection':
/software/httpd-2.4.9/support/ab.c:1369: undefined reference to `SSL_shutdown'
/software/httpd-2.4.9/support/ab.c:1370: undefined reference to `SSL_free'
ab.o: In function `read_connection':
/software/httpd-2.4.9/support/ab.c:1395: undefined reference to `SSL_read'
/software/httpd-2.4.9/support/ab.c:1397: undefined reference to `SSL_get_error'
ab.o: In function `test':
/software/httpd-2.4.9/support/ab.c:1810: undefined reference to `SSL_state'
ab.o: In function `ssl_state_cb':
/software/httpd-2.4.9/support/ab.c:511: undefined reference to `SSL_state_string_long'
/software/httpd-2.4.9/support/ab.c:511: undefined reference to `SSL_state'
/software/httpd-2.4.9/support/ab.c:506: undefined reference to `SSL_alert_desc_string_long'
/software/httpd-2.4.9/support/ab.c:506: undefined reference to `SSL_alert_type_string_long'
/software/httpd-2.4.9/support/ab.c:515: undefined reference to `SSL_state_string_long'
ab.o: In function `main':
/software/httpd-2.4.9/support/ab.c:2092: undefined reference to `SSLv23_client_method'
/software/httpd-2.4.9/support/ab.c:2367: undefined reference to `SSL_load_error_strings'
/software/httpd-2.4.9/support/ab.c:2368: undefined reference to `SSL_library_init'
/software/httpd-2.4.9/support/ab.c:2372: undefined reference to `SSL_CTX_new'
/software/httpd-2.4.9/support/ab.c:2377: undefined reference to `SSL_CTX_ctrl'
/software/httpd-2.4.9/support/ab.c:2380: undefined reference to `SSL_CTX_ctrl'
/software/httpd-2.4.9/support/ab.c:2383: undefined reference to `SSL_CTX_set_cipher_list'
/software/httpd-2.4.9/support/ab.c:2308: undefined reference to `SSLv2_client_method'
/software/httpd-2.4.9/support/ab.c:2305: undefined reference to `SSLv23_client_method'
/software/httpd-2.4.9/support/ab.c:2390: undefined reference to `SSL_CTX_set_info_callback'
/software/httpd-2.4.9/support/ab.c:2314: undefined reference to `TLSv1_1_client_method'
/software/httpd-2.4.9/support/ab.c:2311: undefined reference to `SSLv3_client_method'
/software/httpd-2.4.9/support/ab.c:2316: undefined reference to `TLSv1_2_client_method'
/software/httpd-2.4.9/support/ab.c:2319: undefined reference to `TLSv1_client_method'
collect2: ld returned 1 exit status
make[2]: *** [ab] 错误 1
make[2]: Leaving directory `/software/httpd-2.4.9/support'
make[1]: *** [all-recursive] 错误 1
make[1]: Leaving directory `/software/httpd-2.4.9/support'
make: *** [all-recursive] 错误 1

 

检查发现是configure的时候没有添加--with-ssl=/usr/local/openssl-1.0.1g(重新编译安装后openssl的路径)的路径,添加后可解决以上报错的问题。

./configure --prefix=/home/apache-249  --enable-ssl --with-ssl=/usr/local/openssl-1.0.1g --with-pcre=/usr/local/pcre --with-apr=/usr/local/apr --with-apr-util=/usr/local/apr-util --enable-so  --enable-rewrite --enable-modules=most --enable-mods-shared=most --enable-mpms-shared=all --with-mpm=event

如果不使用ssl,也可以在编译时候去掉 --enable-ssl --with-ssl=/usr/local/openssl-1.0.1g,加上 --disable-ssl

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值