FPM Packaging Tools

Source: Internet
Author: User
Tags rsync

Copyright belongs to the original author, from the original: https://www.cnblogs.com/saneri/p/5265661.html

Date:2018-10-12 18:48:25

Supported source-Type packages:

    • Dir: Package the directory into the required type, which can be used for source code compilation and installation
    • RPM: Converting to rpm
    • Gem: Converting a Rubygem package
    • Python: Package Python modules into the appropriate type

Supported target-type packages:

    • RPM: Convert to RPM Package
    • Deb: Convert to Deb Package
    • Solaris: Convert to Solaris Package
    • Puppet: Convert to Puppet Package

FPM installation of:

To install the Ruby environment and the GEM command:

1 yum -y install ruby rubygems ruby-devel

The Gem command is to install software from the Rubygem warehouse similar to yum installing software from the Yum repository

To view the current source:

123 [[email protected]~]# gem source list***CURRENT SOURCES ***http://rubygems.org/

Add domestic sources:

1 [[email protected]~]# gem sources -a http://mirrors.aliyun.com/rubygems/

To remove a foreign source:

1 [[email protected]~]# gem sources --remove http://rubygems.org/

To install the FPM tool:

1 [[email protected]~]# gem install fpm
1 [[email protected]~]#sed -i ‘s#keepcache=0#keepcache=1#g‘ /etc/yum.conf    //开启yum缓存

FPM Common parameters:

-S: Specify the Source type -t: Specify the target type, that is, why package -N: Specify the name of the package-V: Specify the version number of the package-C: Specify the relative path to package-D: Specify which packages are dependent -F: The second time the package is in the directory if there is an installation package with the same name, overwrite it -p: The directory for the output of the installation package, and do not want to place the current directory to specify --post-install: Scripts to be run after the package installation is complete, with--offer-install--pre-install: The script to run before the package installation is complete;with--before-install-- Post-uninstall: The script to be run after the package uninstallation is complete, with--offer-remove--pre-uninstall: The script to run before the package uninstallation is complete; same as-before-remove

The installation encountered a problem:

1234567 1.Needexecutable ‘rpmbuild‘ to convert dir to rpm {:level=>:error}解决方法:[[email protected]]# yum install -y rpm-build2.如果里面有gcc make的错误.解决方法:yum install -y gcc  

FPM Packaging Examples:

1.FPM packaged Nginx

1234 [[email protected] opt]# fpm -s dir -t rpm -n nginx -v 1.6.1 -d ‘pcre-devel,openssl-devel‘ --post-install /opt/nginx_rpm.sh -f /opt/nginx/ <br>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.1-1.x86_64.rpm"}

2.FPM Relative Path Packaging:

1234 [[email protected]~]# fpm -s dir -t rpm -n opt -v 1.1.1.1 -d ‘gcc,gcc+‘ -C ../opt/    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=>"opt-1.1.1.1-1.x86_64.rpm"}

3. Use FPM to assign the generated package to/tmp:

12345 [[email protected] ~]# fpm -s dir -t rpm -n ansible-v 1.1.1.1 -d ‘gcc,gcc+‘ -f ansible-p /tmp/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=>"/tmp/ansible-1.1.1.1-1.x86_64.rpm"}

View RPM Package Information:

1. View the scripts executed by rpm

1234 [[email protected] opt]# rpm -qp --scripts nginx-1.6.1-1.x86_64.rpm        postinstallscriptlet (using /bin/sh):#!/bin/bashuseraddnginx -M -s /sbin/nologin

2. Check the RPM package dependencies

12345 [[email protected] opt ] # rpm-qpr nginx-1.6.1-1.x86_64.rpm  OpenSSL - devel / bin / sh rpmlib (payloadfileshaveprefix) < = 4.0 - 1 rpmlib (compressedfilenames) < = 3.0 4 - 1

3. View the contents of the RPM package:

1 rpm -qpl zabbix-3.0-1.x86_64.rpm

Image Sync public network yum Source:

1234 centos官方标准源:rsync://mirrors.ustc.edu.cn/centos/6/os/x86_64/rsync://mirrors.ustc.edu.cn/centos/6/extras/x86_64/rsync://mirrors.ustc.edu.cn/centos/6/updates/x86_64/

Epel Source:

1 rsync://mirrors.ustc.edu.cn/epel/6/x86_64/

Command: Reposync

FPM Packaging Tools

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.