The rpm package introduces the usage of the rpm tool and the usage of the yum tool

Three ways to install packages

  • rpmtools
  • yumtools
  • source package

rmp package introduction

Set CD-ROM and mount mount /dev/cdrom /mnt

package name - version number - release version number - platform

List files installed by a package

Query whether the specified package is installed

[root@g_linux01 ~]# rpm -q ppp
未安装软件包 ppp 
[root@g_linux01 ~]# rpm -q kmod
kmod-20-15.el7.x86_64

If you don't know the file path, you can check it with `which cd`

yumtools

When using rpm, if the package to be installed depends on many packages, it will be troublesome. Using yum will automatically install the dependent package.

  • yum list shows available rpm packages

On the left is the package name, in the middle is the version information, and on the right is the warehouse name. The warehouse displays @base and @anaconda to indicate that it has been installed. If it is not installed this shows base or anaconda, if it is updates it is installed but needs to be upgraded.

[root@glinux-01 ~]# yum list|head -10
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
已安装的软件包
GeoIP.x86_64                                1.5.0-11.el7               @anaconda
NetworkManager.x86_64                       1:1.8.0-9.el7              @anaconda
NetworkManager-libnm.x86_64                 1:1.8.0-9.el7              @anaconda
NetworkManager-team.x86_64                  1:1.8.0-9.el7              @anaconda
  • The yum configuration file: /etc/yum.repos.d/Centos-Base.repo can configure the warehouse name,

yum源地址[base] //仓库名 name=CentOS-$releasever – Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra //yum源地址。 #baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/ gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

  • yum search vim Search for packages related to vim
[root@glinux-01 ~]# yum search vim
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
============================================ N/S matched: vim ============================================
protobuf-vim.x86_64 : Vim syntax highlighting for Google Protocol Buffers descriptions
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System
vim-common.x86_64 : The common files needed by any version of the VIM editor
vim-enhanced.x86_64 : A version of the VIM editor which includes recent enhancements
vim-filesystem.x86_64 : VIM filesystem layout
vim-minimal.x86_64 : A minimal version of the VIM editor

  名称和简介匹配 only,使用“search all”试试。
  • yum list|grep vim can search by match
  • Install package yum install [-y] [package name] (-y plus this option will not ask whether to install)
  • yum grouplist list available groups
[root@glinux-01 ~]# yum grouplist
已加载插件:fastestmirror
没有安装组信息文件
Maybe run: yum groups mark convert (see man yum)
Loading mirror speeds from cached hostfile
 * base: mirrors.tuna.tsinghua.edu.cn
 * extras: mirrors.tuna.tsinghua.edu.cn
 * updates: mirrors.tuna.tsinghua.edu.cn
可用的环境分组:
   最小安装
   基础设施服务器
   计算节点
   文件及打印服务器
   基本网页服务器
   虚拟化主机
   带 GUI 的服务器
   GNOME 桌面
   KDE Plasma Workspaces
   开发及生成工作站
可用组:
   传统 UNIX 兼容性
   兼容性程序库
   图形管理工具
   安全性工具
   开发工具
   控制台互联网工具
   智能卡支持
   科学记数法支持
   系统管理
   系统管理工具
完成
  • yum groupinstall [-y] [group name] (first convert the above content to English LENG=en, then select)
  •  yum remove [-y] uninstall package
  • yum update [-y] [package name] update package (if no package name is added, all the system will be updated)
  • yum provide "/*/vim" to search which packages a command has

 yum local repository (use local CD to make yum source)

Creation method: 1 Mount the image to the /mnt directory (mount /dev/cdrom /mnt)

               2 cp -r /etc/yum.repos.d /etc/yum.repos.d.bak

               3 rm -f /etc/yum.repos.d/*

               4 vim /etc/yum.repos.d/dvd.repo// The content is as follows

[dvd] //Warehouse name
name=install dvd
baseurl=file:///mnt //Local source address ? ?

(file:// /mnt)
enable=1 //Whether it is available locally, 1 is available, 0 is
unavailable gpgcheck=0 //Whether it is detected, 1 is detected, 0 is not detected

  • yum clean all //Clear cache
  • yum list

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325343188&siteId=291194637