一、作业(练习)内容:

1、总结rpm和yum实现程序包的管理功能.

要求:作业要图文并茂

基于rpm命令实现程序包管理:
        安装:
            rpm {-i|--install} [install-options] PACKAGE_FILE ...
                -i:
                    -v:显示详细过程,-vv, -vvv
                    -h:

                    每个rpm包都提供一个或多个capabilities

                --nodeps:忽略依赖关系安装
                --replacepkgs:重装程序包

原创 标记: 操作系统

       升级:
            rpm {-U|--upgrade} [install-options] PACKAGE_FILE ...
               rpm {-F|--freshen} [install-options] PACKAGE_FILE ...   

                   -Uvh: 如果有旧版程序包,则升级之;如果没有,则安装之;
                   -Fvh: 如果有旧版程序包,则升级之;如果没有,则不安装;

                   --nodeps
                   --oldpackage:降级;
                   --force:

rpm –ivh 命令示例

           image

           image


           卸载:
               rpm {-e|--erase} [--nodeps] [--noscripts] [--notriggers] [--test] PACKAGE_NAME ...   

image


           查询:
               rpm {-q|--query} [select-options] [query-options]

               查询选项:
                   -qa: 查询本机已经安装的所有程序包;
                   -qf /PATH/TO/SOMEFILE: 查询此处的文件由哪个程序包安装生成;

                   -qc: 查询指定程序包安装生成的配置文件
                   -qd: 查询指定的程序包安装生成的文档
                   -qi: 查询指定的程序包的相关信息;
                   -ql: 查询程序包安装生成的所有文件的列表;
                   -q --scripts:查询程序包相关的脚本:
                       preinstall: 安装前脚本
                       postinstall:安装后脚本
                       preuninstall: 卸载前脚本
                       postuninstall: 卸载后脚本

                   -p: 查询针对是未安装的程序包文件;

rpm 查询相关命令示例

image


           校验:
               rpm {-V|--verify} [select-options] [verify-options]
                S file Size differs
               M Mode differs (includes permissions and file type)
               5 digest (formerly MD5 sum) differs
               D Device major/minor number mismatch
               L readLink(2) path mismatch
               U User ownership differs
               G Group ownership differs
               T mTime differs
               P caPabilities differ

    包校验:
        来源合法性验正:非对称加密
        完整性验正:单向加密

        导入密钥:rpm --import /PATH/TO/KEY_FILE
        校验:rpm -K /PATH/TO/RPM_FILE

rpm 校验命令示例

image

yum命令:
        yum [options] [command] [package ...]

            命令:
                安装:install
                卸载:remove
                升级:update
                查询:
                    info
                    search KEYWORD
                    list all|installed|availiable
                    provides /PATH/TO/SOMEFILE: 查询指定文件由哪个包安装生成
                重新安装:reinstall
                降级:downgrade
                清理缓存:clean [ packages | metadata | expire-cache | rpmdb | plugins | all ]
                生动生成缓存:makecache

yum install 命令示例

image

image

yum update 命令示例

image

yum remove 命令示例

image


                包组:
                    grouplist
                    groupinfo "GRP_NAME"
                    groupinstall "GRP_NAME"
                    groupremove "GRP_NAME"

                仓库:
                    repolist [all|enabled|disabled]
                    repoinfo [all|enabled|disabled]

    如何使用光盘当做本地仓库:
        挂载光盘至某目录
        定义仓库,使用file:///指明其访问路径;

    创建本地仓库:
        yum install createrepo

        createrepo /PATH/TO/RPMFILES/

image

image

yum groupinstall 命令示例

image