Use of srpm: rpmbuild
Srpm containing source code
The new version of RPM has separated the RPM and srpm commands. srpm uses the rpmbuild command instead of the RPM! If you are a user before Red Hat 7.3, use RPM to replace rpmbuild!
Use the default value to install the srpm file (-- rebuid/-- recompile)
-- Rebuild |
This option will "compile" and "package" the subsequent srpm, and finally generate the RPM file, but the generated RPM file is not installed on the system. When you use -- rebuild, we usually find a line of Font: Wrote:/usr/src/RedHat/RPMS/i386/pkgname. i386.rpm This is the compiled RPM file! This file can be used for installation! Add an absolute path for installation! |
-- Recompile |
This action will directly "compile", "package", and "Install! Please note that rebuild is only "compile and package", while recompile not only compiles and packs, but also performs "Install" at the same time! |
However, it should be noted that neither of these two options has modified the configuration values in the srpm, only by re-compiling to generate the RPM installable software file. In general, if the compilation is successful, the intermediate slow archive generated during the compilation process will be automatically deleted. If any errors occur, the intermediate file will be retained on the system, wait for the user's debugging! So, how should we correct the error? If you want to debug the error by yourself or modify the configuration value in srpm, you need to know which important directories will be used by the system when srpm is used! Let's talk about the directory that the system will use when processing srpm.
Path and required software used by srpm
Since srpm contains the source code, there must be a configuration file, so first we must know which directories will this srpm use during compilation? So that we can modify it! You can check in your/usr/src directory. Generally, the directories provided by each distribution are different. Take centos 5.x as an example, it uses/usr/src/RedHat/as the working directory, while OpenLinux uses/usr/src/OpenLinux as the working directory! In any case, it is in the/usr/src directory! Well, since we are centos, please go to/usr/src/RedHat to have a look:
/Usr/src/RedHat/specs |
The configuration files of the software are placed in this directory. For example, the information parameters and configuration items of the software are all placed here; |
/Usr/src/RedHat/sources |
This directory contains the original file of the software (* .tar.gz file) and config configuration file; |
/Usr/src/RedHat/build |
During compilation, some cached data is stored in this directory; |
/Usr/src/RedHat/RPMS |
After compilation and successful compilation, the packaged files are placed in this directory. There are sub-directories including i386, i586, i686, noarch... and so on. |
/Usr/src/RedHat/srpms |
Similar to rpms, The srpm-encapsulated file is placed here! Sometimes when you want to release your software in srpm mode, your srpm file will be placed in this directory. |
In addition, unknown errors or configuration errors may occur during the compilation process. At this time, a corresponding error file will be generated under/tmp, you can perform the debugging based on this error file! After all the problems are solved, the compilation is successful. The files after decompression are in/usr/src/RedHat/specs, sources, all files such as build will be killed, and only files placed under/usr/src/RedHat/RPMS will be left!
Because srpm needs to be re-compiled, during the compilation process, we need at least make programs related to it, and GCC, C, c ++ and other programming languages used for compilation. For more information, see the basic software required for the source code in Chapter 22nd. Therefore, if you have not selected software such as software development tools during the installation process, haha! You have to take out your CD and install it again! Haha! You just have to overcome a lot of attribute dependency problems ~ You can use Yum to solve this problem later. You can also use "yum groupinstall" development tools "" to install and develop software first. Let's assume that you have installed the software group.
Example:
Try to use the -- rebuild option to make an RPM software file, you can go to the national high-speed network center to download the RP-pppoe this srpm software file, you can find this software to download in the http://ftp.twaren.net/Linux/CentOS/5/ OS /SRPMS. Bird brother here using centos 5.3 rp-pppoe-3.5-32.1.src.rpm Oh.
A: If you have downloaded the RP-pppoe software to/root, you can use the following method to re-compile it:
Chapter 2 software installation: rpm, srpm, and Yum Functions