centos7.0安装apr

建议是看完文章后再去安装

http://apr.apache.org/ 下去这个网站下载

apr-1.6.2.tar.gz
apr-iconv-1.2.1.tar.gz
apr-util-1.6.0.tar.gz

安装apr

1)安装apr
tar zxvf apr-1.6.2.tar.gz
cd apr-1.6.2
./configure --prefix=/usr/local/apr
make
make install

2)安装apr-iconv
程序代码
tar -zxvf apr-iconv-1.2.1.tar.gz
cd apr-iconv-1.2.1
./configure --prefix=/usr/local/apr-iconv --with-apr=/usr/local/apr
make
make install

3)安装apr-util
程序代码
tar zxvf apr-util-1.6.0.tar.gz
cd apr-util-1.6.0
./configure --prefix=/usr/local/apr-util --with-apr=/usr/local/apr --with-apr-iconv=/usr/local/apr-iconv/bin/apriconv
make
make install

在安装apr-util出现

xml/apr_xml.c:35:19: fatal error: expat.h: 没有那个文件或目录
 #include <expat.h>
                   ^
compilation terminated.
make[1]: *** [xml/apr_xml.lo] 错误 1
make[1]:正在离开目录 `/home/linwen/apr/apr-util-1.6.0'
make: *** [all-recursive] 错误 1

安装expat库试试。yum install expat-devel

ubuntu 找不到就安装apt-get install libexpat1-dev

4)安装tomcat-native
程序代码
tar zxvf tomcat-native-1.1.20-src.tar.gz
cd tomcat-native-1.1.20-src/jni/native  
./configure --with-apr=/usr/local/apr --with-java-home=/usr/java/jdk1.6.0_23
make
make install


5)添加环境变量
vi /etc/profile #在他文件末尾处添加下面的变量
# apr
export LD_LIBRARY_PATH=/usr/local/apr/lib
执行
source /etc/profile
此时环境变量生效果

echo export LD_LIBRARY_PATH=/usr/local/apr/lib >> .bash_profile

source .bash_profile

tomcat-native是关联到apr的,所以安装目录是指向apr的,apr安装在/usr/local/apr

安装tomcat-native配置的./configure --with-apr=/usr/local/apr --with-java-home=/usr/java/jdk1.6.0_23 ,默认是安装在/usr/local/apr的。自定义安装的时候

--prefix=/usr/local/apr和apr要同一个地址

安装出现的问题:

zlib.h: No such file or directory

yum install zlib-devel

安装成功之后启动tomcat出现

SEVERE: Failed to initialize the SSLEngine.
org.apache.tomcat.jni.Error: 70023: This function has not been implemented on this platform
出现这个时候是因为安装

tomcat-native-1.1.20-src.tar.gz

的时候没有加上

--with-ssl=/usr/bin

tar zxvf tomcat-native-1.1.20-src.tar.gz
cd tomcat-native-1.1.20-src/native/
./configure --with-apr=/usr/local/apr --with-java-home=/usr/local/jdk/jdk1.7.0_60 --with-ssl=/usr/bin
make
make install
然后在make之后回报错
checking for gcc option to accept ISO C89... none needed
checking for OpenSSL library... using openssl from /usr/lib and /usr/include
checking OpenSSL library version >= 1.0.2...

Found   OPENSSL_VERSION_NUMBER 0x10000003 (OpenSSL 1.0.0 29 Mar 2010)
Require OPENSSL_VERSION_NUMBER 0x1000200f or greater (1.0.2)

configure: error: Your version of OpenSSL is not compatible with this version of tcnative

说要升级然后就去升级吧

wget https://www.openssl.org/source/openssl-1.1.0c.tar.gz

tar zxvf openssl-1.1.0c.tar.gz

cd openssl-1.1.0c.tar.gz

./config shared zlib

make

make install 

然后默认安装在/usr/local/ssl 和/usr/local/bin中

cd /usr/local/
./bin/openssl version -a
会出现错误openssl: error while loading shared libraries: libssl.so.1.1: cannot open shared object file: No such file or directory错误
ln -s /usr/local/lib64/libssl.so.1.1 /usr/lib64/libssl.so.1.1
ln -s /usr/local/lib64/libcrypto.so.1.1 /usr/lib64/libcrypto.so.1.1

在运行就是新版本
./bin/openssl version -a

然后替换旧版

ln -s /usr/local/bin/openssl /usr/bin/openssl
ln -s /usr/local/include/openssl /usr/include/openssl
echo "/usr/local/lib" >> /etc/ld.so.conf


然后就可以安装openssl-1.1.0c.tar.gz



安装成功之后发现tomcat启动很慢

tomcat变慢

我们可以让/dev/unrandom来做“熵源”。以Centos7为例,
yum install rngd-tools
或者yum install rng-tools
安装rngd服务(熵服务)systemctl start rngd
启动服务

tomcat-native

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值