Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Fpm customized nginx-rpm package

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >

Share

Shulou(Shulou.com)06/02 Report--

Introduction to experimental environment:

[root@nginx ~]# uname -r

2.6.32-573.el6.x86_64

[root@nginx ~]# cat /etc/redhat-release

CentOS release 6.7 (Final)

Before packaging, you need to install nginx service on the tester

The installation process is as follows

[root@nginx ~]# useradd -s /sbin/nologin/ -M nginx

[root@nginx ~]# yum -y install pcre-devel openssl-devel

[root@nginx ~]# tar zxf nginx-1.6.2.tar.gz

[root@nginx ~]# cd nginx-1.6.2

[root@nginx ~]# ./ configure \

--user=nginx \

--group=nginx \

--prefix=/application/nginx-1.6.2 \

--with-http_stub_status_module \

--with-http_ssl_module

[root@nginx nginx-1.6.2]# make && make install

[root@nginx nginx-1.6.2]# ln -s /application/nginx-1.6.2/ /application/nginx

FPM production started

Installing dependency packages via yum

[root@nginx ~]# yum -y install ruby rubygems ruby-devel

Replace yum source

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

[root@nginx ~]# gem sources --remove http://rubygems.org/

[root@nginx ~]# gem sources --list

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

-v Specifies the version of fpm to install, or not. Execute gem install fpm directly

Write a script, just need to write the nginx user added and the command to create a soft connection

[root@nginx ~]# vim nginx_fpm.sh

#!/ bin/bash

useradd -s /sbin/nologin/ -M nginx

ln -s /application/nginx-1.6.2/ /application/nginx

Execute packing command

[root@nginx ~]# fpm -s dir -t rpm -n nginx -v 1.6.2 -d 'pcre-devel,openssl-devel' --post-install /root/nginx_fpm.sh -f /application/nginx-1.6.2/

-s: Specify source type

-t: execution target type

-n: name of execution package

-v: Specifies the version number of the package

-d: Specify which packages depend on

--post-install: script to run after software installation

-f: Overwrite an installation package with the same name if it exists in the directory of the second package

Test the rpm package on a new machine

Use the yum -y localinstall command to resolve installation problems on your own

[root@lvs1 ~]# yum -y localinstall nginx-1.6.2-1.x86_64.rpm

Start nginx service successfully

[root@lvs1 ~]# /application/nginx/sbin/nginx

[root@lvs1 ~]# lsof -i :80

COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME

nginx 1842 root 6u IPv4 14884 0t0 TCP *:http (LISTEN)

nginx 1843 nginx 6u IPv4 14884 0t0 TCP *:http (LISTEN)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Servers

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report