linux-What are binary packages, source packages, RPM packages, repositories

Source: Internet
Author: User
Tags rpmbuild

The "preface" is explained in the blog post:

This article will be introduced by personal tone what is binary package, RPM package, source RPM package (srpm package), source package, and rpm common commands, source RPM installation (*.src.rpm), source package installation steps knowledge (./configure,make,make Install) Related knowledge.

At the current point in time "June 12, 2017 " under the limited level of skills, there may be a lot of knowledge understanding is not enough in-depth or comprehensive, I hope you point out the issue of common communication, in the follow-up work and learning, such as found in the content and the actual situation deviation, will improve the content of this blog post.

This article refers to a reference link:

3, "RPM package format"
5, "recommended, must see"
6, "source package three-step explanation"
7, "Explain installation src.rpm"
8, "How to make the source package into RPM package" later wrote a new blog post
9, "Linux software package management basic Operations Command get Started"
10, "must See, software warehouse explanation"
11, Http://


Small partners working on Linux operations have to deal with software installation, and we know there are several ways to install software on the server, For example, the source package method is installed separately (the general format is xx.tar.gz), the RPM package is installed separately (the general format is xx.rpm), installed through the Linux distribution package management software (such as Rhel and CentOS Yum,suse YaST and Zypper , Ubuntu apt, etc.), then what is the difference between the packages we install?

In Linux, we divide the package into three types, namely, binary package, RPM package, source package.

1:2 Binary Packages

1. Concept:

A binary package is a form of a package that is a program package that has been compiled and can be run immediately. You only need to download and package (install) them later, you can use them immediately. The content of the package is 12 binary code (generally in 16 binary display), that is, these files are directly recognized by the computer (the computer can only recognize processing 12 binary)

2. Format:

Format 1:xxxx-devel-6b-33.x86_64.rpm format (RPM-IVH can be used directly after installation),

Format 2:mysql-5.5.32-linux2.6-x86_64.tar.gz format (TAR-ZXVF after decompression can be used directly), here note and source package differences, binary format package name is very long, usually with version number, adapt to the platform, the type of hardware to adapt, etc. The source format is just a tar package with a version number, such as httpd-2.4.25.tar.gz.

The binary package that we typically refer to is the RPM package, which means that the binary package contains the RPM package and the RPM package is a subset of the binary package

3. Characteristics:

We can use the UE editor to open the file view under/bin, Open the. exe file view in Windows, open the RPM package view, you will find that the contents of these files are 12 binary code (generally in 16 binary display), that is, these files are directly recognized by the computer (the computer can only recognize processing 12 binary)

Two: RPM Package

1. Concept:

Under one operating system, you need to install a package that implements various functions. These packages generally have their own programs, but they also have intricate dependencies. Also need to solve the package version, as well as installation, configuration, uninstall automation issues. To solve these problems, Redhat proposed a better way to manage hundreds of software for its own system. This is the RPM management system. Once the RPM management system is installed in the system, it is easy to install, upgrade, uninstall, as long as it is a packaged program that conforms to the RPM file standard.

That is, RPM was originally a management program for Red Hat's program suite, which is designed to manage Red Hat's Linux distributions, and is popular because it follows GPL rules and is powerful and convenient. is gradually being adopted by other Linux distributions. The advent of RPM suite management means that Linux is easy to install and upgrade, which indirectly increases the applicability of Linux.
and Yum (Yellowdog Update Manager) is the RPM's front-end tool, is a RPM-based management tool, he can automatically solve the installation of RPM package generated by the dependency.

RPM package is also a binary package, RPM package is very good to distinguish, the rpm end of the general is the RPM package
Note: RPM is divided into two categories: package and srcpackage, binary rpm and source RPM, which are already compiled binary packages that can be installed directly, and the latter is the RPM package with the source code. Need to reorganize rebuild after the installation can be used, in fact, from a rigorous point of view, *.src.rpm is a special source package, special in it can directly generate RPM package

2. Format:

Format 1:name-version-release.arch.rpm

Format 2:name-version-release.arch.src.rpm

Name: Indicates the package names, including the main package name and the sub-package name
Version: Represents the release information for a package
Release: The issue number used to identify the RPM package itself, which can also contain an adapted operating system
Arch: Represents the host platform, Noarch means the package can be installed on the platform above
i386 refers to a computer (AI32) that this package applies to Intel's more than 80386 x86 architectures
i686 refers to a computer (IA32) that this package applies to the x86 architecture of Intel 80686 or more (Pentium Pro)
Noarch refers to this package is independent of the hardware architecture and can be used universally.

Programs for i686 packages are typically optimized for CPU 80686 and above, so they are generally forward compatible, but not backwards compatible. The i386 package is available on the x86 machine and supports forward compatibility. However, now the computer, Pentium Pro CPU is rarely used, the usual configuration of the machine use i686 software package, that is to say we think i686 more efficient
In summary, it means that the i686 package cannot be run on the i386 platform, and the i386 package is not limited and can be run on any platform.

There might be people who would be forward backwards compatible not very clear, explain:

Backward compatible = backward, to the history of compatibility, that is, now the new version of the instinct to read the running of older versions of the data, such as WIN10 can be backward compatible with Win7 software, Win7 backward compatible with Win XP software, Office 2016 can open office2010 files, 64-bit CPU capable of backwards compatibility with 32-bit applications developed for 32-bit CPUs

Forward compatible = forward-looking, compatible with new or new data, compatible with new things, or new version-generated data, capable of running processing on older versions, such as applications developed for 32-bit CPUs that cannot run on 64-bit CPUs, then this application is forward-incompatible, and if it is assumed to run, So that's forward-compatible, Office 2007 is able to handle the data generated by Office 2016, and we say forward-compatible

GD is the main package name of this package, Devel is the package name of this packet,
2.0.35 is the version information, 2 for the main version, 0 for this version, and 35 for the revision number,
11.el6 in 11 is the release number, el6 means RHEL6,
X86_64 is the platform that represents the package, and if it is noarch this means platform-independent

3. Characteristics:
RPM Package Benefits:
1) RPM package management is simple, only need a few simple commands to implement the package installation upgrade uninstall and query
2) installation speed is faster than the source package form (source package is mainly make compilation takes a long time)
RPM Package Disadvantages:
1) RPM package is a pre-compiled binary package that can be installed and used directly, so it is no longer possible to see the source code
2) as described above, the function has been fixed, unable to remove or add new features flexibly
3) RPM package has a strong dependency, most RPM package installation needs to install a lot of dependent RPM package
4) When uninstalling the package, if you are not careful, will uninstall the dependencies involved, it is likely to uninstall the removal of the system required software, causing the system to collapse

For RPM packages that have been compiled into binary, they cannot be mixed due to different operating system environments.
However, packages released in src.rpm form can usually be installed under different systems because they need to be compiled locally when they are installed.

"Supplement": What is the difference between the source RPM package (*.src.rpm) and the source package in the form of the tar package described below, and how to install *.src.rpm?


1, the TAR package contains the content is clear text visible source code, if sufficient ability, can modify the source code, and at the time of installation can be free to choose the required features to install (./configure parameters), and uninstall removal is also more convenient

2, source RPM package is *.src.rpm end of such packages are included in the source code RPM package, using RPM-IVH to install, generate source programs and spec files, can directly generate RPM package, and tar form source package is not supported to generate RPM package. For src.rpm files, we have two major ways to install them.

Installation of source RPM package (*.src.rpm):

1), move the rpm file to the specified directory to execute, here is the move to the/usr/src/packages/srpms directory (SuSE system), using the reassembly command rpmbuild--rebuild--clean setarch-1.3-1.src.rpm, Compile the source code directly into a normal binary RPM package. After execution, you can find the available binary RPM package setarch-1.3-1.x86_64.rpm for installation in the/usr/src/packages/rpms/x86_64 directory.
Reorganization command: Rpmbuild--rebuild *.src.rpm or rpm--rebuild *.src.rpm or rpm--recompile *.src.rpm)

Example (Take the SUSE system installation setarch-1.3-1.src.rpm as an example):
suse11sp3-1:~ # CP setarch-1.3-1.src.rpm/usr/src/packages/srpms/
suse11sp3-1:~ # cd/usr/src/packages/srpms/
Suse11sp3-1:/usr/src/packages/srpms # rpmbuild--rebuild--clean setarch-1.3-1.src.rpm
Suse11sp3-1:/usr/src/packages/srpms # CD. /rpms/x86_64
suse11sp3-1:/usr/src/packages/rpms/x86_64 # RPM-IVH setarch-1.3-1.x86_64.rpm

2), execute RPM-IVH directly under the non-specified directory *.src.rpm, switch to the/usr/src/packages/specs directory, execute the rpmbuild command to execute the spec file, specifically using what parameters to control the generation of source packages or RPM packages, Please choose your own (-ba parameter can generate both tar.gz format source package and RPM package,-BP is only generated tar.gz format source package,-BB is only generated binary format RPM package, and the default rpmbuild for I386 platform, if the package is i686 platform software package, you need to specify to another platform, specify parameter is--target=i686)
Note: The *.tar.gz source and spec files are actually generated after the RPM-IVH *.src.rpm is executed directly, and other files (such as RPM packages) need to be generated by other commands.

Example (Take the SUSE system installation setarch-1.3-1.src.rpm as an example):
suse11sp3-1:~ # RPM-IVH setarch-1.3-1.src.rpm
suse11sp3-1:~ # Cd/usr/src/packages/specs

Suse11sp3-1:/usr/src/packages/specs # RPMBUILD-BB [–target=i686] setarch.spec #这里是直接生成RPM包 (-bb parameter)
Suse11sp3-1:/usr/src/packages/specs # CD. /prms/x86_64
suse11sp3-1:/usr/src/packages/rpms/x86_64 # RPM-IVH setarch-1.3-1.x86_64.rpm
Suse11sp3-1:/usr/src/packages/specs # RPMBUILD-BP [–target=i686] setarch.spec #这里是直接生成源码包 (-bp parameter)
Suse11sp3-1:/usr/src/packages/specs # CD. /build/your-package
suse11sp3-1:/usr/src/packages/build/setarch-1.3 #./configure
suse11sp3-1:/usr/src/packages/build/setarch-1.3 # Make
suse11sp3-1:/usr/src/packages/build/setarch-1.3 # Make Install

Three: Source Package

1. Concept:

The source package is another form of the software package in Linux, which needs to be compiled on the computer before it can produce a binary program that can run directly. The source code package contains the program code, usually we can recognize the C language file, so when installing the source package will usually be retrieved on the system to correctly install the GCC compiler, and the source code installation time will be longer.

The general installation process of the source package is:
1), decompression,
3) Make,
4) make install,
5) Ln-sv/usr/local/xxx/lib/xxx/usr/lib64/xxx
6) Vim/etc/profile, add path=/usr/local/xxx/bin at the end of the file: $PATH, then Source/etc/profile

2. Format:

*.tar.gz, *.tgz, *.bz2

The format of the source package is generally a version number of the TAR package, for example, httpd-2.4.25.tar.gz, the file name contains information not mentioned above the binary package more

3. Characteristics:
Tar package in the form of the source code contains the content is clear-text visible sources, if there is sufficient capacity, you can modify the source code, and at the time of installation can be free to choose the required features to install (./configure parameters) and the path, and uninstall the removal of the time is also more convenient. It is recommended that you install the production server package on the line with the source code, because the source installation can adjust the compilation parameters on its own, and can maximize the customization of the installation results.
But the use of the source package also has some shortcomings, such as:
1) Too many steps in the installation process, especially when installing large and more software, when adding a variety of parameters prone to problems
2) Compile time is longer, make compile time is usually longer, one will be more than the installation of binary package for a long time
3) because the compilation of manual installation, involving the system environment is more complex, there may be a variety of problems, in the event of a problem, the novice is difficult to solve (generally will appear problems)

"Supplement":./configure, make, make install and other concepts explained

1), define the required function options
2), the detection system environment is consistent with the installation requirements
3), the definition of functional options and inspection environment system information are written to the makefile file for subsequent editing
Note 1: Each source package will have the Configure command, even if the very individual does not have this command will be replaced with other commands (such as OpenSSL./config)
Note 2: After you have performed the./configure, the makefile file is generated, and make and do install are dependent on this file for compilation and installation.

1) translate the source package into a machine-recognized language (that is, the source code-to-executable binary, similar to the. exe executable file in Windows)
2) Once the compilation is wrong and needs to be modified and then compiled again, use make clean to clear the cache file generated by the previous compilation.
Note: This step execution time is generally the longest.

Make Install
1) Real installation (for example, perform qq.exe in Windows or Wechat.exe install QQ and go to PC)
2) Once this step goes wrong, you will need to do clean and delete the corresponding directory (for example./configure use the--prefix parameter to specify installation to/usr/local/openssl, you need to delete the directory)

Four: Software source/software warehouse (repository)

1. Concept:

Software source, as the name implies is the source of software, the source of the software is the storage of various software packages or the official release of the ISO file, which contains a variety of application software.

Most Linux distributions have their own software installation and configuration options, along with their own package management systems. In order to save users from looking around for the right software installation package, these distributions will be used to centralize the software to a server, and provide users with automatic download, install the software interface, this is what we call "software warehouse." To facilitate public access, a large number of "mirrors" have been created for these repositories, making it easy for users around the world to use. Different distributions of the software warehouse are generally different, such as user interface, software richness, different image distribution and so on

Software Warehouse management software, such as Yum and Zypper, has a configuration file format of *.repo, which automatically locates and obtains the correct RPM package in the warehouse. Most Linux distributions have their own software installation and configuration options, along with their own software warehouse management systems, such as Rhel's Yum,suse Zypper,debian and the Ubuntu Apt.

2:, Format:

There are several types of repositories:

1), online access to the network, including a variety of software binary package or source package, you can customize the type of software and the number of software warehouse access can be HTTP, FTP, NFS, etc., the general government will also provide this software warehouse.

2), offline local access to obtain the way, the official release of the offline ISO file, the internal software is filtered, after the mount can also be called a software warehouse

The configuration file format for the repositories is generally: *.repo (yum,suse zypper of Rhel)

3. Characteristics:

The software warehouse contains more than just software packages, and other information (package information, location information, package dependencies, index files, etc.), like our actual life of the library, it is impossible to plug in the book can be, we will have a table, detailed records of each book summary information (author, publication Time, Country, etc.), the category, location and other information, you can quickly retrieve the book

In the Linux operating system, the installation of the software package is actually a copy of the file, that is, to copy the files used to the specific directory. Of course RPM installs the package, no exception. However, RPM is more "advanced" because it performs a check on the dependencies (Dependency) of the package and checks the package for conflicts (Conflicts) before it is installed. Finally, the relevant files inside the package are solved and placed in the corresponding location. This means that the software repository includes the header information (header) Description of all RPM packages, such as dependencies. The client uses the warehouse management software, such as Yum, to download the header file and analyze it when it is installed, so that the software can be downloaded automatically from the server and the installation task is completed correctly.

Note: The basic components of a Linux package are generally: shared libraries, applications, dependencies, services, and documentation. The use and management of software packages is known as package management.

V: Complementary Knowledge points

1. Package Uninstall:

1) Source Package Uninstall: Directly delete the installation directory, will not remain any garbage, if you create a soft link and edit the additional files, please record the removal.
2) RPM Package Uninstall: RPM-E software name (note, do not bring. RPM, with the software name displayed after installation)
However, RPM when uninstalling the package, if not careful, will be uninstalled related dependencies, it is likely to uninstall the removal system required software, causing the system to collapse, so be careful when uninstalling


Thank you for reading, I wish you a rewarding day, thank you!

This article is from the "Breeze Month Blog" blog, please be sure to keep this source

linux-What are binary packages, source packages, RPM packages, repositories

Related Article

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: 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.