云计算--day07

陈鑫


光盘(相当于U盘,存储设备)连接当前主机

[root@localhost ~]# ll   /dev/sr0
brw-rw----+ 1 root cdrom 11, 0 Dec  7 23:24 /dev/sr0

光盘设备名称(块设备)(/dev/sr0) s-设备类型SATA  (/dev/sr0 这个设备文件并不是直接连接光盘设备,他只是把设备识别成了一个设备的访问入口 ,也就是是设备的驱动程序文件。后期要想加载该设备下的数据内容,要将设备挂载到系统的某一个挂载点目录

匹配光盘:

cdrom 也是光盘的意思,默认的是软链接文件

[root@localhost ~]# ll   /dev/cdrom
lrwxrwxrwx. 1 root root 3 Dec  7 23:24 /dev/cdrom -> sr0

两个挂载点目录:

[root@localhost ~]# FHS   /media                     /mnt
                          永久连接的挂载点目录        临时连接的挂载点目录


[root@localhost ~]# ll  /

rwxr-xr-x.   2 root root    6 Jun 21  2021 media
drwxr-xr-x.   5 root root   45 Nov 26 06:55 mnt

注:①在查看软件包时 或切换软件包下路径时,需要先将设备与挂载点目录下的一个挂载点先挂载

       ②例 zsh-html  是个软件名就在家目录下,与zsh-5.5.1-6.el8_1.2.src.rpm软件包名不同,他只能在对应的挂载点目录下的软件包路径下查看



一 .设备与挂载点目录挂载


1.获取本地软件包

如何将一个设备和挂载点目录挂载

#mount       /dev/sr0                 /mnt                  临时生效,重启后需要再次挂载

  挂载    文件系统名称    挂载点目录

umount    文件系统名或挂载点目录

#umount           /mnt            临时取消挂载

命令演示

#mount

[root@localhost ~]# mount   查看当前目录所有的挂载点信息
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=887108k,nr_inodes=221777,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)

光盘设备

系统上的挂载点

/dev/sr0 on /run/media/redhat/RHEL-8-5-0-BaseOS-x86_64 

[root@localhost ~]# cd  /run/media/redhat/RHEL-8-5-0-BaseOS-x86_64
[root@localhost RHEL-8-5-0-BaseOS-x86_64]# ll          光盘设备下所有文件
total 48
dr-xr-xr-x. 4 redhat redhat  2048 Oct 13  2021 AppStream
dr-xr-xr-x. 4 redhat redhat  2048 Oct 13  2021 BaseOS
dr-xr-xr-x. 3 redhat redhat  2048 Oct 13  2021 EFI
-r--r--r--. 1 redhat redhat  8154 Oct 13  2021 EULA
-r--r--r--. 1 redhat redhat  1455 Oct 13  2021 extra_files.json
-r--r--r--. 1 redhat redhat 18092 Oct 13  2021 GPL
dr-xr-xr-x. 3 redhat redhat  2048 Oct 13  2021 images
dr-xr-xr-x. 2 redhat redhat  2048 Oct 13  2021 isolinux
-r--r--r--. 1 redhat redhat   103 Oct 13  2021 media.repo
-r--r--r--. 1 redhat redhat  1669 Oct 13  2021 RPM-GPG-KEY-redhat-beta
-r--r--r--. 1 redhat redhat  5135 Oct 13  2021 RPM-GPG-KEY-redhat-release
-r--r--r--. 1 redhat redhat  1796 Oct 13  2021 TRANS.TBL

用户自己将光盘设备移动到一个挂载点目录  (更方便)

将一个设备和挂载点目录挂载

[root@localhost ~]# mount  /dev/sr0  /mnt   (后期加载光盘只需要到/mnt下)
mount: /mnt: /dev/sr0 already mounted on /run/media/redhat/RHEL-8-5-0-BaseOS-x86_64.
[root@localhost ~]# mount 
/dev/sr0 on /run/media/redhat/RHEL-8-5-0-BaseOS-x86_64 type iso9660 (ro,nosuid,nodev,relatime,nojoliet,check=s,map=n,b
/dev/sr0 on /mnt type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=1000,gid=1000,dmode=500,fmode=400)
[root@localhost ~]# ll  /mnt
total 48
dr-xr-xr-x. 4 redhat redhat  2048 Oct 13  2021 AppStream   (这两个目录记录了当前主机上可以安
dr-xr-xr-x. 4 redhat redhat  2048 Oct 13  2021 BaseOS          装的软件包)
dr-xr-xr-x. 3 redhat redhat  2048 Oct 13  2021 EFI
-r--r--r--. 1 redhat redhat  8154 Oct 13  2021 EULA
-r--r--r--. 1 redhat redhat  1455 Oct 13  2021 extra_files.json
-r--r--r--. 1 redhat redhat 18092 Oct 13  2021 GPL
dr-xr-xr-x. 3 redhat redhat  2048 Oct 13  2021 images
dr-xr-xr-x. 2 redhat redhat  2048 Oct 13  2021 isolinux
-r--r--r--. 1 redhat redhat   103 Oct 13  2021 media.repo
-r--r--r--. 1 redhat redhat  1669 Oct 13  2021 RPM-GPG-KEY-redhat-beta
-r--r--r--. 1 redhat redhat  5135 Oct 13  2021 RPM-GPG-KEY-redhat-release
-r--r--r--. 1 redhat redhat  1796 Oct 13  2021 TRANS.TBL

AppStream     BaseOS 


[root@localhost ~]# cd   /mnt/AppStream
[root@localhost AppStream]# ll
total 1156
dr-xr-xr-x. 2 redhat redhat 1179648 Oct 13  2021 Packages   (软件包都在里面)
dr-xr-xr-x. 2 redhat redhat    4096 Oct 13  2021 repodata
[root@localhost AppStream]# cd  Packages        (记录的是软件包之间的依赖关系)
[root@localhost Packages]# ll
-r--r--r--. 1996 redhat redhat    532104 Mar  3  2020 zsh-html-5.5.1-6.el8_1.2.noarch.rpm
-r--r--r--.  399 redhat redhat    402752 Jun  8  2020 zstd-1.4.4-1.el8.x86_64.rpm
-r--r--r--.  154 redhat redhat     95368 Aug  3  2021 zziplib-0.13.68-9.el8.i686.rpm
-r--r--r--.  154 redhat redhat     93100 Aug  3  2021 zziplib-0.13.68-9.el8.x86_64.rpm
-r--r--r--.  154 redhat redhat     48684 Aug  3  2021 zziplib-utils-0.13.68-9.el8.x86_64.rpm     

在Packages 里有linux红毛系统中所有可以安装的软件包
开发的软件包文件默认格式都是.rpm 

取消挂载

[root@localhost Packages]# umount  /mnt  在挂载点目录不能取消 
umount: /mnt: target is busy.
[root@localhost Packages]# cd
[root@localhost ~]# umount  /mnt         

如何查看是否挂载成功

[root@localhost ~]# umount  /mnt
[root@localhost ~]# mount  |  grep  /mnt
[root@localhost ~]# mount  /dev/sr0  /mnt
mount: /mnt: WARNING: device write-protected, mounted read-only.
             警告     但命令是成功的
[root@localhost ~]# mount  |  grep  /mnt
/dev/sr0 on /mnt type iso9660 (ro,relatime,nojoliet,check=s,map=n,blocksize=2048,uid=1000,gid=1000,dmode=500,fmode=400)

eg:

当前目录下有多少个软件包

[root@localhost Packages]# pwd      pwd  --查看当前所在的具体路径
/mnt/AppStream/Packages           
[root@localhost Packages]# ll  |wc   -l
6222                                         

6222-1=6221(总量那一行不算)
[root@localhost Packages]# cd  /mnt/BaseOS/Packages
[root@localhost Packages]# pwd
/mnt/BaseOS/Packages
[root@localhost Packages]# ll
-r--r--r--.  233 redhat redhat     74200 Sep 16  2021 yum-utils-4.0.21-3.el8.noarch.rpm
-r--r--r--.  849 redhat redhat    276820 Dec 15  2018 zip-3.0-23.el8.x86_64.rpm
-r--r--r--.  303 redhat redhat    107380 Oct 27  2020 zlib-1.2.11-17.el8.i686.rpm
-r--r--r--.  323 redhat redhat    104736 Oct 27  2020 zlib-1.2.11-17.el8.x86_64.rpm
-r--r--r--.  303 redhat redhat     58948 Oct 27  2020 zlib-devel-1.2.11-17.el8.i686.rpm
-r--r--r--.  323 redhat redhat     58924 Oct 27  2020 zlib-devel-1.2.11-17.el8.x86_64.rpm
-r--r--r--.  507 redhat redhat   3039316 Mar  3  2020 zsh-5.5.1-6.el8_1.2.x86_64.rpm

[root@localhost Packages]# ll  |  wc   -l
1710

1710-1=1709

安装的软件包都在这两个路径下

[root@localhost Packages]# pwd      pwd  --查看当前所在的具体路径
/mnt/AppStream/Packages       

[root@localhost Packages]# pwd
/mnt/BaseOS/Packages


(AppStream非红帽官方开发的软件程序)(第三方提供的软件包)
(BaseOS红帽官方开发的软件程序)

BaseOS 中的软件包主要是用于提供操作系统底层功能,数量不多;
AppStream 中则包含了大量的第三方应用软件包。


二.安装软件包


1.  rpm    软件管理工具(命令)

     rpm    -ivh     软件包名               安装软件包   [i--安装   v--详细信息   h hash--缓存(可以看见软件包的安装进程)]

               -evh    软件名                   卸载对应的软件  (可以查看软件的详细卸载进程)

                -q       软件名                   查询已经安装软件(查询对应的软件是否安装)

                -qa                                  查询已经安装的所有软件

                 -ql      软件名                  查看指定软件程序的文件列表信息

                -qf     文件绝对路径         查询某一个文件时由哪一个包提供

                -Uvh   软件名                  (U-update)  更新软件显示详细的进程信息

                -qpi     软件包名               查看软件包的详细信息

eg:

①软件包的详细介绍   (版本号)

[root@localhost Packages]# umount  /mnt
umount: /mnt: target is busy.
[root@localhost Packages]# cd
[root@localhost ~]# umount  /mnt

[root@localhost ~]# cd  /mnt/AppStream/Packages/
-bash: cd: /mnt/AppStream/Packages/: No such file or directory

[root@localhost ~]# mount  /dev/sr0  /mnt
mount: /mnt: WARNING: device write-protected, mounted read-only.
[root@localhost ~]# cd  /mnt/AppStream/Packages/
[root@localhost Packages]# ll  
.....
-r--r--r--.  154 redhat redhat     48684 Aug  3  2021 zziplib-utils-0.13.68-9.el8.x86_64.rpm                               (版本号前面的字符信息  版本号
                                                软件包装好的软件名称)
                                            注:有些软件包和软件名是没有关系的
                                  所以可以通过命令rpm  -qpi   软件包名  (查看软件包的详细信息)


版本号:  0.13.68-9.el8.x86_64.rpm   
        主版本.子版本.修订版本次数
           0  .   13  .  68
     若程序发生重大变换主版本会加一,如果变换过小 ,则主版本不变子版本加一
     修订版本次数:修改bug次数  (该程序在发布之前一共修改了多少次)
注:bug不一定是错误,不符合用户逻辑也算
如果bug修改次数过多的,直接将修订版本次数赋值为0,子版本加一
el:企业linux
el8:企业linux 8 这个版本
注:后期在互联网上安装软件包的时候 标记的是el6、7不一定可以在当前8上面安装的
    主机的架构是x86_64  ,那么软件包的架构也要是x86_64


总结:在互联网上下载的软件包的相关版本信息要和主机的相关版本信息相一致









② 安装对应的软件包

[root@localhost ~]# cd  /mnt/AppStream/Packages

[root@localhost Packages]# rpm  -ivh  zsh-html-5.5.1-6.el8_1.2.noarch.rpm
warning: zsh-html-5.5.1-6.el8_1.2.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...                  (h  缓存  进度显示  )
   1:zsh-html-5.5.1-6.el8_1.2         ################################# [100%]



若没有切换到对应的路径,就必须写绝对路径
[root@localhost Packages]# rpm  -ivh   /mnt/AppStream/Packages/zsh-html-5.5.1-6.el8_1.2.noarch.rpm

③查看软件是否安装成功

法一:

[root@localhost Packages]# rpm  -q  zsh-html  (软件名)
zsh-html-5.5.1-6.el8_1.2.noarch


[root@localhost ~]# rpm  -q  zsh-html
zsh-html-5.5.1-6.el8_1.2.noarch

[root@localhost ~]# rpm  -q  tar
tar-1.30-5.el8.x86_64             (tar命令其实也是系统安装的一个软件)


[root@localhost ~]# rpm  -q  httpd
package httpd is not installed         (查找的这个软件程序没有安装好)

法二:

[root@localhost ~]# rpm  -qa  | grep  zsh-html
zsh-html-5.5.1-6.el8_1.2.noarch

④查看一共安装了多少个软件

[root@localhost ~]# rpm  -qa  |  wc  -l
1369

⑤卸载软件

[root@localhost ~]# rpm  -evh  zsh-html
Preparing...                          ################################# [100%]
Cleaning up / removing...
   1:zsh-html-5.5.1-6.el8_1.2         ################################# [100%]

[root@localhost ~]# rpm  -q  zsh-html
package zsh-html is not installed

⑥查看一个软件包的详细信息

[root@localhost Packages]# rpm  -qpi  zsh-html-5.5.1-6.el8_1.2.noarch.rpm
warning: zsh-html-5.5.1-6.el8_1.2.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Name        : zsh-html
Version     : 5.5.1                                      版本
Release     : 6.el8_1.2
Architecture: noarch
Install Date: (not installed)
Group       : Unspecified
Size        : 3343388                                    大小(默认最小单位byte)
License     : MIT
Signature   : RSA/SHA256, Tue 03 Mar 2020 09:26:42 PM CST, Key ID 199e2f91fd431d51
Source RPM  : zsh-5.5.1-6.el8_1.2.src.rpm
Build Date  : Tue 03 Mar 2020 09:07:42 PM CST            开发时间
Build Host  : arm64-038.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : http://zsh.sourceforge.net/                对应的详细信息
Summary     : Zsh shell manual in html format
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.

This package contains the Zsh manual in html format.

⑦-ql      软件名                  查看指定软件程序的文件列表信息

[root@localhost Packages]# rpm  -ql  tar
/usr/bin/gtar                         (bin  可以用到的命令)
/usr/bin/tar
/usr/lib/.build-id                    (lib  该程序相关的库文件    )   
/usr/lib/.build-id/9b
/usr/lib/.build-id/9b/25e81ba8d838de94d97e4ade418726d8f8d739
/usr/share/doc/tar                     (share   共享文档   doc   文本)
/usr/share/doc/tar/AUTHORS
/usr/share/doc/tar/ChangeLog
/usr/share/doc/tar/NEWS
/usr/share/doc/tar/README (对软件工具的解释说明)
/usr/share/doc/tar/THANKS
/usr/share/info/tar.info-1.gz
/usr/share/info/tar.info-2.gz
/usr/share/info/tar.info.gz
/usr/share/licenses/tar
/usr/share/licenses/tar/COPYING
/usr/share/locale/bg/LC_MESSAGES/tar.mo    (共享的一些本地信息)
/usr/share/locale/ca/LC_MESSAGES/tar.mo
/usr/share/locale/cs/LC_MESSAGES/tar.mo
.........
/usr/share/man/man1/gtar.1.gz
/usr/share/man/man1/tar.1.gz              (帮助)
                                 注:并不是所有的命令都有man手册,而是系统上所装的程序提供了man手 
                                    册,才能通过man手册做出一个查看

⑧  -qf     文件绝对路径         查询某一个文件时由哪一个包提供

[root@localhost Packages]# which  vim
/usr/bin/vim          查看vim ,这个命令(软件程序)的绝对路径
[root@localhost Packages]# rpm  -qf  /usr/bin/vim
vim-enhanced-8.0.1763-16.el8.x86_64       提供vim的软件包
  vim的扩展程序包

⑨安装软件时的依赖关系如何解决

[root@localhost Packages]# rpm  -ivh  yp-tools-4.2.3-1.el8.x86_64.rpm
warning: yp-tools-4.2.3-1.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
	ypbind >= 3:2.4-2 is needed by yp-tools-4.2.3-1.el8.x86_64
   (ypbind和yp-tools 必须同时安装或同时卸载)

[root@localhost Packages]# rpm  -ivh  yp-tools-4.2.3-1.el8.x86_64.rpm   ypbind-2.5-2.el8.x86_64.rpm 
warning: yp-tools-4.2.3-1.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
error: Failed dependencies:
	nss_nis is needed by ypbind-3:2.5-2.el8.x86_64  (yphind 和nss_nis 又必须同时安装或同时卸载)

注:有依赖关系的包还要先判断在哪一条路径下
[root@localhost Packages]# rpm  -ivh  yp-tools-4.2.3-1.el8.x86_64.rpm   ypbind-2.5-2.el8.x86_64.rpm   /mnt/BaseOS/Packages/nss_nis-3.0-8.el8.x86_64.rpm
warning: yp-tools-4.2.3-1.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Verifying...                          ################################# [100%]
Preparing...                          ################################# [100%]
Updating / installing...
   1:nss_nis-3.0-8.el8                ################################# [ 33%]
   2:ypbind-3:2.5-2.el8               ################################# [ 67%]
   3:yp-tools-4.2.3-1.el8             ################################# [100%]

注:有依赖关系的软件包还要先判断在哪一条路径下

卸载时一样

[root@localhost Packages]# rpm -evh  yp-tools
error: Failed dependencies:
	yp-tools >= 4.2.2-2 is needed by (installed) ypbind-3:2.5-2.el8.x86_64
[root@localhost Packages]# rpm -evh  yp-tools  ypbind  
Preparing...                          ################################# [100%]
Cleaning up / removing...
   1:yp-tools-4.2.3-1.el8             ################################# [ 50%]
   2:ypbind-3:2.5-2.el8               ################################# [100%]
[root@localhost Packages]# rpm -evh  nss_nis
Preparing...                          ################################# [100%]
Cleaning up / removing...
   1:nss_nis-3.0-8.el8                ################################# [100%]
  

或
[root@localhost Packages]# rpm -evh  yp-tools  ypbind   nss_nis
Preparing...                          ################################# [100%]
Cleaning up / removing...
   1:yp-tools-4.2.3-1.el8             ################################# [ 33%]
   2:ypbind-3:2.5-2.el8               ################################# [ 67%]
   3:nss_nis-3.0-8.el8                ################################# [100%]


练习:

在linux主机中安装zsh-html-5.5.1-6.el8_1.2.noarch.rpm软件包    (安装软件包只需要挂载一次  , 重启后需要再次挂载)

#mount    /dev/sr0   /mnt

#rpm  -ivh    /mnt/AppStream/Packages/zsh-html-5.5.1-6.el8_1.2.noarch.rpm

查看tree工具文件列表;

#rpm     -ql  tree

卸载tar工具;

#rpm     -evh      tar

[root@localhost ~]# rpm  -evh  tar         有错误      程序间(软件包)有依赖关系,指定多个有依赖关系
error: Failed dependencies:                                                 的程序同时卸载
    tar is needed by (installed) open-vm-tools-11.2.5-2.el8.x86_64
    tar is needed by (installed) insights-client-0:3.1.5-1.el8.noarch
    /usr/bin/tar is needed by (installed) file-roller-3.28.1-4.el8.x86_64

[root@www ~]# tar -evh tree 
tar: invalid option -- 'e'
Try 'tar --help' or 'tar --usage' for more information.
[root@www ~]# rpm  -evh tree 
Preparing...                          ################################# [100%]
Cleaning up / removing...
   1:tree-1.7.0-15.el8                ################################# [100%]

查看ssh工具的别名  (查询ssh文件时由哪一个包提供)

[root@localhost ~]# which   ssh
/usr/bin/ssh
[root@localhost ~]# rpm  -qf  /usr/bin/ssh
openssh-clients-8.0p1-10.el8.x86_64
 


2.另一种安装方法:    (与rmp相比可以解决繁琐的依赖关系)

注: yum/dnf安装时还会安装有依赖关系的软件包  ,卸载时也会卸载有依赖关系的软件包

dnf就是yum的扩展工具,两者都是一样的,没有任何区别

dnf/yum  (仓库管理)   仓库源--Base0S、AppStream     可以   (linux8)/(linux7)                                              解决依赖关系

安装的软件包的路径:

[root@localhost Packages]# pwd      pwd  --查看当前所在的具体路径
/mnt/AppStream/Packages       

[root@localhost Packages]# pwd
/mnt/BaseOS/Packages

注:优点:软件包管理时基于仓库形式管理-----安装的软件包的路径:AppStream .BaseOS ,将这两个路径统一放到仓库之中,就不用纠结软件包在AppStream ,还是在BaseOS之中。直接在仓库查找


第一步:创建仓库

提:默认的路径之下有一个仓库文件  

redhat.repo   默认就有 的红帽仓库文件  但是这个仓库文 件没有任何内容 仓库源

注:一般情况创建仓库文件不建议写到redhat.repo 里面

因为我们现在用到的软件包不是通过红帽官方获取的,  如果是通过官方获取的,就可以写到 /etc/yum.repos.d/redhat.repo  里面

但是我们现在所定义的仓库不是通过红帽官方所获取的,把仓库源写到这个文件也可以,但是要注意一个版本的问题linux8  可以  ,但如果是linux7就有问题

所以后期要注如果通过其他路径(非红帽官方的路径)所获取的软件包,最好不要将仓库文件写到redhat.repo 里面

[root@localhost ~]# cd   /etc/yum.repos.d
[root@localhost yum.repos.d]# ll
total 8
-rw-r--r--. 1 root root 127 Dec 17 18:40 base.repo     后来自己创建的  base  自己定义的
-rw-r--r--. 1 root root 358 Nov 20 03:01 redhat.repo   默认就有 的红帽仓库文件  但是这个仓库文 
                                                      件没有任何内容 仓库源

[root@localhost yum.repos.d]# cat    redhat.repo
或
[root@localhost ~]# cat   /etc/yum.repos.d/redhat.repo

#
# Certificate-Based Repositories
# Managed by (rhsm) subscription-manager
#
# *** This file is auto-generated.  Changes made here will be over-written. ***
# *** Use "subscription-manager repo-override --help" if you wish to make changes. ***
#
# If this file is empty and this system is subscribed consider
# a "yum repolist" to refresh available repos
#
    
都是#开头的信息,都是注释信息, 没有参数的

仓库:yum 配置文件(仓库文件)   设计初心:以仓库形式管理

/etc/yum.repos.d/*.repo       (*.repo    软件获取得源位置)        

               仓库单词的缩写

(* :任意长度的任意字符)该文件的初始化文件后缀必须是.repo   习惯会用 base.repo                                                                                                                  (源仓库的标识信息)

         

vim  /etc/yum.repos.d/base.repo                    仓库一般有四条配置
[源标识名称]                                                    仓库的名称
name=描述信息
baseurl=file:///mnt/AppStream     //源的资源链接  (url  ----统一资源定位符)(file协议:本gpgcheck=0   0关闭  1开启                                 地协议)(Packages不用写,会自动加载)
[2源标识名称]
name=描述信息
baseurl=file:///mnt/BaseOS
gpgcheck=0   0关闭  1开启                        公司验证,密钥

##################################


补: 公司验证,密钥

公钥  私钥

公钥:公共用户所拥有的一把密钥

私钥:服务端所拥有的一把密钥

自己的公钥要和服务端的私钥匹配成功

例:在Windows系统中下载软件时软件服务端发来的是公钥  要和服务端的私钥相匹配,才能成功下载


注:要获取所有的软件包,所以要建两个路径    ,   几个路径几个源

(linux8)/(linux7)      : 两个源建两个路径   /     一个源建一个路径

eg: 

vim   /etc/yum.repos.d/base.repo

[AppStream]                                     [源标识名称]      根据软件包所处的路径选择

name=RHEL-AppStream                 描述信息 获取的是红帽企业linux AppStream下的软件包

baseurl=file:/ / /mnt/AppStream

gpgcheck=0                                     1开启      0关闭 

[BaseOS]                                          [2源标识名称]

name= RHEL-BaseOS                     描述信息

baseurl=file:/ / /mnt/BaseOS

gpgcheck=0                                     1开启      0关闭 

第二步:安装对应的软件包

众多指令记住前面7条指令 ,重点在安装和卸载软件包(可以解决软件包之间的依赖关系)

yum/dnf    install  [-y]     包名/软件名   安装指定的软件包,-y则在工作过程中需要使用者响应, 这个选个参数可以直接回答yes  (可以通过软件名找到包名) yes  确定执行  如果不想手动输入y确定  那就在输入的命令后面加-y

     (install(安装)---命令的参数)

yum remove [-y] 包名 卸载已经安装在系统中的指定的软件包

yum provides 文件名 查找指定的文件属于哪个包; rpm -qf     绝对路径下的文件名

yum info   软件名 查看对应的指定软件包的详细信息  rpm  -qpi     包名  

yum repolist [all] 查看系统中yum资源库配置信息(检查仓库配置)(仓库要建好才可以查看出来

作用:列出仓库源(可以在建好仓库之后,做出一个检查验证)

#yum    list          查看有哪些安装包

=

yum list all 列出仓库里所有可安装的软件包  (rpm中没有

yum list installed [包名] 列出己经安装的所有的或指定的rpm包(包名中可使用匹配符) rpm -qa

yum upgrade [-y] 包名 升级指定的软件包或主机中所有已安装的软件包

yum search 模糊包名 查看模糊包名的软件包

包组:

yum grouplist 查看仓库里而所有包组

yum groupinfo 包组名 查看指定包组里而的详细信息

yum groupinstall 包组名 安装指定包组里面的所有包  (组安装,安装的软件包之间没有依赖关系)

yum groupremove  包组名 卸载指定包组里面的所有包

yum list all   =   yum  list  列出仓库里所有可安装的软件包

yum list installed [包名] 列出己经安装的所有的或指定的rpm包(包名中可使用匹配符) rpm -qa

yum clean all 清除下载到本机的指定的软件包或所有软件包的yum源缓存

补:

yum/dnf  alias     装包的时候可以匹配别名(对应的包名)

yum/dnf  autoremove  自动卸载移除软件包

yum/dnf   downgrade   对软件包降级

yum/dnf    mark         查看做过标记的软件包

yum/dnf     history      查看历史上安装的软件包

yum/dnf 的特点:

安装软件包直接指定软件名可以自动加载对应的软件包;

安装软件包不需要指定软件路径;(参考①,可用软件名代替软件包名,软件的路径在当前路径下就有)

自动识别依赖软件程序,一次性安装不需要繁琐一次次指定。

eg: 

命令演示

①  yum info   软件名 查看指定软件包的详细信息  rpm  -qpi     包名 

软件包:
-r--r--r--. 1996 redhat redhat    532104 Mar  3  2020 zsh-html-5.5.1-6.el8_1.2.noarch.rpm

[root@localhost ~]# rpm   -qpi  zsh-html-5.5.1-6.el8_1.2.noarch.rpm
error: open of zsh-html-5.5.1-6.el8_1.2.noarch.rpm failed: No such file or directory
此目录下没有该文件,该文件不在此目录下,因此需要换一条目录,换一条路径


同理,在查看软件包时 或切换软件包下路径时,需要先将设备与挂载点目录下的一个挂载点先挂载


[root@localhost ~]# cd  /mnt/AppStream/Packages

[root@localhost Packages]# rpm   -qpi  zsh-html-5.5.1-6.el8_1.2.noarch.rpm
warning: zsh-html-5.5.1-6.el8_1.2.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
Name        : zsh-html
Version     : 5.5.1
Release     : 6.el8_1.2
Architecture: noarch
Install Date: (not installed)
Group       : Unspecified
Size        : 3343388
License     : MIT
Signature   : RSA/SHA256, Tue 03 Mar 2020 09:26:42 PM CST, Key ID 199e2f91fd431d51
Source RPM  : zsh-5.5.1-6.el8_1.2.src.rpm
Build Date  : Tue 03 Mar 2020 09:07:42 PM CST
Build Host  : arm64-038.build.eng.bos.redhat.com
Relocations : (not relocatable)
Packager    : Red Hat, Inc. <http://bugzilla.redhat.com/bugzilla>
Vendor      : Red Hat, Inc.
URL         : http://zsh.sourceforge.net/
Summary     : Zsh shell manual in html format
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.
This package contains the Zsh manual in html format.

[root@localhost Packages]# rpm  -qpi  zsh-html
error: open of zsh-html failed: No such file or directory






[root@localhost Packages]# yum  info  zsh-html-5.5.1-6.el8_1.2.noarch.rpm
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 0:41:35 ago on Wed 14 Dec 2022 01:16:06 AM CST.
Error: No matching Packages to list
[root@localhost Packages]# yum  info  zsh-html
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 0:43:23 ago on Wed 14 Dec 2022 01:16:06 AM CST.
Available Packages
Name         : zsh-html
Version      : 5.5.1
Release      : 6.el8_1.2
Architecture : noarch
Size         : 520 k
Source       : zsh-5.5.1-6.el8_1.2.src.rpm
Repository   : AppStream
Summary      : Zsh shell manual in html format
URL          : http://zsh.sourceforge.net/
License      : MIT
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.
             : 
             : This package contains the Zsh manual in html
             : format.
或
zsh-html  是个软件名就在家目录下,与zsh-5.5.1-6.el8_1.2.src.rpm软件包名不同,他只能在对应的挂载点目录下的软件包路径下查看


[root@localhost ~]# yum  info  zsh-html
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 1:08:09 ago on Wed 14 Dec 2022 01:16:06 AM CST.
Available Packages
Name         : zsh-html
Version      : 5.5.1
Release      : 6.el8_1.2
Architecture : noarch
Size         : 520 k
Source       : zsh-5.5.1-6.el8_1.2.src.rpm
Repository   : AppStream
Summary      : Zsh shell manual in html format
URL          : http://zsh.sourceforge.net/
License      : MIT
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.
             : 
             : This package contains the Zsh manual in html
             : format.

yum provides    (直接用)文件名 查找指定的文件属于哪个包( 更方便 ); rpm -qf        (必须用)绝对路径下的文件名

[root@localhost ~]# rpm  -qf  /usr/bin/tar
tar-1.30-5.el8.x86_64

[root@localhost ~]# yum  provides   tar
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 1:34:51 ago on Wed 14 Dec 2022 01:16:06 AM CST.
tar-2:1.30-5.el8.x86_64 : A GNU file archiving program
Repo        : @System
Matched from:
Provide    : tar = 2:1.30-5.el8

tar-2:1.30-5.el8.x86_64 : A GNU file archiving program
Repo        : BaseOS
Matched from:
Provide    : tar = 2:1.30-5.el8
[root@localhost ~]# rpm  -qf  tar
error: file /root/tar: No such file or directory

[root@localhost ~]# which  tar
/usr/bin/tar
[root@localhost ~]# rpm  -qf  /usr/bin/tar
tar-1.30-5.el8.x86_64
或
[root@localhost ~]# yum  provides   tar
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 1:34:51 ago on Wed 14 Dec 2022 01:16:06 AM CST.
tar-2:1.30-5.el8.x86_64 : A GNU file archiving program
Repo        : @System
Matched from:
Provide    : tar = 2:1.30-5.el8

tar-2:1.30-5.el8.x86_64 : A GNU file archiving program
Repo        : BaseOS
Matched from:
Provide    : tar = 2:1.30-5.el8

[root@localhost ~]# yum  provides   /usr/bin/tar
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 1:35:38 ago on Wed 14 Dec 2022 01:16:06 AM CST.
tar-2:1.30-5.el8.x86_64 : A GNU file archiving program
Repo        : @System
Matched from:
Filename    : /usr/bin/tar

tar-2:1.30-5.el8.x86_64 : A GNU file archiving program
Repo        : BaseOS
Matched from:
Filename    : /usr/bin/tar     
提醒:yum不用绝对路径,直接用文件名







[root@localhost ~]# yum  provides  zsh-html
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 1:40:17 ago on Wed 14 Dec 2022 01:16:06 AM CST.
zsh-html-5.5.1-6.el8_1.2.noarch : Zsh shell manual in html
                                : format
Repo        : AppStream
Matched from:
Provide    : zsh-html = 5.5.1-6.el8_1.2
或
[root@localhost ~]# which   zsh-html
/usr/bin/which: no zsh-html in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
[root@localhost ~]# rpm  -qf  zsh-html      不在环境变量路径之下,无法查找绝对路径
error: file /root/zsh-html: No such file or directory

③yum repolist [all] 查看系统中yum资源库配置信息(检查仓库配置)(仓库要建好才可以查看出来

[root@localhost ~]# yum   repolist
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

repo id                         repo name
AppStream                       AppStream
BaseOS                          BaseOS

④查看系统已经安装的软件中,有没有刚刚需要安装的软件

eg: 查询软件httpd 是否安装 

[root@localhost ~]# yum  list   installed  |  grep   httpd
第一次查询没有信息显示, 说明该软件包没有安装


第二步:安装软件包
[root@localhost ~]# mount  /dev/sr0   /mnt
mount: /mnt: WARNING: device write-protected, mounted read-only.
[root@localhost ~]# dnf  repolist
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

repo id                         repo name
AppStream                       AppStream
BaseOS                          BaseOS
[root@localhost ~]# yum   install   httpd  -y
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

BaseOS                         2.7 MB/s | 2.8 kB     00:00    
AppStream                      3.1 MB/s | 3.2 kB     00:00    
Dependencies resolved.
===============================================================
 Package            Arch   Version             Repo       Size
===============================================================
Installing:
 httpd              x86_64 2.4.37-41.module+el8.5.0+11772+c8e0c271
                                               AppStream 1.4 M
Installing dependencies:
 apr                x86_64 1.6.3-12.el8        AppStream 130 k
 apr-util           x86_64 1.6.1-6.el8         AppStream 105 k
 httpd-filesystem   noarch 2.4.37-41.module+el8.5.0+11772+c8e0c271
                                               AppStream  39 k
 httpd-tools        x86_64 2.4.37-41.module+el8.5.0+11772+c8e0c271
                                               AppStream 106 k
 mod_http2          x86_64 1.15.7-3.module+el8.4.0+8625+d397f3da
                                               AppStream 154 k
 redhat-logos-httpd noarch 84.5-1.el8          BaseOS     29 k
Installing weak dependencies:
 apr-util-bdb       x86_64 1.6.1-6.el8         AppStream  25 k
 apr-util-openssl   x86_64 1.6.1-6.el8         AppStream  27 k
Enabling module streams:
 httpd                     2.4                                

Transaction Summary
===============================================================
Install  9 Packages

Total size: 2.0 M
Installed size: 5.4 M
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                       1/1 
  Installing       : apr-1.6.3-12.el8.x86_64               1/9 
  Running scriptlet: apr-1.6.3-12.el8.x86_64               1/9 
  Installing       : apr-util-bdb-1.6.1-6.el8.x86_64       2/9 
  Installing       : apr-util-openssl-1.6.1-6.el8.x86_64   3/9 
  Installing       : apr-util-1.6.1-6.el8.x86_64           4/9 
  Running scriptlet: apr-util-1.6.1-6.el8.x86_64           4/9 
  Installing       : httpd-tools-2.4.37-41.module+el8.5.   5/9 
  Running scriptlet: httpd-filesystem-2.4.37-41.module+e   6/9 
  Installing       : httpd-filesystem-2.4.37-41.module+e   6/9 
  Installing       : redhat-logos-httpd-84.5-1.el8.noarc   7/9 
  Installing       : mod_http2-1.15.7-3.module+el8.4.0+8   8/9 
  Installing       : httpd-2.4.37-41.module+el8.5.0+1177   9/9 
  Running scriptlet: httpd-2.4.37-41.module+el8.5.0+1177   9/9 
  Verifying        : redhat-logos-httpd-84.5-1.el8.noarc   1/9 
  Verifying        : apr-1.6.3-12.el8.x86_64               2/9 
  Verifying        : apr-util-1.6.1-6.el8.x86_64           3/9 
  Verifying        : apr-util-bdb-1.6.1-6.el8.x86_64       4/9 
  Verifying        : apr-util-openssl-1.6.1-6.el8.x86_64   5/9 
  Verifying        : httpd-2.4.37-41.module+el8.5.0+1177   6/9 
  Verifying        : httpd-filesystem-2.4.37-41.module+e   7/9 
  Verifying        : httpd-tools-2.4.37-41.module+el8.5.   8/9 
  Verifying        : mod_http2-1.15.7-3.module+el8.4.0+8   9/9 
Installed products updated.

Installed:
  apr-1.6.3-12.el8.x86_64                                      
  apr-util-1.6.1-6.el8.x86_64                                  
  apr-util-bdb-1.6.1-6.el8.x86_64                              
  apr-util-openssl-1.6.1-6.el8.x86_64                          
  httpd-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64         
  httpd-filesystem-2.4.37-41.module+el8.5.0+11772+c8e0c271.noarch
  httpd-tools-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64   
  mod_http2-1.15.7-3.module+el8.4.0+8625+d397f3da.x86_64       
  redhat-logos-httpd-84.5-1.el8.noarch                         

Complete!
软件包安装成功



[root@localhost ~]# yum  list   installed  |  grep   httpd    第一次查询什么都没有
httpd.x86_64                                       2.4.37-    除了第一个是所需要安装的软件包
41.module+el8.5.0+11772+c8e0c271        @AppStream            其他几个软件包可以查询到是因为    
httpd-filesystem.noarch                            2.4.37-    他们与所要安装的软件包是依赖关
41.module+el8.5.0+11772+c8e0c271        @AppStream            系  ,所以一并下载下来了
httpd-tools.x86_64                                 2.4.37-41.module+el8.5.0+11772+c8e0c271        @AppStream
redhat-logos-httpd.noarch                          84.5-1.el8                                     @BaseOS   
成功查询该软件包,说明该软件包安装成功

⑤查看目前为止仓库一共有多少个软件包可以安装

[root@localhost ~]# yum  list   
...
yp-tools.x86_64                    4.2.3-1.el8       AppStream 
ypbind.x86_64                      3:2.5-2.el8       AppStream 
ypserv.x86_64                      4.0-6.20170331git5bfba76.el8
...
[root@localhost ~]# yum  list  all  |  wc  
   6991   20991  845247
[root@localhost ~]# yum  list  all  |  wc   -l
6991
[root@localhost ~]# yum  list    |  wc   -l    查看多少行
6991
  
6991-1=6990

⑥卸载软件包(yum/dnf卸载时也会将有依赖关系的文件一并卸载

yp-tools.x86_64                    4.2.3-1.el8       AppStream 

yum remove [-y] 包名/软件名 卸载已经安装在系统中的指定的软件包

第一步
[root@localhost ~]# yum  list |  grep  yp-tools
yp-tools.x86_64                                        4.2.3-1.el8                                            AppStream             查看的是可以安装的软件包中是否有这个软件
                                                                        
[root@localhost ~]# yum  list  installed  |  grep  yp-tools
   

  查看的是已经安装的软件包中是否有这个软件包
  什么都没有显示代表没有
  需安装                                                   
[root@localhost ~]# yum  install  yp-tools  -y
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Last metadata expiration check: 1:25:56 ago on Sun 18 Dec 2022 07:56:50 PM CST.
Package yp-tools-4.2.3-1.el8.x86_64 is already installed.
Dependencies resolved.
Nothing to do.
Complete!
软件包已经安装成功

[root@localhost ~]# yum  list  installed  |  grep  yp-tools
yp-tools.x86_64                                    4.2.3-1.el8                                    @AppStream
成功查询到已经安装的软件包有该软件
第二步:
继续卸载软件包
[root@localhost ~]# dnf  remove  yp-tools
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

Dependencies resolved.
===============================================================
 Package      Arch       Version          Repository      Size
===============================================================
Removing:
 yp-tools     x86_64     4.2.3-1.el8      @AppStream     236 k
Removing unused dependencies:                                一并卸载有依赖关系的软件包
                                                                    
 nss_nis      x86_64     3.0-8.el8        @BaseOS         88 k
 ypbind       x86_64     3:2.5-2.el8      @AppStream     100 k

Transaction Summary
===============================================================
Remove  3 Packages

Freed space: 424 k
Is this ok [y/N]: y            yes  确定执行  如果不想手动输入y确定  那就在输入的命令后面加-y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                       1/1 
  Running scriptlet: yp-tools-4.2.3-1.el8.x86_64           1/1 
  Erasing          : yp-tools-4.2.3-1.el8.x86_64           1/3 
  Running scriptlet: ypbind-3:2.5-2.el8.x86_64             2/3 
  Erasing          : ypbind-3:2.5-2.el8.x86_64             2/3 
  Running scriptlet: ypbind-3:2.5-2.el8.x86_64             2/3 
  Erasing          : nss_nis-3.0-8.el8.x86_64              3/3 
  Running scriptlet: nss_nis-3.0-8.el8.x86_64              3/3 
  Verifying        : nss_nis-3.0-8.el8.x86_64              1/3 
  Verifying        : yp-tools-4.2.3-1.el8.x86_64           2/3 
  Verifying        : ypbind-3:2.5-2.el8.x86_64             3/3 
Installed products updated.

Removed:
  nss_nis-3.0-8.el8.x86_64      yp-tools-4.2.3-1.el8.x86_64    
  ypbind-3:2.5-2.el8.x86_64    

Complete!



总结:安装软件包的步骤:

①将设备(文件系统)与挂载点目录挂载(不一定用系统上的挂载点目录media( 永久连接的挂载点目录)   /dev/sr0 on /run/media/redhat/RHEL-8-5-0-BaseOS-x86_64 ,可以用临时连接的挂载点目录mnt        /mnt          
②安装软件包

第一种:rpm    软件管理工具(命令)

rpm    -ivh     软件包名               安装软件包   [i--安装   v--详细信息   h hash--缓存(可以看见软件包的安装进程)]     

注:要处理依赖关系,几个有依赖关系的文件一起安装或卸载

第二种:dnf/yum  (仓库管理)(与rmp相比可以解决繁琐的依赖关系)

首先通过yum  和  dnf  的配置文件 /etc/yum.repos.d/*.repo       (*.repo    软件获取得源置)   (* :任意长度的任意字符)该文件的初始化文件后缀必须是.repo   习惯会用 base.repo           建立仓库,linux8 有两条路径,所以要建立两个仓库源

然后可以先通过命令  vim   repolist  验证查看仓库(仓库源)是否建好

repo id                         repo name
AppStream                       AppStream
BaseOS                          BaseOS

最后执行命令:

yum install [-y] 包名/软件名  安装指定的软件包,-y则在工作过程中需要使用者响应, 这个选个参数可以直接回答yes   (写软件名也可以直接匹配对应的软件包)

     (install(安装)---yum命令的参数)

个人感悟:rpm可以安装软件包也可以卸载软件(不可以安装软件 和不可以卸载软件包),不仅可以对软件包操作也可以对软件操作

                  dnf/yum只可以安装软件包和卸载软件包      (不可以安装软件和卸载软件)不能对软件进行操作   

                 无论是rpm 还是dnf/yum,安装软件包都要在对应的路径之下, 卸载也是一样,但是卸载软件不需要

           



习题
(1)通过yum/dnf安装软件httpd程序;

[root@localhost ~]# mount  /dev/sr0    /mnt
mount: /mnt: WARNING: device write-protected, mounted read-only.
[root@localhost ~]# vim   /etc/yum.repos.d/base.repo


[root@localhost Packages]# vim     /etc/yum.repos.d/base.repo
[BaseOS]
name=BaseOS
baseurl=file:///mnt/BaseOS
gpgcheck=0
[AppStream]
name=AppStream
baseurl=file:///mnt/AppStream
gpgcheck=0
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
~                                                          
<m.repos.d/base.repo" 8L, 127C           8,10          All

[root@localhost Packages]# dnf   repolist
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

repo id                       repo name
AppStream                     AppStream
BaseOS                        BaseOS

验证仓库是否建好






[root@localhost Packages]# dnf  install  httpd  -y
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

BaseOS                     2.7 MB/s | 2.8 kB     00:00    
AppStream                  3.1 MB/s | 3.2 kB     00:00    
Dependencies resolved.
===========================================================
 Package            Arch   Version         Repo       Size
===========================================================
Installing:
 httpd              x86_64 2.4.37-41.module+el8.5.0+11772+c8e0c271
                                           AppStream 1.4 M
Installing dependencies:
 apr                x86_64 1.6.3-12.el8    AppStream 130 k
 apr-util           x86_64 1.6.1-6.el8     AppStream 105 k
 httpd-filesystem   noarch 2.4.37-41.module+el8.5.0+11772+c8e0c271
                                           AppStream  39 k
 httpd-tools        x86_64 2.4.37-41.module+el8.5.0+11772+c8e0c271
                                           AppStream 106 k
 mod_http2          x86_64 1.15.7-3.module+el8.4.0+8625+d397f3da    有八个包和他有依赖关系
                                           AppStream 154 k
 redhat-logos-httpd noarch 84.5-1.el8      BaseOS     29 k
Installing weak dependencies:
 apr-util-bdb       x86_64 1.6.1-6.el8     AppStream  25 k
 apr-util-openssl   x86_64 1.6.1-6.el8     AppStream  27 k
Enabling module streams:
 httpd                     2.4                            

Transaction Summary
===========================================================
Install  9 Packages

要安装这个软件包一共需要安装九个软件包
用yum/dnf直接解决八个包的依赖关系


              
Total size: 2.0 M
Installed size: 5.4 M
Downloading Packages:
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                   1/1 
  Installing       : apr-1.6.3-12.el8.x86_64           1/9 
  Running scriptlet: apr-1.6.3-12.el8.x86_64           1/9 
  Installing       : apr-util-bdb-1.6.1-6.el8.x86_64   2/9 
  Installing       : apr-util-openssl-1.6.1-6.el8.x8   3/9 
  Installing       : apr-util-1.6.1-6.el8.x86_64       4/9 
  Running scriptlet: apr-util-1.6.1-6.el8.x86_64       4/9 
  Installing       : httpd-tools-2.4.37-41.module+el   5/9 
  Running scriptlet: httpd-filesystem-2.4.37-41.modu   6/9 
  Installing       : httpd-filesystem-2.4.37-41.modu   6/9 
  Installing       : redhat-logos-httpd-84.5-1.el8.n   7/9 
  Installing       : mod_http2-1.15.7-3.module+el8.4   8/9 
  Installing       : httpd-2.4.37-41.module+el8.5.0+   9/9 
  Running scriptlet: httpd-2.4.37-41.module+el8.5.0+   9/9 
  Verifying        : redhat-logos-httpd-84.5-1.el8.n   1/9 
  Verifying        : apr-1.6.3-12.el8.x86_64           2/9 
  Verifying        : apr-util-1.6.1-6.el8.x86_64       3/9 
  Verifying        : apr-util-bdb-1.6.1-6.el8.x86_64   4/9 
  Verifying        : apr-util-openssl-1.6.1-6.el8.x8   5/9 
  Verifying        : httpd-2.4.37-41.module+el8.5.0+   6/9 
  Verifying        : httpd-filesystem-2.4.37-41.modu   7/9 
  Verifying        : httpd-tools-2.4.37-41.module+el   8/9 
  Verifying        : mod_http2-1.15.7-3.module+el8.4   9/9 
Installed products updated.

Installed:
  apr-1.6.3-12.el8.x86_64                                  
  apr-util-1.6.1-6.el8.x86_64                              
  apr-util-bdb-1.6.1-6.el8.x86_64                          
  apr-util-openssl-1.6.1-6.el8.x86_64                      
  httpd-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64     
  httpd-filesystem-2.4.37-41.module+el8.5.0+11772+c8e0c271.noarch
  httpd-tools-2.4.37-41.module+el8.5.0+11772+c8e0c271.x86_64
  mod_http2-1.15.7-3.module+el8.4.0+8625+d397f3da.x86_64   
  redhat-logos-httpd-84.5-1.el8.noarch                     

Complete!


在/var/www/html创建一个文件为index.html,内容为helloworld;

[root@localhost Packages]# echo  helloword  >/var/www/html/index.html
[root@localhost Packages]# systemctl  start  httpd


执行systemctl start httpd命令后通过linux浏览器访问该文件内

容http://localhost

(2)卸载httpd软件包;


补:

软件和软件包

软件的定义:

软件是能够完成预定功能,达到预期性能的,可以执行的计算机指令;
软件是能够让程序处理适当信息的数据结构;
软件是描述程序操作和使用的文档;
软件是一种逻辑实体,具备知识性的产品集合,是对物理世界的一种抽象,同时又是一种人脑智力的成果

总结:软件 = 程序 + 数据 + 文档 + (服务)


软件包由一个基本配置和若干可选部件构成,既可以是源代码形式,也可以是目标码形式。用户手册和指南等文档是软件包的重要组成部分。此外,软件包的维护及技术支持也是非常必要的。
软件包 在系统管理中,软件包的管理是最重要的,是系统管理的基础的基础;只有我们学会软件包的管理才能谈得上其它的应用;本文以目录式的文档格式,列出新手弟兄所面对的软件包的安装、更新、查询相对的文档,以及几个常用的软件包管理工具,比如system-cofig-packages 、yum 、ppapt

软件包管理工具
1、system-config-packages
2、yum 在线更新软件包,也能管理本地已经安装的软件包工具

 

分类
对于Linux、BSD系统
在Linux、BSD系统中,软件包主要以两种形式出现
:二进制包以及源代码包。 主要的二进制包格式有:
rpm
deb
Autopackage

源代码包则主要适用于自由软件的安装,用户需要自己编译它们。


新手小白,

请多多指教~~

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值