由于SUSE没有yum.所以采取 编译安装。下面说说遇到的坑。
一. 涉及软件包
pcre(pcre-devel)
zlib
openssl
jemalloc
tengine
整理了以上安装包压缩包,下载地址:https://download.csdn.net/download/zhangyongdingrui/10289875
二.安装步骤
将上面链接地址下来的压缩文件上传到服务器(比如放到:/usr/local/sf_source)
解压后后有
pcre2-10.21.tar.gz、
zlib-1.2.11.tar.gz 、
openssl-1.0.2g.tar.gz、
jemalloc-4.0.4.tar.gz、
tengine-2.1.2.tar.gz 、
libpcre.a 、
pcre-devel-8.39-5.1.x86_64.rpm
建议先把目录规划好:如在usr/local/ 下mkdir sf_source 和mkdir sf_install 分别用于存放源码目录和安装目录
1.安装pcre
tar zxvf pcre2-10.21.tar.gz
cd pcre2-10.21
./configure --prefix=/usr/local/sf_install/pcre2-10.21
make && make install
如果报错:configure: error: You need a C++ compiler for C++ support.
执行安装:yum install -y gcc gcc-c++
2.安装zlib
cd ..
tar zxvf zlib-1.2.11.tar.gz
cd zlib-1.2.11
./configure --prefix=/usr/local/sf_install/zlib-1.2.11
make && make install
3.安装openssl
cd ..
tar zxvf openssl-1.0.2g.tar.gz
cd openssl-1.0.2g
./config --prefix=/usr/local/sf_install/openssl-1.0.2g
make && make install
4.解压jemalloc
cd ..
tar zxvf jemalloc-4.0.4.tar.gz
5.安装tengine
cd ..
tar zxvf tengine-2.1.2.tar.gz
cd tengine-2.1.2
./configure --prefix=/usr/local/sf_install/nginx \
--with-pcre=/usr/local/sf_source/nginx/pcre2-10.21/ \
--with-zlib=/usr/local/sf_source/nginx/zlib-1.2.11 \
--with-openssl=/usr/local/sf_source/nginx/openssl-1.0.2g \
--with-jemalloc=/usr/local/sf_source/nginx/jemalloc-4.0.4 \
--with-http_gzip_static_module \
--with-http_realip_module \
--with-http_stub_status_module \
--with-http_gzip_static_module \
--with-http_concat_module \
--with-http_ssl_module
make && make install
如果出现以下错误
则 cd /usr/local/sf_source目录下,执行: zypper install pcre-devel-8.39-5.1.x86_64.rpm ,根据提示选择 2 再执行,然后会再有提示,再选择y执行就好了,执行完成后回到 cd /usr/local/sf_source/tengine-2.1.2在 执行 make && make install
如果出现找不到 libpcre.a错误 则在 /usr/local/sf_source/pcre2-10.21下 mkdir .libs目录,并 把 /usr/local/sf_source下的 libpcre.a 复制到 .libs目录下,再回到 /usr/local/sf_source/tengine-2.1.2下make && make install
以上都成功后执行 /usr/local/sf_install/nginx/sbin/nginx -v 看能否输出 nginx 版本信息.如果有正确输出nginx版本,至此大功告成.