Three methods of installing software package, introduction of rpm package, usage of rpm tool, usage of Yum tool and building local warehouse with yum

Keywords: RPM yum CentOS zlib

Three Ways to Install Software Packages

  • rpm tools
  • yum tools
  • Source package

rpm

RPM command is the management tool of RPM software package. Rpm was originally a Red Hat Linux distribution program specially designed to manage various Linux suites. It is popular because it follows GPL rules and is powerful and convenient. It is gradually adopted by other distributions. The emergence of RPM suite management makes Linux easy to install and upgrade, which indirectly improves the applicability of Linux.

yum

RPM-based package manager in Fedora, Red Hat and SUSE enables system administrators to interact and manage RPM packages more carefully and automatically. RPM packages can be downloaded and installed automatically from designated servers. Dependency relationships can be handled automatically, and all dependent packages can be installed at one time without tedious downloading and installation.

Source package

Source packages are open source, freer to install than RPM packages, but they are slower to install and more error-prone; RPM packages are compiled and can not see the source code, but they are faster to install, error-proof is easier to solve, and only dependency problems.

rpm package introduction

Mount / dev/cdrom to / mnt / below

[root@yolks1 mnt]# mount /dev/cdrom  /mnt/
mount: /dev/sr0 Write protection will be mounted as read-only

View iso mirror content

[root@yolks1 mnt]# ls
CentOS_BuildTag  GPL       LiveOS    RPM-GPG-KEY-CentOS-7
EFI              images    Packages  RPM-GPG-KEY-CentOS-Testing-7
EULA             isolinux  repodata  TRANS.TBL

After mounting the cd-ROM under / mnt, we list the directories and files under mnt. We can see that these are all the files needed to install centos system. We can see the installation package in rpm format from cd to Packages and ls after entering the directory.

yum-plugin-verify-1.1.31-42.el7.noarch.rpm
yum-plugin-versionlock-1.1.31-42.el7.noarch.rpm
yum-utils-1.1.31-42.el7.noarch.rpm
zenity-3.22.0-1.el7.x86_64.rpm
zip-3.0-11.el7.x86_64.rpm
zlib-1.2.7-17.el7.x86_64.rpm
zlib-devel-1.2.7-17.el7.x86_64.rpm
zsh-5.0.2-28.el7.x86_64.rpm
zziplib-0.13.62-5.el7.x86_64.rpm

Here, zsh-5.0.2-25.el7.x86_64.rpm is used to explain. zsh= package name 5.0.2 = version number 25.el7 = release number x86_64 = Platform (Representation system based on 32 or 64 bits) rpm = suffix name

Here I'm using centos7, which doesn't distinguish between 64 and 32 bits.

rpm tool usage

1. Install rpm: rpm-i [install] V [visualize] h [e.g. show progress]*.rpm

# Since I'm already in the current directory of the file, I've actually entered the relative path. If I'm not in the current directory of the package file, I need to make a complete absolute path.
[root@yolks1 Packages]# rpm -ivh zip-3.0-11.el7.x86_64.rpm 
In preparation...
	The package zip-3.0-11.el7.x86_64 has been installed

2. Upgrade rpm package: - U(update)vh new version. rpm

[root@yolks1 Packages]# rpm -Uvh zip-3.0-11.el7.x86_64.rpm
 In preparation...
	The package zip-3.0-11.el7.x86_64 has been installed

3. Unloading rpm packages: -e*.rpm [Some RPM packages depend more strongly on unloading, and need to delete unloading dependencies before continuing to unload]

[root@yolks1 Packages]# rpm -e zip

4. View installed rpm packages

[root@yolks1 Packages]# rpm -qa

5. Query whether the specified package has been installed: - q parameter followed by package name

[root@yolks1 Packages]# rpm -q zip
//Uninstalled package zip 
[root@yolks1 Packages]# rpm -q dhclient
dhclient-4.2.5-58.el7.centos.x86_64

6. List the files for package installation: - ql package name

[root@yolks1 Packages]# rpm -ql dhclient
/etc/NetworkManager
/etc/NetworkManager/dispatcher.d
/etc/NetworkManager/dispatcher.d/11-dhclient
/etc/dhcp/dhclient-exit-hooks.d
/etc/dhcp/dhclient-exit-hooks.d/azure-cloud.sh
/etc/dhcp/dhclient.d
/usr/lib64/pm-utils/sleep.d/56dhclient
/usr/sbin/dhclient
/usr/sbin/dhclient-script
/usr/share/doc/dhclient-4.2.5
/usr/share/doc/dhclient-4.2.5/README.dhclient.d
/usr/share/doc/dhclient-4.2.5/dhclient.conf.example
/usr/share/doc/dhclient-4.2.5/dhclient6.conf.example
/usr/share/man/man5/dhclient.conf.5.gz
/usr/share/man/man5/dhclient.leases.5.gz
/usr/share/man/man8/dhclient-script.8.gz
/usr/share/man/man8/dhclient.8.gz
/var/lib/dhclient

7. See which rpm package a command comes from: - qf parameter followed by the absolute path of the command

[root@yolks1 Packages]# rpm -qf /usr/bin/ls
coreutils-8.22-18.el7.x86_64

You can also directly use the command to query the absolute path to see: the inverted quotation mark ``

[root@yolks1 Packages]# rpm -qf `which vim`
vim-enhanced-7.4.160-4.el7.x86_64

8. View package information: - qi package name

[root@yolks1 Packages]# rpm -qi dhclient
Name        : dhclient
Epoch       : 12
Version     : 4.2.5
Release     : 58.el7.centos
Architecture: x86_64
Install Date: 2018 Friday, May 25, 2005, 0528:59 seconds
Group       : System Environment/Base
Size        : 483094
License     : ISC
Signature   : RSA/SHA256, 2017 Thursday, 10 August 2008, 23:36:17, Key ID 24c6a8a7f4a80eb5
Source RPM  : dhcp-4.2.5-58.el7.centos.src.rpm
Build Date  : 2017 Friday, 04, 08, 14:07:15
Build Host  : c1bm.rdu2.centos.org
Relocations : (not relocatable)
Packager    : CentOS BuildSystem <http://bugs.centos.org>
Vendor      : CentOS
URL         : http://isc.org/products/DHCP/
Summary     : Provides the ISC DHCP client daemon and dhclient-script
Description :
DHCP (Dynamic Host Configuration Protocol) is a protocol which allows
individual devices on an IP network to get their own network
configuration information (IP address, subnetmask, broadcast address,
etc.) from a DHCP server. The overall purpose of DHCP is to make it
easier to administer a large network.

To use DHCP on your network, install a DHCP service (or relay agent),
and on clients run a DHCP client daemon.  The dhclient package
provides the ISC DHCP client daemon.

Usage of yum tool

The biggest advantage of the yum tool is that it can download the required rpm packages online and install them automatically. If the rpm packages to be installed depend on each other, the yum tool will help us install all the relevant rpm packages in turn.

1. List available rpm packages: yum list

[root@yolks1 Packages]# yum list
...... ellipsis n That's ok
zip.x86_64                                      3.0-11.el7                          base     
zlib.i686                                       1.2.7-17.el7                        base     
zlib-devel.i686                                 1.2.7-17.el7                        base     
zlib-devel.x86_64                               1.2.7-17.el7                        base     
zlib-static.i686                                1.2.7-17.el7                        base     
zlib-static.x86_64                              1.2.7-17.el7                        base     
zsh.x86_64                                      5.0.2-28.el7                        base     
zsh-html.x86_64                                 5.0.2-28.el7                        base     
zziplib.i686                                    0.13.62-5.el7                       base     
zziplib.x86_64                                  0.13.62-5.el7                       base     
zziplib-devel.i686                              0.13.62-5.el7                       base     
zziplib-devel.x86_64                            0.13.62-5.el7                       base     
zziplib-utils.x86_64                            0.13.62-5.el7                       base

The three columns listed represent: How many names are there: version number and platform version number: warehouse name

View the source of the warehouse name: view the yum configuration file

[root@yolks1 Packages]# ls /etc/yum.repos.d/
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo    CentOS-Vault.repo
CentOS-CR.repo    CentOS-fasttrack.repo  CentOS-Sources.repo

View specific source files:

[root@yolks1 Packages]# cat /etc/yum.repos.d/CentOS-Base.repo

2.yum search Installation Package: search Package Name

[root@yolks1 Packages]# yum search vim

Precise search using yum list |grep "vim"

3.yum installation rpm package: Yum install-y package name

[root@yolks1 Packages]# yum install -y zip

4. List available groups

[root@yolks1 Packages]# yum grouplist
Failed to set locale, defaulting to C
Loaded plugins: fastestmirror
There is no installed groups file.
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirrors.nju.edu.cn
 * extras: mirrors.nju.edu.cn
 * updates: mirrors.nju.edu.cn
Available Environment Groups:
   Minimal Install
   Compute Node
   Infrastructure Server
   File and Print Server
   Basic Web Server
   Virtualization Host
   Server with GUI
   GNOME Desktop
   KDE Plasma Workspaces
   Development and Creative Workstation
Available Groups:
   Compatibility Libraries
   Console Internet Tools
   Development Tools
   Graphical Administration Tools
   Legacy UNIX Compatibility
   Scientific Support
   Security Tools
   Smart Card Support
   System Administration Tools
   System Management
Done

Installation components

yum groupinstall 'Virtualization Host'

5. Unload rpm packages and dependent packages

[root@yolks1 Packages]# yum remove zsh

6. Update rpm packages: Upgrade all packages by default without specifying package names

[root@yolks1 Packages]# yum update zsh

7. Relevance of Search Packets

yum provides "/*/zsh"

yum builds local warehouse

If the network is not allowed, we need to build our own local environment yum

1. Mount the image to / mnt / directory

[root@yolks1 Packages]# cd /mnt/
[root@yolks1 mnt]# ls
CentOS_BuildTag  EULA  LiveOS    RPM-GPG-KEY-CentOS-7          TRANS.TBL  isolinux
EFI              GPL   Packages  RPM-GPG-KEY-CentOS-Testing-7  images     repodata

2. Backup related directories and files

[root@yolks1 mnt]# cp -r /etc/yum.repos.d  /etc/yum.repos.d.bak

3. Enter the yum.repos.d directory

[root@yolks1 mnt]# cd /etc/yum.repos.d
[root@yolks1 yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Sources.repo  CentOS-fasttrack.repo
CentOS-CR.repo    CentOS-Media.repo      CentOS-Vault.repo

4. Delete all files in the directory

[root@yolks1 yum.repos.d]# rm -rf ./*

5. Edit the file dvd.repo and write the following

[dvd] # Specify warehouse name
name=install dvd # Descriptive fields
baseurl=file:/// The source or path of the mnt rpm package, where the CD-ROM drive is mounted
enable=1 #Availability, 1 is Available
gpgcheck=0 # Whether to check, 0 is not to check

6. Clean up the software source (cache)

yum clean all

7. Look at the source again in yum list

xterm.x86_64                                    295-3.el7                           dvd      
xulrunner.x86_64                                31.6.0-2.el7.centos                 dvd      
xvattr.x86_64                                   1.3-27.el7                          dvd      
xz-devel.x86_64                                 5.2.2-1.el7                         dvd      
yelp.x86_64                                     1:3.22.0-1.el7                      dvd      
yelp-libs.x86_64                                1:3.22.0-1.el7                      dvd      
yelp-tools.noarch                               3.18.0-1.el7                        dvd      
yelp-xsl.noarch                                 3.20.1-1.el7                        dvd      
yp-tools.x86_64                                 2.14-5.el7                          dvd      
ypbind.x86_64                                   3:1.37.1-9.el7                      dvd      
ypserv.x86_64                                   2.31-10.el7                         dvd      
yum-plugin-aliases.noarch                       1.1.31-42.el7                       dvd      
yum-plugin-changelog.noarch                     1.1.31-42.el7                       dvd      
yum-plugin-tmprepo.noarch                       1.1.31-42.el7                       dvd      
yum-plugin-verify.noarch                        1.1.31-42.el7                       dvd      
yum-plugin-versionlock.noarch                   1.1.31-42.el7                       dvd      
zenity.x86_64                                   3.22.0-1.el7                        dvd      
zlib-devel.x86_64                               1.2.7-17.el7                        dvd      
zsh.x86_64                                      5.0.2-28.el7                        dvd      
zziplib.x86_64                                  0.13.62-5.el7                       dvd

rpm packages installed with @ symbol

Expand

  1. yum keeps installed packages http://www.360doc.com/content/11/0218/15/4171006_94080041.shtml
  2. Building yum source of local area network http://blog.lishiming.net/?p=500

Posted by aleksandra on Sat, 18 May 2019 19:22:32 -0700