Loading... Redhat系列rpm包打包工具fpm FPM的作者是jordansissel FPM的github:<https://github.com/jordansissel/fpm> FPM功能简单说就是将一种类型的包转换成另一种类型。 ### 1. 支持的源类型包 ``` dir 将目录打包成所需要的类型,可以用于源码编译安装的软件包 rpm 对rpm进行转换 gem 对rubygem包进行转换 python 将python模块打包成相应的类型 ``` ### 2. 支持的目标类型包 ``` rpm 转换为rpm包 deb 转换为deb包 solaris 转换为solaris包 puppet 转换为puppet模块 ``` ### 3. FPM安装 ```shell fpm是ruby写的,因此系统环境需要ruby,且ruby版本号大于1.8.5。 # 安装ruby模块 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 # 指定版本安装 gem install fpm -v 1.3.3 # 不添加源指定源安装 gem install fpm -v 1.3.3 --source https://ruby.taobao.org/ ``` ### 4. FPM参数 详细使用见fpm –help 常用参数 ``` -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 ``` ## 二、使用例子 ### 例子1 ```shell fpm -s dir -t rpm -n nfsserver -v 1.0 -d 'nfs-utils,rpcbind' --post-install /root/post.sh -f /etc/exports /server/scripts/ /etc/rc.local /var/spool/cron/root /etc/sysctl.conf /usr/local/inotefy-tools3.14 -s 指定打包源的类型(这里是目录) -n 指定包名称 -v 指定包版本 -d 指定包依赖,会在安装包前安装包 --post-install 安装后执行脚本 -f 指定打包的路径和文件 [root@localhost ~]# cat /root/post.sh [ ! -d /data/www ] && mkdir /data/{www,bbs,blog} -p useradd nfs -u 888 -s /sbin/nologin -M && chown nfs:nfs -R /data/ /etc/init.d/rpcbind start /etc/init.d/nfs start ln -s /usr/local/inotefy-tools3.14/ /usr/local/inotefy-tools /bin/sh /server/scripts/inotify.sh & ``` ### 例子2 ```shell fpm -s dir -t rpm -n backfile -v 1.0 --post-install /root/post.sh -f /etc/rsyncd.conf /etc/rsync.password /etc/mail.rc /server/scripts/ [root@backup ~]# cat /root/post.sh useradd rsync -u 888 -s /sbin/nologin -M mkdir /backup -p chown -R rsync /backup echo "rsync_backup:oldboy">/etc/rsync.password chmod 600 /etc/rsync.password /usr/bin/rsync --daemon ``` ### 例子3 ```shell fpm -s dir -t rpm -n php-fpm -v 5.6.32 --post-install /server/scripts/php-instll.sh -f /app/php /app/php-5.6.32/ /etc/init.d/php-fpm [root@liu ~]# cat /server/scripts/php-instll.sh #!/bin/sh id www &>/dev/null || useradd -s /sbin/nologin -m www test -L /app/php && rm -f /app/php && ln -s /app/php-5.6.32 /app/php ``` 最后修改:2018 年 11 月 09 日 02 : 54 PM © 允许规范转载
casino games free free casino games slotomania online gambling casino winstar world casino | https://onlinecasinodd.com/ - borgata online casino https://onlinecasinodd.com/ - online casino games
lady luck free casino games sun moon casino online free online casino slots | https://onlinecasinodd.com/ - play casino https://onlinecasinodd.com/ - free casino games slotomania