Fedora/RedHat software package management guide

Source: Internet
Author: User
Tags gpg rpmbuild

Fedora/RedHat software package management guide

I. Software Installation classification:
1. Install and uninstall the local software in several situations:
A: rpm package. This kind of software package is just like the windows EXE Installation File. All the files have been compiled and packaged, And the folder to which the files should be put has been specified, installation is very convenient. In the graphic interface, you only need to double-click to automatically install. The installation and uninstallation of the terminal are described below.
(2. Install the RPM package)
B: source code package at the end of tar.gz (BZ or bz2). The package is a source program which has not been compiled. It must be compiled before installation. The installation method is as follows:
1. Open a shell, that is, the terminal
2. Run the CD command to enter the directory where the source code package is located.
3. Extract files based on the compressed package type (* indicates the compressed package name)
Tar-zxvf ***** .tar.gz
Tar-jxvf ****. Tar. BZ (or bz2)
4. Run the CD command to enter the decompressed directory.
5. Enter the command to compile the file:./configure (some compressed packages have been compiled, which can be omitted in this step)
6. Then run the command: Make
7. Run the "make install" command to install the file.
8. installation is complete.
PS: Installation Directory: Pay attention to the installation directory during the make install command process, or read the README file in the installation directory. Of course, the best way is to specify the installation directory during the installation process, that is, in. add the parameter -- prefix =/** after the/configure command, for example :. /configure -- prefix =/usr/local/AAAA, that is, install the software in the AAAA directory of the/usr/local/path. The default installation directory of common software is/usr/local or/OPT. You can find it there.
=== How to uninstall ===
1. Open a shell, that is, the terminal
2. Run the CD command to enter the compiled software directory, that is, the installation directory.
3. Execute the anti-installation command: Make uninstall
C: The installation package ending with bin. This package is similar to an RPM package and is easy to install.
1. Open a shell, that is, the terminal
2. Run the CD command to enter the directory where the source code package is located.
3. Add the executable attributes to the file: chmod + x *******. Bin (the middle is the letter X, in lower case)
3. Execute the command:./******. Bin (this is the installation package for RealPlayer for Linux)
=== How to uninstall: Delete the installation directory selected during installation.
=== It can be specified during installation, similar to Windows installation.

2. Online installation:
RedHat/Fedora install and update the software package online. In addition to the up2date provided by the system, more powerful online upgrade tools Yum and apt-Get are available. The main resources include freshrpms.net and rpm.livna.org.

(1) Use of yum
Example of installing software: # Yum install software name
Note: Yum advantages: software package dependency is self-Resolved
For details, see section 4. Usage of Yun.
(2) Use of APT
A) Installation of the software package: # apt-Get install package name // Note: Do not add a version number, just set the software name.
B) remove a software package: # apt-Get remove software package name
C) complete system upgrade: # apt-Get upgrade
                
# Apt-Get dist-Upgrade
For details, see section 5. APT usage.

3. Package Manager System-config-packages
In the Fedora Core System, the software package management tool system-config-packages is mainly used to manage the software in the system installation disk, such as adding from the installation disk, sometimes we can supplement the software that is not installed when installing the system. You can also use the software package management tool to delete the software that has been installed through the system installation disk; not very powerful in terms of functions; but it is still necessary for software patching;
For details, see section 7. Fedora Software Package Manager System-config-packages.

4. How to execute the software after installation.
After installing the software, you can execute the software in multiple ways:
A. After some software is installed, the shortcut keys are automatically added to the Application List. Just like Windows, you can find them there.
B. if it cannot be found in the Application List, you can directly enter the command in the/start/Run Command: the startup command is generally the software name, such as Firefox, realplay, xmms, etc.
C. You can also open a shell terminal and enter the software name, which is the same as running the command. If you do not know the entire command process, you can enter a letter that begins with the command and press the tab key to search. The system will automatically display all commands whose names start with the input letter.
D. You can run the Startup File directly in the installation directory. the executable icon in Linux is similar to the shell terminal icon.
E. Find the installed software startup file in the/usr/bin directory and run the command. In Linux, All executable file commands are enabled in the/usr/bin directory. You can go to the directory to find the startup command for the file you have installed and double-click Start.

Ii. RPM package installation
1. initialize the RPM Database
Run the RPM command to check whether an RPM package is installed. The RPM database is also used. Therefore, we often use the following two commands to initialize the RPM database;
# Rpm -- initdb
# Rpm -- rebuilddb Note: This takes a long time
Note: These two parameters are extremely useful. Sometimes the RPM System is faulty and cannot be installed or queried.

2. How to view files and other information related to the RPM package
Command syntax: rpm {-q | -- Query} [select-options] [query-options]
The query function of RPM is extremely powerful and one of the most important functions. For more details, refer to # Man rpm.
(1) query of software installed in the system
1) query system installed software
Syntax: rpm-Q software name
Example: # rpm-Q Gaim
    Gaim-1.3.0-1.fc4
-Q is -- Query, which means "Q" in Chinese. This command indicates whether GAIM is installed in the system. If GAIM is installed, information is output. If GAIM is not installed, will output the information that Gaim has not been installed;
To view all installed packages in the system, add the-a parameter.
# Rpm-Qa
If you view it by PAGE, add another pipeline | and more commands;
# Rpm-Qa | more
Find a software in all installed software packages, such as Gaim. You can use grep to extract the software;
# Rpm-Qa | grep Gaim
The above function is the same as that output by rpm-Q Gaim;
2) query the software package of an installed file;
Syntax rpm-QF file name
Note: the absolute path of the file name must be specified.
Example: # rpm-qf/usr/lib/libacl. La
    Libacl-devel-2.2.23-8
3) query where all installed software packages are installed
Syntax: rpm-QL software name or RPM rpmquery-QL software name
Example: # rpm-QL lynx
    # Rpmquery-QL lynx
4) query the information of an installed software package
Syntax format: rpm-Qi software name
Example: # rpm-Qi lynx
5) Check the configuration file of the installed software.
Syntax format: rpm-QC software name
Example: # rpm-QC lynx
6) view the installation location of a software installation document:
Syntax format: rpm-Qd software name
Example: # rpm-Qd lynx
7) Check the software packages and files on which the software is installed.
Syntax: rpm-QR software name
Example: # rpm-QR rpm-Python
Query the summary of installed software: for a software package that has been installed, we can combine a series of parameters, such as rpm-qil; for example: # rpm-qil lynx
(2) view uninstalled software packages:
The premise is that you have a. RPM file, that is, you can view the file. RPM of the existing software;
1) view the purpose and version of a software package.
Syntax: rpm-QPI File. rpm
Example: # rpm-QPI lynx-2.8.5-23.i386.rpm
2) view the files contained in a software package
Syntax: rpm-qpl File. rpm
Example: # rpm-qpl lynx-2.8.5-23.i386.rpm
3) view the location of the software package documentation
Syntax: rpm-qpd File. rpm
Example: # rpm-qpd lynx-2.8.5-23.i386.rpm
4) view the configuration file of a software package
Syntax: rpm-qpc File. rpm
Example: # rpm-qpc lynx-2.8.5-23.i386.rpm
5) view the dependency of a software package
Syntax: rpm-QPR file. rpm
Summary:
To obtain information about the software package, use rpm-Q and Q to query the query. You can use other options, such
I indicates info to obtain information about the software package;
L indicates list to obtain the file list;
A Indicates all and queries are executed in all packages;
F indicates file, which can be queried Based on files;
P indicates the package, which is queried Based on the software package.
The required query conditions can be generated using grep or from the command line in ''.

3. Installation, upgrade, and deletion of software packages
(1) install and upgrade an RPM package
# Rpm-VIH file. RPM note: this is used to install a new RPM package;
# Rpm-uvh file. RPM note: this is used to upgrade an RPM package;
If dependency exists, resolve the dependency. In fact, the software package manager can solve the dependency well. See the previous introduction of the Software Package Manager; if you cannot find the dependency package in the package manager, you can only compile the dependent package to solve the dependency or force the installation;
Syntax structure: # rpm-IVH file. rpm -- nodeps -- force
        
# Rpm-uvh file. rpm -- nodeps -- force
Note: The -- replacepkgs parameter is installed again with the installed software. Sometimes it is not necessary too much;
Test the installation parameter -- test, which is used to check the dependency. It is not a real installation;
Downgrade from the new version to the old version, add the -- oldpackage parameter: # rpm-uvh -- oldpackage gaim-1.3.0-1.fc4.i386.rpm
Specify the installation directory for the package, with the-Relocate parameter: rpm-IVH -- relocate/=/opt/Gaim gaim-1.3.0-1.fc4.i386.rpm added
(2). How to install the. SRC. RPM Software Package
Some software packages end with. SRC. rpm. These software packages are RPM packages that contain source code and need to be compiled during installation. There are two installation methods for such software packages,
Method 1:
(1). Execute rpm-I your-package.src.rpm
(2). CD/usr/src/RedHat/specs
(3). rpmbuild-BP your-package.specs A specs file with the same name as your package
(4). CD/usr/src/RedHat/build/your-package/a directory with the same name as your package
(5) ../configure is the same as compiling common source code software. You can add Parameters
(6). Make
(7). make install
Method 2:
(1). Execute rpm-I you-package.src.rpm
(2) The first two steps of. CD/usr/src/RedHat/specs are the same as those of method 1.
(3). rpmbuild-BB your-package.specs A specs file with the same name as your package
At this time, there is a new RPM package in the directory/usr/src/RedHat/RPM/i386/(depending on the specific package, or i686, noarch, etc, this is a compiled binary file. Run the rpm-I new-package.rpm to complete the installation.
(3). Extract files from RPM Software Package
Use tools rpm2cpio and cpio
Rpm2cpio XXX. RPM | cpio-vi
Rpm2cpio XXX. RPM | cpio-idmv
Rpm2cpio XXX. RPM | cpio -- extract -- make-Directories
The parameters I and extract are the same, indicating that the file is extracted, V indicating that the execution process is executed, and D and make-directory are the same, indicating that the directory is created based on the original path of the file in the package, M indicates the file update time.
Example:
# Rpm2cpio gaim-1.3.0-1.fc4.i386.rpm | cpio-Div
The extracted files are stored in USR and etc in the operating directory. In fact, it is better to specify the installation directory to install the software. You can also Extract files;
# Rpm-IVH -- relocate/=/opt/Gaim gaim-1.3.0-1.fc4.i386.rpm
All Gaim files are installed in/opt/Gaim. We just back up the Gaim directory and then unload it. This is actually a usage of extracting files.
(4) Delete an RPM package
First, you must learn to query the RPM package. Please refer to the previous instructions.
# Rpm-e package name
For example, if I want to remove the lynx package, the complete operation should be: # rpm-e lynx
If there is a dependency, you can also use -- nodeps to ignore the dependency check to delete it. But try not to do this. It is best to use the software package manager systerm-config-packages to delete or add software.
# Rpm-e Lynx -- nodeps
(5) Import Signature
# Rpm -- import signature file
Example: # rpm -- import RPM-GPG-KEY
For more information about the RPM signature function, see man rpm
(6) The RPM Management Package Manager supports network installation and query;
For example, if we want to query and install software packages through an image of Fedora Core 4.0, address: http://mirrors.kernel.org/fedora/core/4/i386/ OS /Fedora/RPMS/
Example:
Command Format: rpm parameter RPM package file HTTP or FTP address
# Rpm-QPI
Http://mirrors.kernel.org/fedo... fedora/RPMS/gaim-1.3.0-1.fc4.i386.rpm
(7) rpm configuration file;
The configuration file for RPM package management is rpmrc, which can be found in your system. For example, the rpmrc file in Fedora Core 4.0 is located in
# Locate rpmrc
/Usr/lib/RPM/rpmrc
/Usr/lib/RPM/RedHat/rpmrc
You can view it through rpm -- showrc.

4. Knowledge about RPM software packages
(1). What is RPM?
Rpm is the abbreviation of Red Hat package manager. It is intended to manage Red Hat software packages. As the name suggests, it is the software package management contributed by red hat; mainstream Release versions such as fedora, RedHat, mandriva, Suse, and yellowdog, as well as the release versions developed on the basis of these versions;
What are included in the RPM package? There are other files besides the hosts file;
The application in an RPM package sometimes requires files of other specific versions in addition to the additional files it carries to ensure its normality. This is the dependency of the software package; the dependency is not exclusive to Linux, and exists in the Windows operating system. For example, if we run 3D games in windows, a prompt may be prompted during installation, to install direct 9; Linux and Windows are similar;
Software Installation flowchart:

(2) usage of RPM package management
A. You can install, delete, upgrade, and manage software. Of course, you can also install and upgrade software online;
B. You can use RPM to check which files are included in the software package and which software package the file belongs;
C. check whether or not the software package in the query system is installed and its version;
D. As a developer, You can package your program as an RPM package for release;
E. Import, verify, and release of the software package signature GPG and MD5
F. check whether any software package has disrupted the system due to incompatibility;
(3) permission to use rpm;
Only root permissions can be used to install, delete, and update RPM software. Any user can perform operations on the query function. If a common user has the permission to install directories, the RPM software can also be installed;
(4) Is it true that all Linux systems use RPM?
Any system requires a package management system, so many Linux systems use the RPM System. However, the RPM System is dedicated to RH, but all systems such as TL and Mandrake also use rpm. Since the RPM source program can be compiled on other systems, it is possible to use rpm on other systems. In addition to rpm, some other systems also have their own software package management programs, for example, Deb package of Debian,
Slakware also has its own package management system.
(5) Why is the file name of the RPM package so long?
The RPM package file name contains the version information, operating system information, and hardware requirements of the software package. For example, in the mypackage-1.1-2TL.i386.rpm, mypackage is the name of the software package registered in the system 1.1 is the software version number, 2 is the release number, Tl represents for the TL operating system, or it may be RH and so on. I386 indicates that it is used on intel X86 platform, or it may be a type.
(6). What does i386 and i686 in the package file name mean?
The RPM package file name contains not only the software name and version information, but also information about the applicable hardware architecture.
I386 indicates that this software package is applicable to computers with Intel 80386 or more x86 architectures (ai32)
I686 indicates that this software package is applicable to computers with x86 architectures (ia32) over intel 80686 (Pentium Pro and above)
Noarch indicates that this software package is not related to the hardware architecture and can be used in general.
The program of the i686 software package is generally optimized for the CPU, so backward compatibility is used for comparison. The i386 package can be used on x86 machines. Forward is generally incompatible. However, currently, the CPU below the Pentium Pro is rarely used. Generally, the configured machines can use the i686 software package.
(7) can RPM packages released by different operating systems be mixed?
For RPM packages that have been compiled into binary files, they cannot be mixed due to different operating systems. Software packages released with SRC. rpm can be installed on different systems because local compilation is required during installation.
(8) some special problems encountered when using rpm
Q I used rpm-e **. RPM to delete the RPM package.
Package A name does not include rpm,
Rpm-e package name, which can contain version numbers and other information, but cannot have a suffix. rpm
Q is there any tool for reading RPM files in MS?
A wincmd with RPM plugins .....
Q Can I install and upgrade the RPM package through FTP?
A can. Rpm-IVH
FTP: // XXXXXXXX/path2somerpm
Q What if the version of the existing package is too high during RPM installation?
A sometimes because the installed software package is too old and the related software package version in the system is relatively new, some files on which the package to be installed may not be found. There are two solutions,
First, find the file with the same or similar functions as the file in the system file, and create a symbolic link to the desired directory.

From http://blog.sina.com.cn/s/blog_4de1e95001009tci.html ~ Type = v5_one & label = rela_nextarticle

Common Software Installation Methods

1. Software Installation and uninstallation:

A: rpm package. This kind of software package is just like the windows EXE Installation File. All the files have been compiled and packaged, And the folder to which the files should be put has been specified, installation is very convenient. In the graphic interface, you only need to double-click to automatically install.
= How to uninstall:
1. Open a shell Terminal
2. Because all software names in Linux contain version numbers, you are advised to determine the full name of the software before uninstalling it.
Find the RPM package software: rpm-Qa ××× *
Note: ××× refers to the several letters starting with the software name. It is not required to be fully written, but do not make a mistake. * is the wildcard number "*", that is, the asterisk, if you want to find the RealPlayer software installed on the machine, enter: rpm-Qa realplay *
3, find the software, shows the complete name of the software, such as firefox-1.0.1-1.3.2
Run the uninstall command: rpm-e firefox-1.0.1-1.3.2
=== Installation directory, execute command Look: rpm-QL firefox-1.0.1-1.3.2
= Reference: http://blog.chinaunix.net/article.p...178&blogId=1438

B: source code package at the end of tar.gz (BZ or bz2). The package is a source program which has not been compiled. It must be compiled before installation. The installation method is as follows:
1. Open a shell, that is, the terminal
2. Run the CD command to enter the directory where the source code package is located.
3. Extract files based on the compressed package type (* indicates the compressed package name)
Tar-zxvf ***** .tar.gz
Tar-jxvf ****. Tar. BZ (or bz2)
4. Run the CD command to enter the decompressed directory.
5. Enter the command to compile the file:./configure (some compressed packages have been compiled, which can be omitted in this step)
6. Then run the command: Make
7. Run the "make install" command to install the file.
8. installation is complete.
=== How to uninstall:
1. Open a shell, that is, the terminal
2. Run the CD command to enter the compiled software directory, that is, the installation directory.
3. Execute the anti-installation command: Make uninstall
==== Installation directory: Pay attention to the installation directory during the make install command process, or read the README file in the installation directory. Of course, the best way is to specify the installation directory during the installation process, in. /Add the parameter -- prefix =/** after the configure command /**,
For example:./configure -- prefix =/usr/local/AAAA, that is, install the software in the AAAA directory of/usr/local/path. The default installation directory of common software is/usr/local or/OPT. You can find it there.

C: The installation package ending with bin. This package is similar to an RPM package and is easy to install.
1. Open a shell, that is, the terminal
2. Run the CD command to enter the directory where the source code package is located.
3. Add the executable attributes to the file: chmod + x *******. Bin (the middle is the letter X, in lower case)
3. Execute the command:./******. Bin (this is the installation package for RealPlayer for Linux)
=== How to uninstall: Delete the installation directory selected during installation.
=== It can be specified during installation, similar to Windows installation.

2. How to execute the software after installation. After installing the software, you can execute the software in multiple ways:
A. After some software is installed, the shortcut keys are automatically added to the Application List. Just like Windows, you can find them there.
B. if it cannot be found in the Application List, you can directly enter the command in the/start/Run Command: the startup command is generally the software name, such as Firefox, realplay, xmms, etc.
C. You can also open a shell terminal and enter the software name, which is the same as running the command. If you do not know the entire command process, you can enter a letter that begins with the command and press the tab key to search. The system will automatically display all the commands that start with the input letter/
D. You can run the Startup File directly in the installation directory. the executable icon in Linux is similar to the shell terminal icon.
E. Find the installed software startup file in the/usr/bin directory and run the command. In Linux, All executable file commands are enabled in the/usr/bin directory. You can go to the directory to find the startup command for the file you have installed and double-click Start.

Another method is to use yum. If I want to delete Pidgin, yum info pidgin * will first find out which packages are related, and then Yum remove pidgin will be OK.


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.