软件管理rpm

软件管理

1.获取程序包的途径

1.1 系统发行版的光盘或官方的服务器

1.百度网络地址

1.2 第三方组织 — 搜索引擎

2.linux rpm包

1.3 项目官方网站

2. rpm包管理器的职责

  • 将二进制程序,库文件,配置文件,帮助文件打包成一个新文件

  • 安装软件时需要把这些文件放在相应的位置

  • 生成数据库文件,追踪安装软件所放的位置

  • 软件卸载时根据安装时生成的数据库文件,将相应的文件删除

3. rpm包管理器的核心功能

  • 制作软件包
  • 安装软件
  • 卸载软件
  • 升级软件
  • 查询软件
  • 校验软件

4. rpm包管理

  • 程序的组成清单(每个包独有)

    • 文件清单(包里面包含的文件,二进制文件,库文件)
    • 安装或卸载时运行的脚本
  • 数据库(公共)

    • 程序包名称及版本

    • 依赖关系

    • 功能说明

    • 安装生成的各文件的文件路径及校验码信息

      • 校验码信息发生改变

      • [root@SYL2 ~]# ls
        007      7899  abc              passwd  test.tar.gz
        1.1.txt  a     anaconda-ks.cfg  sdv
        [root@SYL2 ~]# md5sum passwd 
        1535156b83d75bc2449bf85407fe7861  passwd
        [root@SYL2 ~]# echo '##' >> passwd
        [root@SYL2 ~]# md5sum passwd 
        d53e2d502301db6eccdf0f2855e7589e  passwd
        

5. 分类

  • 二进制格式(编译好的,安装后可以使用)

    • rpm包作者下载源程序,编译配置完成后,制作成rpm包
      • 制作rpm包的原因:
        • 有些特性是编译时选定的,如果编译时未选定此特性,将无法使用
        • rpm包的版本会落后于源码包,甚至落后很多
          • 落后源码包是为了求稳定
  • 源码格式(需要编译,也叫定制)

    • 命名方式:name-VERSION.tar.gz
      • version:major.minor.release
      • 格式:主版本号(major),次版本号(minor),发行号(release)

6. rpm包管理工具

  • 前端工具

    • yum

    • dnf (Fedora 22+ rpm前端管理工具)

    • apt-get(debian 系列)

    • zypper (suse上的rpm前端管理工具)

  • 后端工具

    • rpm — 红帽系列(红帽系统,centos 系列 )
    • dpt — debianUbuntu 系统)

注意

1.前端工具是依赖于后端工具的

2.前端工具是为了自动解决后端工具的依赖关系而存在的

7. rpm包的命名

  • 命名

  • wget-1.19.5-10.el8.x86_64.rpm
    wget 软件名称
    1 主版本
    19 次版本号
    5-10 发行次数
    el8 企业linux8
    x86_64 适用64位系统
    .rpm 扩展名
    
  • 包的组成

    • 主包:bind-9.7.1-1.el5.i586.rpm
    • 子包:bind-libs-9.7.1-1.el5.i586.rpm bind-utils-9.7.1-1.el5.i586.rpm
  • 包名格式说明

    • major(主版本号):重大改进
    • minor(次版本号):某个子功能发生重大变化
    • release(发行号):修正了部分bug,调整了一点功能
  • 常见的arch

    • x86:i386,i486,i586,i686
    • x86_64:x64,x86_64,amd64
    • 跟平台无关:noarch
  • 包名格式

    • name-version-release-arch.rpm
      • bind-major.minor.release-release.arch.rpm

8. rpm包管理

  • 含义:rpm是Redhat Package Manager的简称,用于管理软件包。
  • 作用:rpm有一个强大的数据库/var/lib/rpm。
    rpm的管理工作包括软件的安装、卸载、升级、查询、校验、重建数据库、验证软件包来源合法性等等。
8.1 rpm包安装
  • 挂载光盘 ,查询软件安装的位置

  • [root@SYL2 ~]# mount /dev/cdrom /mnt/  挂载光盘
    mount: /mnt: WARNING: device write-protected, mounted read-only.
    [root@SYL2 ~]# df -h
    Filesystem           Size  Used Avail Use% Mounted on
    devtmpfs             874M     0  874M   0% /dev
    tmpfs                893M     0  893M   0% /dev/shm
    tmpfs                893M  8.7M  885M   1% /run
    tmpfs                893M     0  893M   0% /sys/fs/cgroup
    /dev/mapper/cs-root   17G  2.0G   16G  12% /
    /dev/sda1           1014M  210M  805M  21% /boot
    tmpfs                179M     0  179M   0% /run/user/0
    /dev/sr0              11G   11G     0 100% /mnt
    [root@SYL2 ~]# ls /mnt/
    AppStream  EFI      TRANS.TBL  isolinux
    BaseOS     LICENSE  images     media.repo
    [root@SYL2 ~]# ls /mnt/AppStream/
    Packages  repodata
    [root@SYL2 ~]# ls /mnt/BaseOS/
    Packages  repodata
    [root@SYL2 ~]# 
    
1.1 rpm -ivh +绝对路径
-i: 安装
-v: 显示详细信息
-h: 显示安装进度条
--test: 测试安装,但不真正执行安装过程
--nodeps: 忽略依赖关系
--force: 强行安装,可以实现重装或降级
--replacepkgs: 重新安装,替换原有安装
--oldpackage: 降级
--nodigest: 不检查包的完整性
--nosignature: 不检查包的来源合法性
--noscripts: 不执行程序包脚本片断
%pre:安装前脚本      --nopre
%post:安装后脚本     --nopost
%preun:卸载前脚本    --nopreun
%postun:卸载后脚本   --nopostun

1.测试安装

  • 下载绝对路径

  • [root@SYL2 ~]# curl -o zsh-5.5.1-9.el8.x86_64.rpm http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/zsh-5.5.1-9.el8.x86_64.rpm  //curl -o +包的名字+绝对路径
    [root@SYL2 ~]# ls
    007      abc              test.tar.gz
    1.1.txt  anaconda-ks.cfg  zsh-5.5.1-9.el8.x86_64.rpm
    7899     passwd
    a        sdv
    [root@SYL2 ~]# 
    
    
  • 测试安装

  • [root@SYL2 ~]# rpm -ivh --test zsh-5.5.1-9.el8.x86_64.rpm 
    Verifying...                          ################################# [100%]
    Preparing...                          ################################# [100%]
    [root@SYL2 ~]#
    

2.在网站上指定绝对路径上安装或者把绝对路径下载安装

  • 在绝对路径安装

  • [root@SYL2 ~]# rpm -ivh http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/zsh-5.5.1-9.el8.x86_64.rpm
    Retrieving http://mirror.centos.org/centos/8-stream/BaseOS/x86_64/os/Packages/zsh-5.5.1-9.el8.x86_64.rpm
    Verifying...                          ################################# [100%]
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:zsh-5.5.1-9.el8                  ################################# [100%]
    [root@SYL2 ~]# rpm -q zsh //查看安装
    zsh-5.5.1-9.el8.x86_64
    
    
  • 在绝对路径安装

  • [root@SYL2 ~]# rpm -ivh zsh-5.5.1-9.el8.x86_64.rpm 
    Verifying...                          ################################# [100%]
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:zsh-5.5.1-9.el8                  ################################# [100%]
    [root@SYL2 ~]# rpm -q zsh
    zsh-5.5.1-9.el8.x86_64
    [root@SYL2 ~]# 
    
    

3.在软件包的安装目录上可以不指定绝对路径

  • [root@SYL2 ~]# rpm -q zsh
    zsh-5.5.1-9.el8.x86_64
    [root@SYL2 ~]# rpm -e zsh  //卸载zsh
    [root@SYL2 ~]# rpm -ivh /mnt/BaseOS/Packages/zsh-5.5.1-6.el8_1.2.x86_64.rpm 
    Verifying...                          ################################# [100%]
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:zsh-5.5.1-6.el8_1.2              ################################# [100%]
    [root@SYL2 ~]# rpm -q zsh
    zsh-5.5.1-6.el8_1.2.x86_64
    [root@SYL2 ~]# 
    
  • 相对路径

  • [root@SYL2 ~]# cd /mnt/BaseOS/Packages/
    [root@SYL2 Packages]# rpm -ivh zsh-5.5.1-6.el8_1.2.x86_64.rpm 
    Verifying...                          ################################# [100%]
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:zsh-5.5.1-6.el8_1.2              ################################# [100%]
    [root@SYL2 Packages]# rpm -qa|grep zsh
    zsh-5.5.1-6.el8_1.2.x86_64
    [root@SYL2 Packages]# 
    

4.软件包存在强制安装 --force

  • [root@SYL2 ~]# rpm -q zsh
    zsh-5.5.1-6.el8_1.2.x86_64
    [root@SYL2 ~]# rpm -ivh --force zsh-5.5.1-9.el8.x86_64.rpm  //强制安装
    Verifying...                          ################################# [100%]
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:zsh-5.5.1-9.el8                  ################################# [100%]
    [root@SYL2 ~]# 
    

5.安装需要依赖其他组件, 使用 --nodeps 可重新强制安装

  • [root@SYL2 ~]# rpm -q wget
    package wget is not installed
    [root@SYL2 ~]# curl -o wget-1.19.5-10.el8.x86_64.rpm http://mirror.centos.org/centos/8-stream/AppStream/x86_64/os/Packages/wget-1.19.5-10.el8.x86_64.rpm
    [root@SYL2 ~]# ls
    007      abc              test.tar.gz
    1.1.txt  anaconda-ks.cfg  wget-1.19.5-10.el8.x86_64.rpm
    7899     passwd           zsh-5.5.1-9.el8.x86_64.rpm
    a        sdv
    [root@SYL2 ~]# rpm -ivh wget-1.19.5-10.el8.x86_64.rpm 
    error: Failed dependencies:
            libmetalink.so.3()(64bit) is needed by wget-1.19.5-10.el8.x86_64
    [root@SYL2 ~]# rpm -ivh --nodeps wget-1.19.5-10.el8.x86_64.rpm 
    Verifying...                          ################################# [100%]
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:wget-1.19.5-10.el8               ################################# [100%]
    [root@SYL2 ~]# rpm -q wget
    wget-1.19.5-10.el8.x86_64
    
    
1.2 重新安装
[root@SYL2 ~]# rpm -ivh /mnt/AppStream/Packages/vsftpd-3.0.3-35.el8.x86_64.rpm 
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:vsftpd-3.0.3-35.el8              ################################# [100%]
[root@SYL2 ~]# rpm -q vsftpd
vsftpd-3.0.3-35.el8.x86_64
[root@SYL2 ~]# 
[root@SYL2 ~]# rpm -ivh --replacepkgs /mnt/AppStream/Packages/vsftpd-3.0.3-35.el8.x86_64.rpm 
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:vsftpd-3.0.3-35.el8              ################################# [100%]
[root@SYL2 ~]# 

8.2 rpm包卸载
  • 先查询

  • [root@SYL2 ~]# rpm -qa|grep wget
    wget-1.19.5-10.el8.x86_64
    [root@SYL2 ~]# rpm -q zsh
    zsh-5.5.1-6.el8_1.2.x86_64
    
  • 在卸载

  • [root@SYL2 ~]# rpm -e wget
    [root@SYL2 ~]# rpm -e zsh
    [root@SYL2 ~]# rpm -q zsh
    package zsh is not installed
    [root@SYL2 ~]# rpm -qa|grep wget
    [root@SYL2 ~]# rpm -q wget
    package wget is not installed
    
8.3 rpm包升级
rpm -Uvh /PATH/TO/NEW_PACKAGE_FILE  //如果装有老版本的,则升级;否则,则安装
rpm -Fvh /PATH/TO/NEW_PACKAGE_FILE  //如果装有老版本的,则升级;否则,退出
  • 先下载旧新版本

  • [root@SYL2 ~]# ls
    007      abc              test.tar.gz
    1.1.txt  anaconda-ks.cfg  wget-1.14-18.el7_6.1.x86_64.rpm
    7899     passwd           wget-1.19.5-10.el8.x86_64.rpm
    a        sdv
    
    
  • 如果装有老版本的,则升级;否则,退出rpm -Fvh

  • [root@SYL2 ~]# rpm -ivh --nodeps wget-1.14-18.el7_6.1.x86_64.rpm 
    warning: wget-1.14-18.el7_6.1.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID f4a80eb5: NOKEY
    Verifying...                          ################################# [100%]
    Preparing...                          ################################# [100%]
    Updating / installing...
       1:wget-1.14-18.el7_6.1             ################################# [100%]
    [root@SYL2 ~]# 
    
  • 装有老版本的,则升级;否则,则安装 rpm -Uvh

  • [root@SYL2 ~]# rpm -Uvh wget-1.19.5-10.el8.x86_64.rpm 
    Verifying...                          ################################# [100%]
    Preparing...                          ################################# [100%]
            package wget-1.19.5-10.el8.x86_64 is already installed
    [root@SYL2 ~]# rpm -q wget
    wget-1.19.5-10.el8.x86_64
    [root@SYL2 ~]# 
    
8.4 rpm包查询
rpm -q PACKAGE_NAME                 //查询指定的包是否已安装
rpm -qa                             //查询已经安装的所有包
rpm -qi PACKAGE_NAME                //查询指定包的说明信息
rpm -ql PACKAGE_NAME                //查询指定软件包安装后生成的文件列表
rpm -qf /path/to/somefile           //查询指定的文件是由哪个rpm包安装生成的
rpm -qc PACKAGE_NAME                //查询指定包安装的配置文件
rpm -qd PACKAGE_NAME                //查询指定包安装的帮助文件
rpm -q --scripts PACKAGE_NAME       //查询指定包中包含的脚本
rpm -q --whatprovides CAPABILITY    //查询指定的CAPABILITY(能力)由哪个包所提供
    如:rpm -q --whatprovides /bin/cat
rpm -q --whatrequires CAPABILITY    //查询指定的CAPABILITY被哪个包所依赖
rpm -q --changelog COMMAND          //查询COMMAND的制作日志
rpm -q --scripts PACKAGE_NAME       //查询指定软件包包含的所有脚本文件
rpm -qR PACKAGE_NAME                //查询指定的软件包所依赖的CAPABILITY
rpm -q --provides PACKAGE_NAME      //列出指定软件包所提供的CAPABILITY

rpm -qpi /PATH/TO/PACKAGE_FILE      //查询指定未安装包的说明信息
rpm -qpl /PATH/TO/PACKAGE_FILE      //查询未安装的软件包会产生哪些文件
1.1 查询安装包是否安装 rpm -q/qa +包的名字
  • [root@SYL2 ~]# rpm -q wget
    wget-1.19.5-10.el8.x86_64
    [root@SYL2 ~]# rpm -qa|grep wget
    wget-1.19.5-10.el8.x86_64
    [root@SYL2 ~]# 
    
1.2 查看安装包详细信息 rpm -qi +包名
  • [root@SYL2 ~]# rpm -qi vsftpd
    Name        : vsftpd
    Version     : 3.0.3
    Release     : 35.el8
    Architecture: x86_64
    Install Date: Wed Apr  6 20:59:32 2022
    Group       : System Environment/Daemons
    Size        : 355682
    License     : GPLv2 with exceptions
    Signature   : RSA/SHA256, Fri Jan 28 00:22:30 2022, Key ID 05b555b38483c65d
    Source RPM  : vsftpd-3.0.3-35.el8.src.rpm
    Build Date  : Thu Jan 27 15:36:23 2022
    Build Host  : x86-01.mbox.centos.org
    Relocations : (not relocatable)
    Packager    : CentOS Buildsys <bugs@centos.org>
    Vendor      : CentOS
    URL         : https://security.appspot.com/vsftpd.html
    Summary     : Very Secure Ftp Daemon
    Description :
    vsftpd is a Very Secure FTP daemon. It was written completely from
    scratch.
    [root@SYL2 ~]# 
    
1.3 查询软件包安装后生成的文件列表 rpm -ql +包名
  • [root@SYL2 ~]# rpm -ql vsftpd
    /etc/logrotate.d/vsftpd
    /etc/pam.d/vsftpd
    /etc/vsftpd
    /etc/vsftpd/ftpusers
    /etc/vsftpd/user_list
    /etc/vsftpd/vsftpd.conf
    /etc/vsftpd/vsftpd_conf_migrate.sh
    /usr/lib/.build-id
    /usr/lib/.build-id/02
    /usr/lib/.build-id/02/5c89484d019f08e3818c960bc757b7e7b4127d
    /usr/lib/systemd/system-generators/vsftpd-generator
    /usr/lib/systemd/system/vsftpd.service
    /usr/lib/systemd/system/vsftpd.target
    /usr/lib/systemd/system/vsftpd@.service
    /usr/sbin/vsftpd
    /usr/share/doc/vsftpd
    /usr/share/doc/vsftpd/AUDIT
    /usr/share/doc/vsftpd/BENCHMARKS
    /usr/share/doc/vsftpd/BUGS
    /usr/share/doc/vsftpd/COPYING
    /usr/share/doc/vsftpd/Changelog
    /usr/share/doc/vsftpd/EXAMPLE
    /usr/share/doc/vsftpd/EXAMPLE/INTERNET_SITE
    /usr/share/doc/vsftpd/EXAMPLE/INTERNET_SITE/README
    /usr/share/doc/vsftpd/EXAMPLE/INTERNET_SITE/vsftpd.conf
    /usr/share/doc/vsftpd/EXAMPLE/INTERNET_SITE/vsftpd.xinetd
    /usr/share/doc/vsftpd/EXAMPLE/INTERNET_SITE_NOINETD
    /usr/share/doc/vsftpd/EXAMPLE/INTERNET_SITE_NOINETD/README
    /usr/share/doc/vsftpd/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf
    /usr/share/doc/vsftpd/EXAMPLE/PER_IP_CONFIG
    /usr/share/doc/vsftpd/EXAMPLE/PER_IP_CONFIG/README
    /usr/share/doc/vsftpd/EXAMPLE/PER_IP_CONFIG/hosts.allow
    /usr/share/doc/vsftpd/EXAMPLE/README
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_HOSTS
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_HOSTS/README
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_USERS
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_USERS/README
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_USERS/logins.txt
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_USERS/vsftpd.conf
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_USERS/vsftpd.pam
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_USERS_2
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_USERS_2/README
    /usr/share/doc/vsftpd/FAQ
    /usr/share/doc/vsftpd/INSTALL
    /usr/share/doc/vsftpd/LICENSE
    /usr/share/doc/vsftpd/README
    /usr/share/doc/vsftpd/README.security
    /usr/share/doc/vsftpd/REWARD
    /usr/share/doc/vsftpd/SECURITY
    /usr/share/doc/vsftpd/SECURITY/DESIGN
    /usr/share/doc/vsftpd/SECURITY/IMPLEMENTATION
    /usr/share/doc/vsftpd/SECURITY/OVERVIEW
    /usr/share/doc/vsftpd/SECURITY/TRUST
    /usr/share/doc/vsftpd/SIZE
    /usr/share/doc/vsftpd/SPEED
    /usr/share/doc/vsftpd/TODO
    /usr/share/doc/vsftpd/TUNING
    /usr/share/doc/vsftpd/vsftpd.xinetd
    /usr/share/man/man5/vsftpd.conf.5.gz
    /usr/share/man/man8/vsftpd.8.gz
    /var/ftp
    /var/ftp/pub
    [root@SYL2 ~]# 
    
1.4 查询指定的文件是由哪个rpm包安装生成的 rpm -qf +文件路径 = rpm -q --whatprovides +包路径
  • [root@SYL2 ~]# which ls
    alias ls='ls --color=auto'
            /usr/bin/ls
    [root@SYL2 ~]# rpm -qf /usr/bin/ls
    coreutils-8.30-12.el8.x86_64
    [root@SYL2 ~]# rpm -qf /etc/passwd
    setup-2.12.2-6.el8.noarch
    [root@SYL2 ~]# rpm -q --whatprovides /usr/bin/ls
    coreutils-8.30-12.el8.x86_64
    [root@SYL2 ~]# 
    
1.5 查询指定包安装的配置文件 rpm -qc +包名
  • [root@SYL2 ~]# rpm -qc vsftpd
    /etc/logrotate.d/vsftpd
    /etc/pam.d/vsftpd
    /etc/vsftpd/ftpusers
    /etc/vsftpd/user_list
    /etc/vsftpd/vsftpd.conf
    
1.6 查询指定包安装的帮助文件 rpm -qd +包名
  • [root@SYL2 ~]# rpm -qd vsftpd
    /usr/share/doc/vsftpd/AUDIT
    /usr/share/doc/vsftpd/BENCHMARKS
    /usr/share/doc/vsftpd/BUGS
    /usr/share/doc/vsftpd/COPYING
    /usr/share/doc/vsftpd/Changelog
    /usr/share/doc/vsftpd/EXAMPLE/INTERNET_SITE/README
    /usr/share/doc/vsftpd/EXAMPLE/INTERNET_SITE/vsftpd.conf
    /usr/share/doc/vsftpd/EXAMPLE/INTERNET_SITE/vsftpd.xinetd
    /usr/share/doc/vsftpd/EXAMPLE/INTERNET_SITE_NOINETD/README
    /usr/share/doc/vsftpd/EXAMPLE/INTERNET_SITE_NOINETD/vsftpd.conf
    /usr/share/doc/vsftpd/EXAMPLE/PER_IP_CONFIG/README
    /usr/share/doc/vsftpd/EXAMPLE/PER_IP_CONFIG/hosts.allow
    /usr/share/doc/vsftpd/EXAMPLE/README
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_HOSTS/README
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_USERS/README
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_USERS/logins.txt
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_USERS/vsftpd.conf
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_USERS/vsftpd.pam
    /usr/share/doc/vsftpd/EXAMPLE/VIRTUAL_USERS_2/README
    /usr/share/doc/vsftpd/FAQ
    /usr/share/doc/vsftpd/INSTALL
    /usr/share/doc/vsftpd/LICENSE
    /usr/share/doc/vsftpd/README
    /usr/share/doc/vsftpd/README.security
    /usr/share/doc/vsftpd/REWARD
    /usr/share/doc/vsftpd/SECURITY/DESIGN
    /usr/share/doc/vsftpd/SECURITY/IMPLEMENTATION
    /usr/share/doc/vsftpd/SECURITY/OVERVIEW
    /usr/share/doc/vsftpd/SECURITY/TRUST
    /usr/share/doc/vsftpd/SIZE
    /usr/share/doc/vsftpd/SPEED
    /usr/share/doc/vsftpd/TODO
    /usr/share/doc/vsftpd/TUNING
    /usr/share/doc/vsftpd/vsftpd.xinetd
    /usr/share/man/man5/vsftpd.conf.5.gz
    /usr/share/man/man8/vsftpd.8.gz
    
1.7 查询COMMAND的制作日志 rpm -q --changelog +包名
  • [root@SYL2 ~]# rpm -q --changelog vsftpd|head
    * Fri Dec 03 2021 Artem Egorenkov <aegorenk@redhat.com> - 3.0.3-35
    - add option to disable TLSv1.3
    - Resolves: rhbz#1638375
    
    * Mon Apr 12 2021 Artem Egorenkov <aegorenk@redhat.com> - 3.0.3-34
    - Enable support for wide-character strings in logs
    - Replace unprintables with HEX code, not question marks
    - Resolves: rhbz#1947900
    
    * Mon Nov 02 2020 Artem Egorenkov <aegorenk@redhat.com> - 3.0.3-33
    [root@SYL2 ~]# 
    
1.8 查询指定软件包包含的所有脚本文件 – rpm -q --scripts +包名
  • [root@SYL2 ~]# rpm -q --scripts vsftpd
    postinstall scriptlet (using /bin/sh):
    
    if [ $1 -eq 1 ] ; then 
            # Initial installation 
            systemctl --no-reload preset vsftpd.service &>/dev/null || : 
    fi
    preuninstall scriptlet (using /bin/sh):
    
    if [ $1 -eq 0 ] ; then 
            # Package removal, not upgrade 
            systemctl --no-reload disable --now vsftpd.service &>/dev/null || : 
    fi 
    
    
    if [ $1 -eq 0 ] ; then 
            # Package removal, not upgrade 
            systemctl --no-reload disable --now vsftpd.target &>/dev/null || : 
    fi
    postuninstall scriptlet (using /bin/sh):
    
    if [ $1 -ge 1 ] ; then 
            # Package upgrade, not uninstall 
            systemctl try-restart vsftpd.service &>/dev/null || : 
    fi
    [root@SYL2 ~]# 
    
1.9 列出指定软件包所提供的功能 —rpm -q --provides +包名
  • [root@SYL2 ~]# rpm -q --provides coreutils
    /bin/basename
    /bin/cat
    /bin/chgrp
    /bin/chmod
    /bin/chown
    /bin/cp
    /bin/cut
    /bin/date
    /bin/dd
    /bin/df
    /bin/echo
    /bin/env
    /bin/false
    /bin/ln
    /bin/ls
    /bin/mkdir
    /bin/mknod
    /bin/mktemp
    /bin/mv
    /bin/nice
    /bin/pwd
    /bin/readlink
    /bin/rm
    /bin/rmdir
    /bin/sleep
    /bin/sort
    /bin/stty
    /bin/sync
    /bin/touch
    /bin/true
    /bin/uname
    bundled(gnulib)
    coreutils = 8.30-12.el8
    coreutils(x86-64) = 8.30-12.el8
    coreutils-full = 8.30-12.el8
    fileutils = 8.30-12.el8
    libstdbuf.so()(64bit)
    mktemp = 4:8.30-12.el8
    sh-utils = 8.30-12.el8
    stat = 8.30-12.el8
    textutils = 8.30-12.el8
    [root@SYL2 ~]# 
    
2.0 查询指定未安装包的说明信息 rpm -qpi +绝对路径
  • [root@SYL2 ~]# rpm -qpi /mnt/BaseOS/Packages/zsh-5.5.1-6.el8_1.2.x86_64.rpm 
    Name        : zsh
    Version     : 5.5.1
    Release     : 6.el8_1.2
    Architecture: x86_64
    Install Date: (not installed)
    Group       : Unspecified
    Size        : 7546254
    License     : MIT
    Signature   : RSA/SHA256, Sat Mar 21 09:07:41 2020, Key ID 05b555b38483c65d
    Source RPM  : zsh-5.5.1-6.el8_1.2.src.rpm
    Build Date  : Sat Mar 21 02:38:18 2020
    Build Host  : x86-01.mbox.centos.org
    Relocations : (not relocatable)
    Packager    : CentOS Buildsys <bugs@centos.org>
    Vendor      : CentOS
    URL         : http://zsh.sourceforge.net/
    Summary     : Powerful interactive shell
    Description :
    The zsh shell is a command interpreter usable as an interactive login
    shell and as a shell script command processor.  Zsh resembles the ksh
    shell (the Korn shell), but includes many enhancements.  Zsh supports
    command line editing, built-in spelling correction, programmable
    command completion, shell functions (with autoloading), a history
    mechanism, and more.
    [root@SYL2 ~]# 
    
2.1 查询未安装的软件包会产生哪些文件 rpm -qpl +绝对路径
  • [root@SYL2 ~]# rpm -qpl /mnt/BaseOS/Packages/zsh-5.5.1-6.el8_1.2.x86_64.rpm 
    
9. 挂载光盘和卸载光盘
  • 挂载

  • [root@SYL2 ~]# mount /dev/cdrom /mnt/
    mount: /mnt: WARNING: device write-protected, mounted read-only.
    [root@SYL2 ~]# df -h 
    Filesystem           Size  Used Avail Use% Mounted on
    devtmpfs             874M     0  874M   0% /dev
    tmpfs                893M     0  893M   0% /dev/shm
    tmpfs                893M  8.7M  885M   1% /run
    tmpfs                893M     0  893M   0% /sys/fs/cgroup
    /dev/mapper/cs-root   17G  1.8G   16G  11% /
    /dev/sda1           1014M  210M  805M  21% /boot
    tmpfs                179M     0  179M   0% /run/user/0
    /dev/sr0              11G   11G     0 100% /mnt
    [root@SYL2 ~]# 
    
  • 卸载

  • [root@SYL2 ~]# umount /mnt/
    [root@SYL2 ~]# df -h 
    Filesystem           Size  Used Avail Use% Mounted on
    devtmpfs             874M     0  874M   0% /dev
    tmpfs                893M     0  893M   0% /dev/shm
    tmpfs                893M  8.7M  885M   1% /run
    tmpfs                893M     0  893M   0% /sys/fs/cgroup
    /dev/mapper/cs-root   17G  1.8G   16G  11% /
    /dev/sda1           1014M  210M  805M  21% /boot
    tmpfs                179M     0  179M   0% /run/user/0
    [root@SYL2 ~]#
    
10.rpm的弊端

用rpm安装软件时,若遇到有依赖关系的软件,必须先安装依赖的软件才能继续安装我们要安装的软件,当依赖关系很复杂的情况下,则安装较为头疼

11.yum的优劣势

1.优势:能够解决rpm的依赖问题,yum能够自动解决软件安装时的依赖关系。

2.劣势:yum的缺陷就是如果在未完成安装的情况下强行中止安装过程,下次再安装时将无法解决依赖关系

12.yum的含义与作用

1.含义:yum是yellowdog update manager的简称,yellowdog更新管理器

2.作用:能够实现rpm管理的所有操作,并能够自动解决各rpm包之间的依赖关系。yum是rpm的前端工具,是基于rpm来实现软件的管理的一个工具,用yum来管理redhat系列的rpm包

  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值