FPM制作nginx rpm包

fpm介绍:

FPM功能简单说就是将一种类型的包转换成另一种类型。

FPM的github:https://github.com/jordansissel/fpm

fpm常用参数:

-s          指定源类型
-t          指定目标类型,即想要制作为什么包
-n          指定包的名字
-v          指定包的版本号
-C          指定打包的相对路径  Change directory to here before searching forfiles
-d          指定依赖于哪些包
-f          第二次打包时目录下如果有同名安装包存在,则覆盖它
-p          输出的安装包的目录,不想放在当前目录下就需要指定
--post-install      软件包安装完成之后所要运行的脚本;同--after-install
--pre-install       软件包安装完成之前所要运行的脚本;同--before-install
--post-uninstall    软件包卸载完成之后所要运行的脚本;同--after-remove
--pre-uninstall     软件包卸载完成之前所要运行的脚本;同--before-remove

安装fpm工具

yum -y install ruby rubygems ruby-devel
[[email protected] ~]# gem sources --add https://gems.ruby-china.org/ --remove http://rubygems.org/
https://gems.ruby-china.org/ added to sources
http://rubygems.org/ removed from sources
[[email protected] ~]# gem install json -v 1.8.3
[[email protected] ~]# gem install fpm -v 1.3.3

安装nginx

useradd www -M -s /sbin/nologin
tar xf nginx-1.6.2.tar.gz
cd nginx-1.6.2
./configure --prefix=/application/nginx-1.6.2 --user=www --group=www --with-http_ssl_module --with-http_stub_status_module
make && make install
ln -s /application/nginx-1.6.2/ /application/nginx
编写nginx安装后执行的脚本:
[[email protected] application]# cat /server/scripts/nginx_rpm.sh
#!/bin/bash
useradd www -M -s /sbin/nologin
ln -s /application/nginx-1.6.2/ /application/nginx

制作nginx的rpm包

[[email protected] application]# fpm -s dir -t rpm -n nginx -v 1.6.2 -d ‘pcre-devel,openssl-devel‘ --post-install /server/scripts/nginx_rpm.sh -f /application/nginx-1.6.2/
no value for epoch is set, defaulting to nil {:level=>:warn}
no value for epoch is set, defaulting to nil {:level=>:warn}
Created package {:path=>"nginx-1.6.2-1.x86_64.rpm"}

客户端测试:

修改客户端的repo源

[[email protected] nginx]# cd /etc/yum.repos.d/
[[email protected] yum.repos.d]# ls
oldboy.repo
[[email protected] yum.repos.d]# cat oldboy.repo 
[oldboy]
name=Server
baseurl=http://10.0.0.61
enable=1
gpgcheck=0

直接用yum本地安装nginx  

[[email protected] yum.repos.d]# yum install nginx
已加载插件:fastestmirror, security
设置安装进程
Loading mirror speeds from cached hostfile
解决依赖关系
--> 执行事务检查
---> Package nginx.x86_64 0:1.6.2-1 will be 安装
--> 完成依赖关系计算
依赖关系解决
==================================================================================================
 软件包               架构                  版本                      仓库                   大小
==================================================================================================
正在安装:
 nginx                x86_64                1.6.2-1                   oldboy                2.2 M
事务概要
==================================================================================================
Install       1 Package(s)
总下载量:2.2 M
Installed size: 5.0 M
确定吗?[y/N]:y
下载软件包:
nginx-1.6.2-1.x86_64.rpm                                                   | 2.2 MB     00:00     
运行 rpm_check_debug 
执行事务测试
事务测试成功
执行事务
Warning: RPMDB altered outside of yum.
** Found 6 pre-existing rpmdb problem(s), ‘yum check‘ output follows:
nginx-mod-http-geoip-1.10.1-1.el6.x86_64 has missing requires of nginx
nginx-mod-http-image-filter-1.10.1-1.el6.x86_64 has missing requires of nginx
nginx-mod-http-perl-1.10.1-1.el6.x86_64 has missing requires of nginx
nginx-mod-http-xslt-filter-1.10.1-1.el6.x86_64 has missing requires of nginx
nginx-mod-mail-1.10.1-1.el6.x86_64 has missing requires of nginx
nginx-mod-stream-1.10.1-1.el6.x86_64 has missing requires of nginx
  正在安装   : nginx-1.6.2-1.x86_64                                                           1/1 
  Verifying  : nginx-1.6.2-1.x86_64                                                           1/1 
已安装:
  nginx.x86_64 0:1.6.2-1                                                                          
完毕!

yum源的搭建见上一遍博文:

搭建本地yum源:

http://ronghuachen.blog.51cto.com/10543403/1863655

时间: 2024-08-01 19:10:21

FPM制作nginx rpm包的相关文章

使用fpm制作nginx rpm包

在使用saltstack部署的时候,我们依赖公司自己的rpm包,编译的参数,启动的脚本都是自己定制的,然后打成rpm包 放入公司自己的yum仓库里.制作rpm包的方式很多 checkinstall spec文件,fpm使用很简单,主要介绍下 1.安装fpm yum -y install ruby rubygems ruby-devel rpm-build gem sources -a http://ruby.taobao.org/ gem sources --remove http://ruby

Fpm 之 Nginx rpm 包制作

Fpm 之 Nginx rpm 包制作 一.下载nginx编译安包机器上 wget http://nginx.org/download/nginx-1.12.2.tar.gz 二.安装nginx的编译所需的依赖包 yum -y install pure lib gcc-c++ openssl openssl-devel 三.编译安装nginx tar -zxvf nginx-1.12.2.tar.gz cd nginx-1.12.2 ./configure --prefix=/app/nginx

FPM简介(定制rpm包)

FPM简介 fpm是生成rpm包的工具.rpm包的制作,采用fpm工具完成,FPM非常易用,此命令可以把rpm包的安装.卸载做得更加优雅,在安装前可以做一些准备工作,安装后可以做一些收尾工作,在卸载前也可以做一些准备,比如检测一下相应的服务是否停止了,在卸载软件再做一些扫尾的工作,只要把这些定义成一个个脚本,fpm中指定相应的选项即可轻松实现.FPM的github: https://github.com/jordansissel/fpm FPM安装 gem sources –a http://m

Fpm 之 Apache2 rpm 包定制

Fpm 之 Apache2 rpm 包定制 一.下载Apache2 的所需的安装编译包 apr包下载:(/app/software) wget http://mirror.bit.edu.cn/apache//apr/apr-1.6.3.tar.gz arp-util包下载:(/app/software) http://mirror.bit.edu.cn/apache//apr/apr-util-1.6.1.tar.gz httpd-2.4.33包下载:(/app/software) wget

Linux /centos 下nginx rpm包安装及配置

Centos下安装nginx rpm包                                                                                                                            www.169it.com 1 在nginx官方网站下载一个rpm包,下载地址是:http://nginx.org/en/download.html wget http://nginx.org/packages/c

fpm定制化RPM包之nginx rpm包的制作

1.安装ruby模块 # yum -y install ruby rubygems ruby-devel 2.添加阿里云的Rubygems仓库,国外资源会影响下载速度 gem sources -a http://mirrors.aliyun.com/rubygems/ http://mirrors.aliyun.com/rubygems/ added to sources 移除原生的ruby仓库 gem sources --remove http://rubygems.org/ 3.安装fpm

rpmbuile 制作drbd RPM包

drbd-8.4.3.tar.gz 源码编译制作rpm 包 解压tar -axf drbd-8.4.3.tar.gz./configure --enable-spec --with-km  ## --enable-spec           Rather than creating Makefiles, create an RPM spe## --with-km               Enable kernel module 如果编译出现 :configure: error: no ac

Centos下安装nginx rpm包

1 在nginx官方网站下载一个rpm包,下载地址是:http://nginx.org/en/download.html wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm 2 安装这个rpm包 rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm 安装过程中会出现错误提示: warning: nginx-

快速制作salt rpm包

修改了salt源代码后,想要快速编译出rpm包来,可以基于salt的src.rpm包来. 前期准备 salt-2014.7.1-1.el7.src.rpm   # salt的源码包和spec文件 rpm-build.rpm                      # 编译rpm的工具 修改代码 rpm -ivh salt-2014.7.1-1.el7.src.rpm # 会在当前目录下生成rpmbuild目录 ll rpmbuild/ total 2 drwxr-xr-x 2 root roo