当前位置:   article > 正文

银河麒麟高级服务器v10 sp2 下fpm工具打包rpm_银河麒麟操作系统打包环境fpm

银河麒麟操作系统打包环境fpm

一、当前操作系统版本

 二、安装fpm

2.1 安装ruby及依赖

yum install ruby rubygems ruby-devel rpm-build

2.2 添加阿里云rubygems仓库

[root@server ~]# gem sources

*** CURRENT SOURCES ***

https://rubygems.org/

[root@server ~]# gem sources -a  http://mirrors.aliyun.com/rubygems/

http://mirrors.aliyun.com/rubygems/ added to sources

[root@server ~]# gem sources

*** CURRENT SOURCES ***

https://rubygems.org/

http://mirrors.aliyun.com/rubygems/

2.3 移除原生的ruby的仓库

[root@server ~]# gem sources --remove https://rubygems.org/

https://rubygems.org/ removed from sources

[root@server ~]# gem sources

*** CURRENT SOURCES ***

http://mirrors.aliyun.com/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.

# https://bugzilla.redhat.com/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

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/小小林熬夜学编程/article/detail/620392
推荐阅读
相关标签
  

闽ICP备14008679号