FPM 打包工具安装和使用

时间:2021-07-21 18:37:22

修改yum源:

备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup


安装阿里云yum源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo


安装依赖包

yum -y install ruby rubygems ruby-devel

添加阿里云的Rubygems 仓库 

gem sources -a http://mirrors.aliyun.com/rubygems/

#移除原生Ruby仓库
gem sources --remove http://rubygems.org/

 

检查是否已经移除

FPM 打包工具安装和使用

 

指定安装版本

gem install fpm -v 1.3.3

 先 输入 

gem install fpm

然后报错

再输入

gem install fpm -v 1.3.3

FPM 打包工具安装和使用

检查是否可以使用

fpm --help

FPM 打包工具安装和使用

 

 

准备

建立目录

/application/tools

下载

wget http://nginx.org/download/nginx-1.6.3.tar.gz

 

修改yum配置文件

/etc/yum.conf

开启yum 缓存

改 keepcache=1

 

FPM 打包工具安装和使用

检查是否有rpm 包 遗留

 

FPM 打包工具安装和使用

 

定制Nginx rpm 安装包

安装依赖源

yum install pcre-devel openssl-devel

 

FPM 打包工具安装和使用

 

FPM 打包工具安装和使用

 

 

 

记录待整理

 

FPM 打包工具安装

修改yum源:

备份

mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup


安装阿里云yum源

wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo


安装依赖包

yum -y install ruby rubygems ruby-devel

添加阿里云的Rubygems 仓库

gem sources -a http://mirrors.aliyun.com/rubygems/

#移除原生Ruby仓库
gem sources --remove http://rubygems.org/

指定安装版本

gem install fpm -v 1.33

 wget http://nginx.org/download/nginx-1.9.7.tar.gz
 wget http://nginx.org/download/nginx-1.6.3.tar.gz

mkdir -p /application/tools


cd /application/tools/

find /var/cache/yum/ -name "*rpm"

yum install pcre-devel openssl-devel

 


find /var/cache/ -type f -name '*rpm'

find /var/cache/ -type f -name '*rpm'|xargs cp -t /tmp/

cd /tmp

tar zcf nginx_yum.tar.gz *.rpm

sz nginx_yum.tar.gz

cd /application/tools/

useradd nginx -M -s /sbin/nologin

tar zxf nginx-1.6.3.tar.gz


./configure --prefix=/application/nginx-1.6.3 --user=nginx --group=nginx --with-http_ssl_module --with-http_stub_status_module

make

make install


ln -s /application/nginx-1.6.3/ /application/nginx

/application/nginx/sbin/nginx


ss -lntup|grep nginx

ps -ef|grep nginx|grep -v grep

curl 127.0.0.1


mkdir -p /server/scripts

cd /server/scripts/

vim nginx_rpm.sh

#!/bin/bash

useradd nginx -M -s /sbin/nologin
ln -s /application/nginx-1.6.3/ /application/nginx


fpm -s dir -t rpm -n nginx -v 1.6.3 -d 'pcre-devel,openssl-devel' --post-install /server/scripts/nginx_rpm.sh -f /application/nginx-1.6.3/

 

检查

rpm -qpl nginx-1.6.3-1.x86_64.rpm

[root@nginx tools]# rpm -qpl nginx-1.6.3-1.x86_64.rpm
/application/nginx-1.6.3/client_body_temp
/application/nginx-1.6.3/conf/fastcgi.conf
/application/nginx-1.6.3/conf/fastcgi.conf.default
/application/nginx-1.6.3/conf/fastcgi_params
/application/nginx-1.6.3/conf/fastcgi_params.default
/application/nginx-1.6.3/conf/koi-utf
/application/nginx-1.6.3/conf/koi-win
/application/nginx-1.6.3/conf/mime.types
/application/nginx-1.6.3/conf/mime.types.default
/application/nginx-1.6.3/conf/nginx.conf
/application/nginx-1.6.3/conf/nginx.conf.default
/application/nginx-1.6.3/conf/scgi_params
/application/nginx-1.6.3/conf/scgi_params.default
/application/nginx-1.6.3/conf/uwsgi_params
/application/nginx-1.6.3/conf/uwsgi_params.default
/application/nginx-1.6.3/conf/win-utf
/application/nginx-1.6.3/fastcgi_temp
/application/nginx-1.6.3/html/50x.html
/application/nginx-1.6.3/html/index.html
/application/nginx-1.6.3/logs/access.log
/application/nginx-1.6.3/logs/error.log
/application/nginx-1.6.3/logs/nginx.pid
/application/nginx-1.6.3/proxy_temp
/application/nginx-1.6.3/sbin/nginx
/application/nginx-1.6.3/scgi_temp
/application/nginx-1.6.3/uwsgi_temp
[root@nginx tools]#

 

sz nginx-1.6.3-1.x86_64.rpm