华为云鲲鹏服务器(ARM)编译安装apache

已邀请:

1.  安装gcc报错

Apache依赖gcc报,yum install gcc报:

Configure时报错:

 

Is this ok [y/d/N]: y

Downloading packages:

Delta RPMs disabled because /usr/bin/applydeltarpm not installed.

kernel-headers-4.14.0-115.7.1. FAILED                                         

http://mirrors.myhuaweicloud.com/centos-altarch/7/updates/aarch64/Packages/kernel-headers-4.14.0-115.7.1.el7a.aarch64.rpm: [Errno 14] HTTP Error 404 - Not Found

Trying other mirror.

To address this issue please refer to the below wiki article

https://wiki.centos.org/yum-errors

If above article doesn't help to resolve this issue please use https://bugs.centos.org/.

Error downloading packages:

  kernel-headers-4.14.0-115.7.1.el7a.aarch64: [Errno 256] No more mirrors to try.

下载:https://mirrors.huaweicloud.com/centos-altarch/7.6.1810/updates/aarch64/Packages/

kernel-headers-4.14.0-115.7.1.el7a.aarch64.rpm

2.  安装apr-1.7.0报错

安装apr-1.6 rm cannot remove `libtoolT'报错

config.status: creating include/arch/unix/apr_private.h

config.status: executing libtool commands

rm: cannot remove 'libtoolT': No such file or directory

config.status: executing default commands

 

解决办法:

在目录下我们找到configure这个配置文件

编辑配置文件,在配置文件中找到RM='$RM'这一行 修改为RM='$RM -f',修改完成后保存

/uploads/files_user1/answer/5ed613c01b3fd687936.png

修改完成后再重新进行编译,如下图,编译完成后不会报错了


3.  安装apr-util-1.6.1报错

1、Make时错误信息:

& touch xml/apr_xml.lo

xml/apr_xml.c:35:19: fatal error: expat.h: No such file or directory

 #include <expat.h>

 

安装yum install expat-devel


2、Make时报错:

root@deepin:/data/mrd/apr-util-1.6.1# make

make[1]: Entering directory '/data/mrd/apr-util-1.6.1'

/bin/bash /data/test/apr/build-1/libtool --silent --mode=compile gcc -g -O2 -pthread   -DHAVE_CONFIG_H  -DLINUX -D_REENTRANT -D_GNU_SOURCE   -I/data/mrd/apr-util-1.6.1/include -I/data/mrd/apr-util-1.6.1/include/private  -I/data/test/apr/include/apr-1    -o xml/apr_xml.lo -c xml/apr_xml.c && touch xml/apr_xml.lo

xml/apr_xml.c:35:19: fatal error: expat.h: 没有那个文件或目录

 #include <expat.h>


compilation terminated.

/data/mrd/apr-util-1.6.1/build/rules.mk:206: recipe for target 'xml/apr_xml.lo' failed

make[1]: *** [xml/apr_xml.lo] Error 1

make[1]: Leaving directory '/data/mrd/apr-util-1.6.1'

/data/mrd/apr-util-1.6.1/build/rules.mk:118: recipe for target 'all-recursive' failed

make: *** [all-recursive] Error 1

 

如果使用方法一下载不到expat,手动安装expat-2.2.6.tar.bz2,并且执行./config 时执行指定expat路径:  -with-expat=的安装路径



4.  安装pcre-8.43报错

Configure时报错:

checking windows.h presence... no

checking for windows.h... no

configure: error: Invalid C++ compiler or C++ compiler flags

 

安装yum install -y gcc gcc-c++

yum install curl

yum install libxml2-devel

 

 

5.  安装httpd-2.4.39报错

[root@ecs-6508 httpd-2.4.39]# ./configure --prefix=/data/apache/apache --enable-so --enable-rewrite=shared --enable-proxy=shared --with-apr=/data/apache/apr --with-apr-util=/data/apache/apr-util --with-pcre=/data/apache/pcre

Make时候报错:

/data/apache/apr-util/lib/libaprutil-1.so: undefined reference to `XML_ErrorString'

/data/apache/apr-util/lib/libaprutil-1.so: undefined reference to `XML_SetElementHandler'

collect2: error: ld returned 1 exit status

make[2]: *** [htpasswd] Error 1

make[2]: Leaving directory `/data/nccsetup/tools/httpd-2.4.39/support'

make[1]: *** [all-recursive] Error 1

make[1]: Leaving directory `/data/nccsetup/tools/httpd-2.4.39/support'

make: *** [all-recursive] Error 1

 

[root]# yum install -y libxml2-devel

[root]# rm -rf /usr/local/apr-util

 [root]# make clean

[root]# ./configure --prefix=/data/apache/apr-util --with-apr=/data/apache/apr

[root]# make

[root]# make install



6.  源码编译生成mod_jk.so文件

下载地址:http://tomcat.apache.org/download-connectors.cgi

/uploads/files_user1/answer/5ed6145d9eb15485478.png

操作系统没有apxs

apxs 只有在以源代码包方式编译安装的才有

解决办法:

#yum install httpd-devel

    安装之后 就有apxs了

    whereis apxs 来查看路径


编译源文件:

# cd /data/install/tomcat-connectors-1.2.46-src/native

#./configure --with-apxs=/usr/bin/apxs

Configure时抛异常

configure: error: in `/data/install/tomcat-connectors-1.2.46-src/native':

configure: error: C compiler cannot create executables

See `config.log' for more details

解决办法:

# yum install libgcc

#./configure --with-apxs=/usr/bin/apxs

#make

完成编译后,在/usr/local/tomcat-connectors-1.2.42-src/native/apache-2.0文件夹下可以找到mod_jk.so文件


7.  安装ssl模块

先安装的apache为安装ssl,再次重新编译时提示如下:

#./configure --prefix=/data/test/apache1 --enable-so --enable-rewrite=shared --enable-proxy=shared --with-apr=/data/test/apr --with-apr-util=/data/test/apr-util --with-pcre=/data/test/pcre       --enable-ssl --with-ssl

 

 

adding "-L/usr/lib/ssl/lib" to LDFLAGS

  setting MOD_LDFLAGS to "-L/usr/lib/ssl/lib"

checking for OpenSSL version >= 0.9.8a... FAILED

configure: WARNING: OpenSSL version is too old

no

checking whether to enable mod_ssl... configure: error: mod_ssl has been requested but can not be built due to prerequisite failures

 

解决办法:

下载openssl-1.1.1c.tar.gz 进行编译安装

#./config  --prefix=/usr/local --openssldir=/usr/local/ssl

#make & make install

再次执行config时,ssl编译通过

 

2.  配置问ssl后,启动apache报错

[root@nccloud1909-arm bin]# ./apachectl start

httpd: Syntax error on line 134 of /data/test/apache1/conf/httpd.conf: Cannot load modules/mod_ssl.so into server: libssl.so.1.1: cannot open shared object file: No such file or directory

 

解决办法:

切换到openssl目录/usr/local/bin

[root@nccloud1909-arm bin]#  ldd openssl

        linux-vdso.so.1 =>  (0x0000ffffa7bb0000)

        libssl.so.1.1 => not found

        libcrypto.so.1.1 => not found

        libdl.so.2 => /lib64/libdl.so.2 (0x0000ffffa7b60000)

        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000ffffa7b20000)

        libc.so.6 => /lib64/libc.so.6 (0x0000ffffa7990000)

        /lib/ld-linux-aarch64.so.1 (0x0000ffffa7bc0000)

在openssl目录/usr/local/lib路径下找到libcrypto.so.1.1

[root@nccloud1909-arm lib]# export LD_LIBRARY_PATH="/usr/local/lib/:$LD_LIBRARY_PATH"

 

[root@nccloud1909-arm bin]#  ldd openssl

        linux-vdso.so.1 =>  (0x0000ffffbcd50000)

        libssl.so.1.1 => /usr/local/lib/libssl.so.1.1 (0x0000ffffbcc90000)

        libcrypto.so.1.1 => /usr/local/lib/libcrypto.so.1.1 (0x0000ffffbc9c0000)

        libdl.so.2 => /lib64/libdl.so.2 (0x0000ffffbc980000)

        libpthread.so.0 => /lib64/libpthread.so.0 (0x0000ffffbc940000)

        libc.so.6 => /lib64/libc.so.6 (0x0000ffffbc7b0000)

        /lib/ld-linux-aarch64.so.1 (0x0000ffffbcd60000)

在次启动正常

 

 




要回复问题请先登录注册