Use FPM to make rpm, Deb packages

Source: Internet
Author: User
Tags curl fpm pack

You will need to package the files in the following situations: avoid duplication of work, package the source code for RPM use Yum to publish the project, package for RPM, package your own program for RPM, and provide users with the download of other

Using FPM, packing RPM is as easy as tar packing files. One, installation fpm and so on

# Install ruby
yum-y install ruby rubygems ruby-devel gcc rpm-build
# add Aliyun Ruby Warehouse and remove native Ruby warehouse
gem sources-a https: gems.ruby-china.org/--remove http://rubygems.org/
# view current Ruby warehouse
gem sources-l
# Install FPM
gem install Fpm

If you are prompted for a low Ruby version, you need to install a high version of Ruby and silently ignore the following

#  Install RVM (Ruby Version Manager)
curl-ssl https://rvm.io/mpapis.asc | gpg2--import 
. Curl-l GET.RVM. Io | Bash-s Stable
# Setup RVM Environment
source/etc/profile.d/rvm.sh
# Install Required Ruby Version
RVM install 1.9.3

# RVM Install 2.3.1         # Install Another Version (if Required)
# RVM use 1.9.3--default
  # Setup Default Ruby version
# ruby--version            # Check current Ruby version
second, prepare to pack the catalogue

Implement installation RPM will put the index.html in the/data/site/directory

Mkdir-p/tmp/rpm/data/site/ 
touch/tmp/rpm/data/site/index.html
third, the use of FPM Packaging directory into RPM package

Packing RPM

Fpm-s dir-t rpm-n website-v 1.0.1-c/tmp/rpm/

view files in rpm

RPM-QPL website-1.0.1-1.x86_64.rpm

Install RPM

RPM-IVH website-1.0.1-1.x86_64.rpm

View installation Information

# Rpm-qa | grep website
website-1.0.1-1.x86_64
# ll/data/site/index.html
-rw-r--r--1 root 0 Sep 07:50/data/ Site/index.html
fpm Common Parameters
-S: Specify Source Type
   dir: Package directory as required type, can be used for source code compiled installation package
   RPM: RPM conversion
   gem: Rubygem package conversion
   python: Pack python modules into the appropriate type
   ·
-T: Specifies the target type, that is, why the package (Deb, RPM, Solaris, etc)-
N: Specifies the name of the package
-V: Specifies the package's version number
-C: Specifies the package relative path-
D: Specifies which package-d ' name is dependent on Or-d ' name > Version '
-F: If there is an installation package with the same name under the second package, overwrite it-
p: The directory of the installation package of the output, do not want to put in the current directory to specify the
--post-install: The script to run after the package installation is complete;
--pre-install: script to run before the package is installed;--offer-install--before-install
--post-uninstall: The script to run after the package uninstallation completes;--offer-remove
--pre-uninstall: script to run before the package uninstall completes;-before-remove
Four, pack the Deb package

Use FPM to package Deb soft packs, disabling this default behavior with Deb-no-default-config-files because FPM and Debian packaging rules are inconsistent

Fpm-s dir-t deb-n nginx-v 1.0.2-d ' ntpdate '-c/usr/local/nginx/  --deb-no-default-config-files
Command Information
Dpkg-i Package.deb installation package
Dpkg-r Package Delete Package
Dpkg-p Package Delete package (including configuration file)
Dpkg-l Package Lists the files associated with the package
Dpkg-l Package Display the version of the package
Dpkg–unpack Package.deb Unlock the contents of the Deb package
dpkg-s keyword Search for the package content that belongs to
Dpkg-l List the currently installed packages
Dpkg-c Package.deb List the contents of the Deb package
Dpkg–configure Package Configuration Package
v. Networking installation Dependency Pack

There are local packages installed locally, no networking installed.

# CentOS:
yum-y install website-1.0.1-1.x86_64.rpm yum localinstall website-1.0.1-1.x86_64.rpm
# Ubuntu Under

Reprint please be sure to retain this source: http://blog.csdn.net/fgf00/article/details/53164582

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.