System software package management in Linux (rpm, yum, and source code package installation)

Source: Internet
Author: User

System software package management in Linux (rpm, yum, and source code package installation)

1. rpm Tool
Rpm is called RedHat Package Manager. It is a Red Hat software Package management tool with an open design concept. It is not only available on the RedHat platform, but also on SUSE.

The rpm package name consists of-and. divided into several parts, such as abrt-cli-2.0.8-15.el6.CentOS.i686.rpm, abrt-cli is the package name, 2.0.8-15 is the version number, el6 refers to redhat Enterprise 6, centos refers to this is on centos, i686 refers to the platform type. Some rpm packages do not have a specific platform but noarch, which means this rpm package has no hardware platform restrictions.

Install a package: rpm-ivh/mnt/Packages/libjpeg-turbo-devel-1.2.1-1.el6.i686.rpm
-I indicates Installation
-V Visualization
-H: displays the installation progress.
-- Force: force installation. It must be installed even if it overwrites files of other packages.
-- Nodeps: When the rpm package to be installed depends on other packages, you must install this package even if other packages are not installed.

[Root @ localhost mnt] # rpm-ivh tree-1.5.3-2.el6.i686.rpm
Preparing... ######################################## ### [100%]
1: tree ####################################### #### [100%]

Upgrade: rpm-Uvh filename. rpm
-U indicates the upgrade.

Rpm uninstallation:
Rpm-e filename // here the filename is queried through the rpm query function
Rpm-qa | grep libjpeg-turbo-devel
Rpm-e libjpeg-turbo-devel
12345 [root @ localhost ~] # Rpm-q tree
Tree-1.5.3-2.el6.i686
[Root @ localhost ~] # Rpm-e tree
[Root @ localhost ~] # Echo $?
0

Echo $? Check the execution status of the previous command. If the returned value is 0, the execution is successful. If the value is not 0, the execution is unsuccessful;

Check whether a package is installed
Rpm-q package name (without platform information or suffix)

[Root @ localhost ~] # Rpm-q tree
Package tree is not installed

Query all installed rpm packages of the current system
Rpm-qa

Query the rpm package information:
Rpm-qi package name

List the files installed by an rpm:
Rpm-ql package name
[Root @ localhost ~] # Rpm-ql vim-enhanced
/Etc/profile. d/vim. csh
/Etc/profile. d/vim. sh
/Usr/bin/ex
/Usr/bin/rvim
/Usr/bin/vim
/Usr/bin/vimdiff
/Usr/bin/vimtutor
/Usr/share/man/man1/rvim.1.gz
/Usr/share/man/man1/vimdiff.1.gz
/Usr/share/man/man1/vimtutor.1.gz

Check which rpm package a file belongs:
Rpm-qf filename

[Root @ localhost ~] # Rpm-qf/etc/passwd
Setup-2.8.14-20.el6_4.1.noarch

2. yum Tool
Yum list lists all available rpm package Resources
Search for a package: yum search 'keyword' or yum list | grep 'keyword'
Yum installation package: yum install-y filename (package name)
Yum uninstall package: yum remove-y filename (package name)
Yum update package: yum update-y filename (package name)

Yum search package: yum provides "*/vim" // use the wildcard here to find the package for which a command is installed.

Yum grouplist list all suites
Yum groupinstall installation kit
Yum groupremove uninstall Kit


Create a local yum Source
Mount/dev/cdrom/mnt
Cp-r/etc/yum. repos. d/etc/yum. repos. d. bak // back up
Rm-f/etc/yum. repos. d /*
Vim/etc/yum. repos. d/dvd. repo # Add the following content:
[Dvd]
Name = install dvd
Baseurl = file: // mnt
Enabled = 1
Gpgcheck = 0
Yum list // check whether there is a dvd mark


You can install the yum extension source epel to install nginx and zabbix.
Rpm-ivh www.lishiming.net/data/attachmen... e-6-8_32.noarch.rpm
(Other http://www.aminglinux.com/bbs/thread-6721-1-1.html addresses)
12 [root @ localhost ~] # Rpm-ivh http://www.lishiming.net/data/attachment/forum/epel-release-6-8_32.noarch.rpm
Retrieving failed/var/tmp/rpm-tmp.YcVQW6: Header V3 RSA/SHA256 Signature, key ID 0608b895: NOKEYPreparing... ######################################## ### [100%] 1: epel-release ##################################### ###### [100%]

After the installation is complete, many epel packages can be listed on the right side of the yum list for future use;

Use yum to download the rpm package without installing it. Method 1:
Yum has a plug-in called yum-downloadonly, which allows users to download only the software package;
First install the plug-in: yum install-y yum-plugin-downloadonly
After the installation is complete: yum install package name-y -- downloadonly
# This will have been downloaded. By default, centos6 is in the/var/cache/yum/i386/6/base/packages directory. Here the 32-bit directory is displayed as i386;
Yum install package name-y -- downloadonly -- downloaddir =/usr/local/src # specifies a download directory. If the rpm package has been installed and fails, use reinstall: yum reinstall package name-y -- downloadonly -- downloaddir =/usr/local/src
Reinstall and reinstall;

Example:

[Root @ localhost yum] # yum install-y yum-plugin-downloadonly
[Root @ localhost packages] # pwd
/Var/cache/yum/i386/6/base/packages
[Root @ localhost packages] # ls-l
-Rw-r --. 1 root 36464 Jul 3 2011 tree-1.5.3-2.el6.i686.rpm

Use yum to download the rpm package without installing it. Method 2:

Use a dedicated package download tool, yumdownloader. This tool is a subset of the yum Toolkit (including the help toolkit for yum package management.

Run the following command to install yum install-y yum-utlis:
After the installation is complete, download the rpm package and run the command: yumdownloader package name
To save the downloaded package to the current directory, you need to use the root permission, because yumdownloader will update the package index file during the download process. Unlike the yum command, no dependent package will be downloaded.

Set yum to retain the downloaded rpm package
By default, the downloaded rpm package is deleted after the upgrade or installation of yum.

Modify the/etc/yum. conf configuration file to keep the downloaded package;
[Main]
Cachedir =/home/soft/yumcache
Keepcache = 1
Debuglevel = 2
The address where cachedir stores the downloaded package. You can change it to your own address;
If keepcacahe is set to 1, the downloaded rpm package is saved;

3. Install the source code package
The source code package is an open-source package that can be modified by itself. It is mostly developed in C language and cannot be used directly. It must be compiled into binary executable files;
The source code package must be supported by gcc. If you do not need to install yum install-y gcc
Generally, compile the three steps:./configure to configure various compilation parameters; make to compile Based on the specified compilation parameters; make install to the specified directory

Instance:
1. Download the source code package # cd/usr/local/src/# The agreed directory;
First install wget and run the command: yum install-y wget.

# Wget http://mirrors.hust.edu.cn/apache//httpd/httpd-2.2.29.tar.gz
2. Unzip the tar zxvf httpd-2.2.29.tar.gz // view the README or INSTALL description file
3. Specify the compilation parameter./configure -- help to view help.
#./Configure -- prefix =/usr/local/apache2 specify a path;
The command "checking for gcc... no" must be installed with the gcc compiler. install the command # yum install-y gcc.
4. # echo $? Verify whether it is successful
5. # make: a binary file;
6. # make install the compiled file;

Getting started with creating an RPM package

In Linux, how does one create an 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

Use FPM to easily create an RPM package

This article permanently updates the link address:

Related Article

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.