The System File rpm package required for Linux compilation and installation is used by me.

Source: Internet
Author: User
Tags rpmbuild

It is particularly worth mentioning that there are many things worth learning about in Linux compilation. Here we mainly introduce Linux compilation, including Linux compilation. For beginners who compile Linux, you may see file. src. rpm-formatted software packages, but I don't know how to use them. I don't know much about the software packages that are too detailed. After all, I am not from a computer science class, and a simple application is still quite good, a little deeper, we can only rely on our brethren ~ This document describes the simple usage of file. src. rpm and file. spec;

Source code package file.tar.gz?file.tar.bz2 or file. src. all rpm packages can compile the files that can be installed and executed. rpm package. Some software developers will package the source code package into a file. src. rpm file.tar.gz and so on can also write executable files. rpm compiled script file. spec;

If our technology is feasible, we can write the compiling script file by ourselves. spec file. spec file. We can share it with other people, or get file from others. spec file, and then we can modify and modify it ourselves to compile the rpm package suitable for our system;

1. Compile the rpm package through file. src. rpm and file. spec for my use;

We can see file in Fedora/Redhat or other RPM-based package management systems. src. rpm and file. rpm; file. src. rpm is the rpm format of the SOURCE code package. You can also install it, which is displayed in the/usr/src/redhat/SOURCE directory after installation;

For example, we need to use unrar-3.5.2-1.2.fc4.src.rpm and unrar. spec to compile the rpm package; First we download two files:

 
 
  1. Unrar-3.5.2-1.2.fc4.src.rpm and unrar. spec
  2. # Wget http://ftp.freshrpms.net/pub/freshrpms/fedora/linux/4/unrar/unrar-3.5.2-1.2.fc4.src.rpm
  3. # Wget http://svn.rpmforge.net/svn/trunk/rpms/unrar/unrar.spec

Download complete:

 
 
  1. [root@localhost beinan]# ls unrar*  
  2. unrar-3.5.2-1.2.fc4.src.rpm  unrar.spec 

Linux compilation and installation of source package unrar-3.5.2-1.2.fc4.src.rpm; look at the installation where it is?

 
 
  1. [root@localhost beinan]# rpm -ivh unrar-3.5.2-1.2.fc4.src.rpm 

Install it here:

 
 
  1. [root@localhost beinan]# ls /usr/src/redhat/SOURCES/unrar  
  2. unrar.1                unrarsrc-3.5.2.tar.gz 

Then we use unrar. spec to execute it. In fact, it is a compiled script;

 
 
  1. [root@localhost beinan]# rpmbuild --ba unrar.spec 

Linux compilation completed:

 
 
  1. [root@localhost beinan]# ls /usr/src/redhat/RPMS/i386/  
  2. unrar-3.5.2-1.i386.rpm  unrar-debuginfo-3.5.2-1.i386.rpm 

Can it be installed?

 
 
  1. [root@localhost beinan]# rpm -ivh /usr/src/redhat/RPMS/i386/unrar-3.5.2-1.i386.rpm  
  2. Preparing... ########################################### [100%]  
  3. 1:unrar ########################################### [100%] 

Is it available?

 
 
  1. [root@localhost beinan]# unrar x mydoc.rar 

Clean up junk files: If you often use this method to compile RPM packages, you can mainly clean up the contents of various directories in/usr/src/redhat;

Second, use file.tar.gz file.tar.bz2 and file. sepc to compile rpm;

We can put file.tar.gz or file.tar.bz2 in the/usr/src/redhat/SOURCE directory, and then execute file. spec file; sometimes some software developers put the file. spec is placed in the source code package. At this time, we need to decompress the package and check whether it exists. If most of them exist, use the following method:

 
 
  1. [root@localhost beinan]# cp file.tar.gz /usr/src/redhat/SOURCES/  
  2. [root@localhost beinan]# tar zxvf file.tar.gz  
  3. [root@localhost beinan]# cd filedir  
  4. [root@localhost beinan]# rpmbuild --ba file.spec 

3. What should I do if there is no spec file?

If you just want to install the software, you can use the following method;

 
 
  1. [Root @ localhost beinan] # tar zxvf file.tar.gz or tar file.tar.bz2
  2. [Root @ localhost beinan] # cd filedir
  3. [Root @ localhost beinan] #./configure -- help

Note: You can use -- help to view the parameters. If you do not know how to add the parameters, it is generally the default value. You can compile a few parameters in Linux;

 
 
  1. [root@localhost beinan]# make  
  2. [root@localhost beinan]# make install  
  3. [root@localhost beinan]# make clean 

Some software only provides older files. spec file, we can transform file. spec file to fit a new version of the software; you can also go to the http://svn.rpmforge.net/svn/trunk/rpms to find if there is a corresponding file. spec file;

Some software does not provide file. spec file, and you cannot find similar files on the resource station, and you also want to create a file from the source code package. rpm packet to communicate with you, that had to learn to write; we can take http://svn.rpmforge.net/svn/trunk/rpms as a learning resource, is also a happy thing;

For beginners to understand the usefulness of file. src. rpm, you don't have to read it. If you want to add file. spec to write rules and learning methods, welcome.

  1. Explanation of Linux compilation errors and Solutions
  2. How to install MIC2 in linux Compilation
  3. The linux compiler GCC 4.3.0 has been released.
  4. Linux operating system Redhat series and Debian Series
  5. Install the flash plug-in the Linux Firefox Chinese menu

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.