700字范文,内容丰富有趣,生活中的好帮手!
700字范文 > 银河麒麟高级服务器v10 sp2 下fpm工具打包rpm

银河麒麟高级服务器v10 sp2 下fpm工具打包rpm

时间:2019-08-01 04:12:44

相关推荐

银河麒麟高级服务器v10 sp2 下fpm工具打包rpm

一、当前操作系统版本

二、安装fpm

2.1 安装ruby及依赖

yum install ruby rubygems ruby-devel rpm-build

2.2添加阿里云rubygems仓库

[root@server ~]# gem sources

*** CURRENT SOURCES ***

/

[root@server ~]# gem sources -a /rubygems/

/rubygems/ added to sources

[root@server ~]# gem sources

*** CURRENT SOURCES ***

/

/rubygems/

2.3 移除原生的ruby的仓库

[root@server ~]# gem sources --remove /

/ removed from sources

[root@server ~]# gem sources

*** CURRENT SOURCES ***

/rubygems

2.4 安装fpm 1.3.3版本

[root@server ~]# gem install fpm -v 1.3.3

Fetching: ffi-1.15.5.gem (100%)

Building native extensions. This could take a while...

Successfully installed ffi-1.15.5

Fetching: childprocess-4.1.0.gem (100%)

Successfully installed childprocess-4.1.0

Fetching: clamp-0.6.5.gem (100%)

Successfully installed clamp-0.6.5

Fetching: cabin-0.9.0.gem (100%)

Successfully installed cabin-0.9.0

Fetching: arr-pm-0.0.11.gem (100%)

Successfully installed arr-pm-0.0.11

Fetching: backports-3.23.0.gem (100%)

Successfully installed backports-3.23.0

Fetching: json-2.6.2.gem (100%)

Building native extensions. This could take a while...

Successfully installed json-2.6.2

Fetching: fpm-1.3.3.gem (100%)

Successfully installed fpm-1.3.3

8 gems installed

三 、制作nginx的rpm包

3.1 安装nginx依赖

yum install -y pcre-devel openssl-devel

3.2 下载上传nginx 1.22源码至服务器

3.3 源码编译nginx

./configure \

--prefix=/usr/local/nginx \

--sbin-path=/usr/sbin/nginx \

--conf-path=/usr/local/nginx/conf/nginx.conf \

--error-log-path=/var/log/nginx/error.log \

--http-log-path=/var/log/nginx/access.log \

--pid-path=/var/run/nginx/nginx.pid \

--lock-path=/var/lock/nginx.lock \

--user=nginx \

--group=nginx \

--with-http_ssl_module \

--with-http_flv_module \

--with-http_stub_status_module \

--with-http_gzip_static_module \

--http-client-body-temp-path=/var/tmp/nginx/client/ \

--http-proxy-temp-path=/var/tmp/nginx/proxy/ \

--http-fastcgi-temp-path=/var/tmp/nginx/fcgi/ \

--http-uwsgi-temp-path=/var/tmp/nginx/uwsgi \

--http-scgi-temp-path=/var/tmp/nginx/scgi \

--with-pcre

make && make DESTDIR=/opt/nginx install

3.4 制作nginx.service 并保存在/opt/nginx/usr/local/nginx/nginx.servic

[root@uplook system]# vim /usr/lib/systemd/system/nginx.service

[Unit]

Description=The nginx HTTP and reverse proxy server

After=network-online.target remote-fs.target nss-lookup.target

Wants=network-online.target

[Service]

Type=forking

PIDFile=/var/run/nginx/nginx.pid

# Nginx will fail to start if /run/nginx.pid already exists but has the wrong

# SELinux context. This might happen when running `nginx -t` from the cmdline.

# /show_bug.cgi?id=1268621

ExecStartPre=/usr/bin/rm -f /var/run/nginx/nginx.pid

#ExecStartPre=/usr/sbin/nginx -t

ExecStartPre=/usr/bin/mkdir -p /var/tmp/nginx/

ExecStart=/usr/sbin/nginx -c /usr/local/nginx/conf/nginx.conf

ExecReload=/usr/sbin/nginx -s reload

ExecStop=/usr/sbin/nginx -s quit

KillSignal=SIGQUIT

TimeoutStopSec=5

KillMode=process

PrivateTmp=true

[Install]

WantedBy=multi-user.target

3.5 生成rpm包

fpm -s dir -t rpm -n nginx -v 1.22 -d 'pcre-devel,openssl-devel' --pre-install /tools/pre-nginx.sh --post-install /tools/post-nginx.sh -C /opt/nginx/ -f

附一:/tools/pre-nginx.sh

[root@server tools]# cat pre-nginx.sh

#!/bin/bash

useradd -M -s /sbin/nologin nginx

mkdir -p /var/tmp/nginx/client/

附二:/tools/post-nginx.sh

[root@server tools]# cat post-nginx.sh

#!/bin/bash

cp -f /usr/local/nginx/nginx.service /usr/lib/systemd/system/nginx.service

rm -rf/usr/local/nginx/nginx.service

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。