Create a LinuxRPM package

Source: Internet
Author: User
Article title: Create a LinuxRPM package. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
RPM is the abbreviation of Redhat Package Manage. Through RPM Management, users can package Source Code into a file form of Source and Binary. With this feature, we can install Binary files and repack them as Source files. Many Linux enthusiasts are familiar with installing RPM packages, but do not know much about how to create an RPM Package in Linux. Therefore, I will explain how to create an RPM Package in Linux through examples.
  
1. Initial requirements
To create an RPM, you need the source code to be compiled by the RPM, an rpmrc File (set the default values of some RPM and control its behavior), and a spec file (control the package creation process ). It is assumed that there are other development environments (gcc, make, install, vi, etc.), and your source code has been compiled successfully.
  
2. Production process
1) confirm that/etc/rpmrc (or/usr/lib/rpm/rpmrc) has been correctly set. The rpmrc file controls almost all RPM actions. If you want to reload one or more global settings, you can ~ The/. rpmrc file contains your customization. You can use rpm -- showrc to display the current RPM settings. In most cases, the setting of the rpmrc file does not need to be changed.
  
2) retrieve the constructed source code and put it in the correct directory.
  
3) compile the spec file.
  
4) use rpm-ba to construct the entire program suite.
  
3. Application example
The Lynx utility is used to introduce the whole process of constructing an RPM package. Lynx is a Web browser in text mode, which can be obtained from ftp://www.slcc.edu/pub/lynx.
  
1) obtain the lynx source code.
  
2) lynx-2.8.spec file detailed writing method is omitted.
  
3) use RPM to construct the package.
  
According to the default setting of the rpmrc file, you should put the lynx-2.8.spec file under the SPECS/directory and then execute:
  
Rpm-ba lynx-2.8.spec
  
-B indicates prep, compile, and install, and creates a binary RPM package. -A indicates to execute all build actions, that is, to build a source code RPM package.
  
If everything goes well, you can find the lynx-2.8-4.i386.rpm file under the RPMS/directory. Run the following command:
  
Rpm-qpl lynx-2.8-4.i386.rpm
  
To check whether the RPM package contains all required files.
  
To test its correctness, you can copy the file to another machine and execute:
  
Rpm-ivh lynx-2.8-4.i386.rpm
  
Install and test.
  
Once the test is successful, you can upload your masterpiece and enjoy the joy of success.
  
Summary
  
Developers are required to make RPM packages. For example, you must not only understand c/c ++ programming, but also be familiar with the use of tools such as make, autoconf, diff, patch, tar, and install and write spec files. However, in the long run, application RPM has benefited developers in terms of software package maintenance and convenience.
  

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.