foreword
This issue mainly talks about the commands related to package software management in Linux. Although there are only two commands in this issue. However, the installation and uninstallation of software packages are the most commonly used and need to be mastered.
rpm and yum are the main package managers for CentOS.
Both commands are useful
①yum needs the Internet, and yum will go to the yum source on the Internet to obtain the required software packages
② The rpm operation is relatively complicated and requires us to do more
rpm rpm package manager
1 Introduction
The rpm command includes five basic functions of installation, uninstallation, upgrade, query and verification
2. Grammar format
rpm [参数选项]
3. Parameter options
parameter | Parameter Description |
---|---|
-q | query package |
-p | Packages followed by ".rpm" suffix |
-i | ①Used in conjunction with -qp, it means to display the general information info of the software package ②Install the software package install |
-l | Display a list of all files in a package |
-R | Show package dependencies |
-v | show details |
-h | Use "#" to display the installation progress bar |
-a | Used with the -q parameter to query all packages |
-e | uninstall package |
-f | Query which package a file or command belongs to |
-U | upgrade package |
4. Practical operation
We download an rpm package telnet-server-0.17-66.el7.x86_64.rpm as a follow-up practice file
[root@xiezhr test]# wget https://mirrors.aliyun.com/centos/7.9.2009/updates/x86_64/Packages/telnet-server-0.17-66.el7.x86_64.rpm
--2022-08-02 22:47:29-- https://mirrors.aliyun.com/centos/7.9.2009/updates/x86_64/Packages/telnet-server-0.17-66.el7.x86_64.rpm
Resolving mirrors.aliyun.com (mirrors.aliyun.com)... 101.226.26.240, 101.226.26.241, 101.226.26.242, ...
Connecting to mirrors.aliyun.com (mirrors.aliyun.com)|101.226.26.240|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 42148 (41K) [application/octet-stream]
Saving to: ‘telnet-server-0.17-66.el7.x86_64.rpm’
100%[========================================================================================================================================================================>] 42,148 --.-K/s in 0.01s
2022-08-02 22:47:29 (3.70 MB/s) - ‘telnet-server-0.17-66.el7.x86_64.rpm’ saved [42148/42148]
① View rpm package information
[root@xiezhr test]# rpm -qpi telnet-server-0.17-66.el7.x86_64.rpm
Name : telnet-server
Epoch : 1
Version : 0.17
Release : 66.el7
Architecture: x86_64
Install Date: (not installed)
Group : System Environment/Daemons
Size : 56361
License : BSD
Signature : RSA/SHA256, Wed 18 Nov 2020 10:20:43 PM CST, Key ID 24c6a8a7f4a80eb5
Source RPM : telnet-0.17-66.el7.src.rpm
Build Date : Tue 17 Nov 2020 12:44:28 AM CST
Build Host : x86-01.bsys.centos.org
Relocations : (not relocatable)
Packager : CentOS BuildSystem <http://bugs.centos.org>
Vendor : CentOS
URL : http://web.archive.org/web/20070819111735/www.hcs.harvard.edu/~dholland/computers/old-netkit.html
Summary : The server program for the Telnet remote login protocol
Description :
Telnet is a popular protocol for logging into remote systems over the
Internet. The package includes a daemon that supports Telnet remote
logins into the host machine. The daemon is disabled by default.
You may enable the daemon by editing /etc/xinetd.d/telnet
② View the contents of the rpm package
[root@xiezhr test]# rpm -qpl telnet-server-0.17-66.el7.x86_64.rpm
/usr/lib/systemd/system/telnet.socket
/usr/lib/systemd/system/[email protected]
/usr/sbin/in.telnetd
/usr/share/man/man5/issue.net.5.gz
/usr/share/man/man8/in.telnetd.8.gz
/usr/share/man/man8/telnetd.8.gz
③ View the dependency environment of the rpm package
[root@xiezhr test]# rpm -qpR telnet-server-0.17-66.el7.x86_64.rpm
/bin/sh
/bin/sh
/bin/sh
libc.so.6()(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.15)(64bit)
libc.so.6(GLIBC_2.16)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libc.so.6(GLIBC_2.8)(64bit)
libutil.so.1()(64bit)
libutil.so.1(GLIBC_2.2.5)(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rtld(GNU_HASH)
systemd
systemd
systemd
systemd
rpmlib(PayloadIsXz) <= 5.2-1
④ Install the rpm package ( parameter h displays a progress bar with "#" )
[root@xiezhr test]# rpm -ivh telnet-server-0.17-66.el7.x86_64.rpm
Preparing... ################################# [100%]
Updating / installing...
1:telnet-server-1:0.17-66.el7 ################################# [100%]
⑤ Query whether to install the specified rpm package
[root@xiezhr test]# rpm -qa telnet-server
telnet-server-0.17-66.el7.x86_64
⑥ Uninstall the rpm package
# 卸载刚才安装的telnet-server
[root@xiezhr test]# rpm -e telnet-server
# 再次查看rpm包,已经没有了,说明卸载成功了
[root@xiezhr test]# rpm -qa telnet-server
yum automated RPM package management tool
1 Introduction
The yum command is mainly used to automatically install and upgrade rpm packages, and requires an Internet connection
2. Grammar format
yum [参数选项] [指令] [软件包]
3. Common parameters
parameter | Parameter Description |
---|---|
-y | Confirm the action |
-q | do not output information |
-v | show details |
4. Common commands
instruction | Instruction description |
---|---|
yum install softwarename | install softwarename package |
yum repolist | List enabled yum sources |
yum repolist all | List all yum, including disabled yum sources |
yum remove softwarename | uninstall softwarename package |
yum list softwarename | Check if the software is available in the software sources |
yum list all | List all software names |
yum list installd | List installed software names |
yum list available | List software names that can be installed with yum |
yum clean all | clear yum cache |
yum search softwarename | Search software name according to software information |
yum whatprovides filename | Find packages containing filename file in yum sources |
yum update | update software |
yum history | View system software change history |
yum reinstall softwarename | re-install |
yum info softwarename | View software information |
yum groups list | View software group information |
yum groups info softwaregroup | View software included in a software group |
yum groups install softwaregroup | Install components |
5. Practical operation
① Install httpd package
[root@xiezhr ~]# yum install httpd
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
epel | 4.7 kB 00:00:00
extras | 2.9 kB 00:00:00
nodesource | 2.5 kB 00:00:00
os | 3.6 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/4): epel/7/x86_64/group_gz | 97 kB 00:00:00
(2/4): epel/7/x86_64/updateinfo | 1.1 MB 00:00:00
(3/4): epel/7/x86_64/primary_db | 7.0 MB 00:00:01
(4/4): updates/7/x86_64/primary_db
...
② Check whether there is this software in the yum source
[root@xiezhr ~]# yum list telnet-server
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
Available Packages
telnet-server.x86_64 1:0.17-66.el7 updates
③ Clear yum cache
[root@xiezhr ~]# yum clean all
Loaded plugins: fastestmirror, langpacks
Cleaning repos: epel extras nodesource os updates
The content of this issue is here, and the next issue will use the commands related to Linux users according to the mind map.
The commands involved are: useradd, usermod, userdel, groupadd, groupdel, su, passwd, etc.
Please look forward to it (●'◡'●)