To install the src. rpm package containing the source code, first install a software rpm-build.
After the software is installed, the/usr/src/RedHat folder is generated in the Red Hat 5 environment. The folder contains the following folders:
BUILDROOT: stores temporary compilation files.
BUILD: stores compiled files
SOURCE: storage SOURCE code package, such as tar.gz tar.bz2
RPMS: stores rpm packages after successful conversion.
SRPMS: stores the src. rpm package to be converted.
SPECS: stores the configuration file, which contains the generated rpm information and the compilation process definition. Very important. The file is automatically generated.
Conversion process:
1: Put the soft.1.6.src. rpm package to be installed under redhat/SRPMS.
2: Go to SRPMS and enter the command rpm-ivh soft. src. rpm,
3: after entering the command in step 2, generate the compiled module File and header file in the BUILD folder, and generate the configuration file soft.1.6.spec in SPECS.
4: Enter the command rpmbuild-bb (build banary) soft.1.6.spec in shell.
5: After completing step 4, generate the soft.1.6.rpm package in the RPMS folder. Finally, the rpm package is obtained successfully.
Convert a tar package to an rpm package
Convert under red hat 6. Unlike red hat 5, a folder/root/rpmbuild is generated after the rpm-build package is installed. The folders under rpmbuild are the same as those described above.
The conversion procedure is as follows:
1: Put soft.1.6.tar.gz under/root/rpmbuild/SOURCE.
2: Go to the SPECS directory and use vim to edit and generate a file named soft.1.6.spec !! This file name cannot be named at will. It must be the same as the name and version of the tar package to be converted !!
3: After step 2 is completed, a template is generated in the configuration file. If no template exists, the template fails.
4: If a template exists, enter the version of the tar package in the version field. The version must be consistent !! The full name of the tar package to be converted must be filled in the source0 field !!
% Install paste all the installation paths after the tar package compilation link, paste the original installation path/usr/local to $ RPM_BUILD_ROOT. replace all with the vi editor. Replace the single quotation marks with double quotation marks.
5: Because the % file option has not been filled in, enter the command rpmbuild-bb *. spec to generate an error message. copy and paste this information to the % file option,
6: Run Step 5 again to get the rpm package.
Create your own rpm package
Directory structure and configuration after rpm installation in Linux
Brief Introduction and demo of rpm and yum
Redhat Linux --- rpm command details