运维开发网
广告位招商联系QQ:123077622
 
广告位招商联系QQ:123077622

程序包管理

运维开发网 https://www.qedev.com 2021-05-07 20:54 出处:51CTO 作者:wh1722525928
程序包管理,wh1722525928的博客原创的Linux文章。

神奇的文件夹/misc

yum install autofs 
systemctl  enable  ---now  autofs 
以后就会自动挂载光盘
[root05:56 PMcentos8 ~]#cd /misc
[root05:56 PMcentos8 /misc]#cd cd/
[root05:56 PMcentos8 /misc/cd]#ls         以下的两个包中存放的rpm包
AppStream  BaseOS  EFI  images  isoLinux  media.repo  TRANS.TBL

rpm2cpio 命令

[root06:07 PMcentos8 /misc/cd/BaseOS/Packages]#cp bash-4.4.19-10.el8.x86_64.rpm  /data/
[root06:07 PMcentos8 /misc/cd/BaseOS/Packages]#cd /data
[root06:07 PMcentos8 /data]#ls
bash-4.4.19-10.el8.x86_64.rpm

将rpm文件转化为 cpio格式,然后解开里面的文件
                                        -v  显示过程
                                        -t   预览
[root06:08 PMcentos8 /data]#rpm2cpio bash-4.4.19-10.el8.x86_64.rpm |cpio -id 
13573 blocks
[root06:09 PMcentos8 /data]#ls
bash-4.4.19-10.el8.x86_64.rpm  etc  usr

rpm的管理工具

依赖的数据库:/var/lib/rpm

由于每次用rpm2cpio解包太麻烦,所有了rpm的管理工具
有的文件和cpu的架构无光,比如说这里面的文档文件和cpu架构无关系
[root06:34 PMcentos8 /data]#ls
yum-4.2.17-6.el8.noarch.rpm
[root06:34 PMcentos8 /data]#rpm2cpio yum-4.2.17-6.el8.noarch.rpm |cpio -idv
./etc/dnf/protected.d/yum.conf
./etc/yum.conf
./etc/yum/pluginconf.d
./etc/yum/protected.d
./etc/yum/vars
./usr/bin/yum
./usr/share/man/man1/yum-aliases.1.gz
./usr/share/man/man5/yum.conf.5.gz
./usr/share/man/man8/yum-shell.8.gz
./usr/share/man/man8/yum.8.gz
142 blocks

查找光盘里面包的个数

x3270-3.6ga5-1.el8.x86_64.rpm
x3270-text-3.6ga5-1.el8.x86_64.rpm
xdelta-3.1.0-4.el8.x86_64.rpm
xfsdump-3.1.8-2.el8.x86_64.rpm
xfsprogs-5.0.0-2.el8.i686.rpm
xfsprogs-5.0.0-2.el8.x86_64.rpm
xfsprogs-devel-5.0.0-2.el8.i686.rpm
xfsprogs-devel-5.0.0-2.el8.x86_64.rpm
xml-common-0.6.3-50.el8.noarch.rpm
xmlrpc-c-1.51.0-5.el8.i686.rpm
xmlrpc-c-1.51.0-5.el8.x86_64.rpm
xmlrpc-c-client-1.51.0-5.el8.i686.rpm
xmlrpc-c-client-1.51.0-5.el8.x86_64.rpm
xz-5.2.4-3.el8.x86_64.rpm
xz-devel-5.2.4-3.el8.i686.rpm
xz-devel-5.2.4-3.el8.x86_64.rpm
xz-libs-5.2.4-3.el8.i686.rpm
xz-libs-5.2.4-3.el8.x86_64.rpm
yum-4.2.17-6.el8.noarch.rpm
yum-utils-4.0.12-3.el8.noarch.rpm
zip-3.0-23.el8.x86_64.rpm
zlib-1.2.11-13.el8.i686.rpm
zlib-1.2.11-13.el8.x86_64.rpm
zlib-devel-1.2.11-13.el8.i686.rpm
zlib-devel-1.2.11-13.el8.x86_64.rpm
zsh-5.5.1-6.el8_1.2.x86_64.rpm

....................
.................
..................
方法一

[[email protected] Packages]#    ls *.rpm  |grep -Eo   [^.]+\.rpm$|cut  -d. -f1 |sort |uniq -c
    393 i686
    215 noarch
   1066 x86_64

方法二
[root06:47 PMcentos8 /misc/cd/BaseOS/Packages]#   ls |rev |cut -d. -f2|rev|sort|uniq  -c
    393 i686
    215 noarch
      1 TRANS
   1066 x86_64

方法三

[root07:20 PMcentos8 /misc/cd/BaseOS/Packages]#  ls *.rpm  |grep -Eo   [^.]+\.rpm$ |grep -Eo ^[^.]+ |sort |uniq -c
    393 i686
    215 noarch
   1066 x86_64
方法四
[root07:22 PMcentos8 /misc/cd/BaseOS/Packages]#ls  *.rpm |sed  -En 's#.*\.([^.]+)\.rpm#\1#p'|sort |uniq -c
    393 i686
    215 noarch
   1066 x86_64

方法五

或者锚点词尾加$:
[[email protected] Packages]# find  -name "*.rpm" |sed  -En 's#.*\.([^.]+)\.rpm$#\1#p'|sort |uniq -c
    393 i686
    215 noarch
   1066 x86_64
.*表示任意内容

rpm的相关命令

该命令依赖于/var/lib/rpm 库,

-ivh  安装 
            [root08:08 PMcentos8 /data]#cd /misc/cd
            [root08:08 PMcentos8 /misc/cd]#ls
            AppStream  BaseOS  EFI  images  isoLinux  media.repo  TRANS.TBL
            [root08:08 PMcentos8 /misc/cd]#find  . -name "tree*"
            ./BaseOS/Packages/tree-1.7.0-15.el8.x86_64.rpm
            [root08:08 PMcentos8 /misc/cd]#rpm -ivh /misc/cd/BaseOS/Packages/tree-1.7.0-15.el8.x86_64.rpm 
            Verifying...                          ################################# [100%]
            Preparing...                          ################################# [100%]

--nodeps 忽略依赖,强行安装或卸载
--replacepkgs|--force  覆盖安装程序包

-q 查询某个包是否存在
             例如 rpm -q  nccommpass   &> /dev/null || yum install  nccomoass

-qa 查询所有安装的程序包
            [[email protected] cd]#rpm -qa "vs*"   注意加双引号和find的命令一样,按name 的查找要加双引号
            [[email protected] cd]#rpm -qa |grep  vs

-qf 查询某个文件由那个程序包安装
            相当于 yum  provides 

-ql  查看包里面的安装文件列表在磁盘上生成哪些文件                   -qpl该包未安装时候查询若安装就会生成哪些文件

-qi 查询某个程序包的安装信息,此包必须是已经安装的, 相当于 yum provides ,但是yum   provides要强一点                但是-qpi未安装的情况下查询
                [root08:09 PMcentos8 /misc/cd]#rpm -qi  tree
                Name        : tree
                Version     : 1.7.0
                Release     : 15.el8
                Architecture: x86_64
                Install Date: Sun 25 Apr 2021 01:13:38 AM CST
                Group       : Unspecified
                Size        : 111603
                License     : GPLv2+
                Signature   : RSA/SHA256, Tue 02 Jul 2019 09:53:45 AM CST, Key ID 05b555b38483c65d
                Source RPM  : tree-1.7.0-15.el8.src.rpm
                Build Date  : Sat 11 May 2019 11:54:52 PM CST
                Build Host  : x86-01.mbox.centos.org
                Relocations : (not relocatable)
                Packager    : CentOS Buildsys <[email protected]>
                Vendor      : CentOS
                URL         : http://mama.indstate.edu/users/ice/tree/
                Summary     : File system tree viewer
                Description :
                The tree utility recursively displays the contents of directories in a
                tree-like format.  Tree is basically a UNIX port of the DOS tree
                utility.

-qd 查询某个程序包的帮助文档
-qc 查询某个程序包的配置文件
-q --scripts 查询脚本
-q --changlog 查询更新日志
-q --provides
-q --requires

-e 卸载程序包
                    rpm   -e    无法解决依赖性的包

--nodeps 忽略依赖

-Uvh 升级或安装程序包
-Fvh 只能升级,如果旧版本不存在就不执行

--oldpackage 降级

-qR 离开了哪些文件我玩不了

 -q --whatprovides    由哪个提供
[root08:34 PMcentos8 /misc/cd]#rpm -q --whatprovides bash
bash-4.4.19-10.el8.x86_64

 -q --whatrequires    被哪些所依赖
[root08:34 PMcentos8 /misc/cd]#rpm -q --whatrequires bash
ca-certificates-2019.2.32-80.0.el8_1.noarch
dracut-049-70.git20200228.el8.x86_64
initscripts-10.00.6-1.el8.x86_64
rsyslog-8.1911.0-3.el8.x86_64
autofs-5.1.4-43.el8.x86_64
mariadb-10.3.28-1.module_el8.3.0+757+d382997d.x86_64

包的合法性检查

[root08:50 PMcentos8 /etc/pki/rpm-gpg]#ll
total 12
-rw-r--r--. 1 root root 1683 Jun  3  2020 RPM-GPG-KEY-centosofficial   #该文件可以检查包的真伪
-rw-r--r--. 1 root root 1687 Jun  3  2020 RPM-GPG-KEY-centostesting
-rw-r--r--  1 root root 1627 Dec 19  2019 RPM-GPG-KEY-EPEL-8
[root08:50 PMcentos8 /etc/pki/rpm-gpg]#ll RPM-GPG-KEY-centosofficial 
-rw-r--r--. 1 root root 1683 Jun  3  2020 RPM-GPG-KEY-centosofficial

--import 导入该文件
[root08:50 PMcentos8 /etc/pki/rpm-gpg]#rpm --import RPM-GPG-KEY-centosofficial 

#查看是否导入了秘钥,
[root08:55 PMcentos8 /etc/pki/rpm-gpg]#rpm -qa "gpg-pubkey"
gpg-pubkey-2f86d6a1-5cf7cefb
gpg-pubkey-8483c65d-5ccc5b19

-K   检查包的合法性(只能针对centos系列的包)
[root08:47 PMcentos8 /misc/cd/AppStream/Packages]#rpm -K zziplib-0.13.68-8.el8.x86_64.rpm
zziplib-0.13.68-8.el8.x86_64.rpm: digests signatures OK
[root08:50 PMcentos8 /etc/pki/rpm-gpg]#pwd
/etc/pki/rpm-gpg

#检查一个不合法的包
[root09:03 PMcentos8 /misc/cd/BaseOS/Packages]#cp tree-1.7.0-15.el8.x86_64.rpm  /
[root09:04 PMcentos8 /misc/cd/BaseOS/Packages]#echo >> /tree-1.7.0-15.el8.x86_64.rpm      #被加了一个换行符号,被修改了,检查不合法了
[root09:04 PMcentos8 /misc/cd/BaseOS/Packages]#rpm -K /tree-1.7.0-15.el8.x86_64.rpm 
/tree-1.7.0-15.el8.x86_64.rpm: DIGESTS SIGNATURES NOT OK

yum和dnf仓库的实现和管理

#一个仓库的组成包括元数据和数据,安装一个包依赖于仓库的元数据,安装了一个包,保存元数据,下次直接在元数据里面找
    仓库可以是本机,如果一台计算机的仓库要所有人都可以用,那么就把一台计算机作为服务器,共享出来,以后企业里面的所有的机器都连接这台服务器。其他机器配置路径成为客服端

#配置文件   
[root09:39 PMcentos7 ~]#cat  /etc/yum.conf 
[main]
cachedir=/var/cache/yum/$basearch/$releasever
keepcache=0
debuglevel=2                                                                             $basearch : CPU架构                   $releasever :发行版本号
keepcache=0
logfile=/var/log/yum.log
exactarch=1
obsoletes=1
gpgcheck=1
plugins=1
installonly_limit=5
bugtracker_url=http://bugs.centos.org/set_project.php?project_id=23&ref=http://bugs.centos.org/bug_report_page.php?category=yum
distroverpkg=centos-release

#该目录下以*.repo结尾
yum 工具就是Python写的,依赖于rpm

[root09:35 PMcentos8 /etc/yum.repos.d]#ll /usr/bin/yum
lrwxrwxrwx. 1 root root 5 Apr 25  2020 /usr/bin/yum -> dnf-3

#编辑国内的yum源
[root10:20 PMcentos8 /etc/yum.repos.d]#cat wanghua-8.repo 
[base]
name=BaseOS
baseurl=file:///msic/cd/BaseOS
                https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/
                https://mirrors.huaweicloud.com/centos/8/BaseOS/x86_64/os/
gpgcheck=0

[epel]
name=Epel
baseurl=https://mirrors.aliyun.com/epel/$releasever/Everything/$basearch/           
              https://mirrors.huaweicloud.com/epel/8/Everything/x86_64/
gpgcheck=0

[AppStream]
name=AppStream
baseurl=file:///msic/cd/AppStrem
                https://mirrors.aliyun.com/centos/8/AppStream/x86_64/os/
              https://mirrors.huaweicloud.com/centos/8/BaseOS/x86_64/os/
gpgcheck=0

[extras]
name=Extras
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os/
              https://mirrors.huaweicloud.com/centos/8/extras/x86_64/os/

yum相关的命令

#  yum    repolist   列出所有的仓库

#日志
[root10:50 PMcentos7 /etc/yum.repos.d]#cat /var/log/yum.log  

#撤销和反悔撤销
[root10:50 PMcentos7 /etc/yum.repos.d]#yum history
            [root10:51 PMcentos7 /etc/yum.repos.d]#yum history undo 2 不做第2条历史了
                        [root10:54 PMcentos7 /etc/yum.repos.d]#yum history redo 2   重新做第2条历史

# 安装epel 源。该包功能强大
[root11:14 PMcentos7 /etc/yum.repos.d]#yum install epel-release  -y

yum      reinstall  
[root09:08 AMcentos7 ]#yum reinstall tree  -y

[root09:59 AMcentos7 ]#yum  list available   #查看所有可以安装的包

#查看更新仓库里面可以更新的包(前提是先配好update的仓库)
[root10:04 AMcentos7 ]#yum   --disablerepo=*   --enablerepo=update_wanghua_2021_04_30    list  available

#查看Samba的所有版本
[root10:07 AMcentos7 ]#yum info samba --showduplicate
#升级:yum update
#升级samba  yum   update  samba

#搜索包:
yum serach

#查看一个包的所依赖哪些包
[root07:51 AMcentos8 ~]#yum  deplist  httpd

配置yum仓库脚本

(此处如果用$basearch 或者$releaseve 就要转义

[root12:09 AMcentos7 /script]#vim yum.sh 

mv /etc/yum.repos.d/*.repo  /etc/yum.repos.d/backup
cat > /etc/yum.repos.d/base.repo <<EOF
[base]
name=base_wanghua_2021-04-13
baseurl=https://mirrors.huaweicloud.com/centos/7/os/x86_64/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

[huawei-epel]
name=epel_wanghua_2021-04-13
baseurl=https://mirrors.huaweicloud.com/epel/7/x86_64/
failovermethod=priority
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7

EOF

升级内核

[root09:11 AMcentos7 ]#uname -r
3.10.0-327.el7.x86_64

https://elrepo.org/tiki/HomePage
下载 https://www.elrepo.org/elrepo-release-7.el7.elrepo.noarch.rpm

然后在/etc/yum.repos.d/里面就会生成一个包
[[email protected] ~]# yum install elrepo-release-7.el7.elrepo.noarch.rpm -y
#查看包里面生成了什么东西
[[email protected] ~]# rpm -ql elrepo-release 
/etc/pki/elrepo
/etc/pki/elrepo/SECURE-BOOT-KEY-elrepo.org.der
/etc/pki/rpm-gpg
/etc/pki/rpm-gpg/RPM-GPG-KEY-elrepo.org
/etc/yum.repos.d
/etc/yum.repos.d/elrepo.repo  生成了elrepo.repo文件

[root09:24 AMcentos7 ]#ls
backup                 CentOS-Vault.repo
base.repo              elrepo-release-7.el7.elrepo.noarch.rpm
Centos-7.repo          elrepo.repo                                                 #  生成了一个内核的仓库
CentOS-Base.repo       epel-7.repo
CentOS-CR.repo         epel.repo
CentOS-Debuginfo.repo  epel-testing.repo
CentOS-fasttrack.repo  mariadb.repo
CentOS-Media.repo      wanghua.repo
CentOS-Sources.repo    wanghua.repo.bak

#只查看elrepo的包
[[email protected] yum.repos.d]# yum list  --disablerepo=* --enablerepo=elrepo

#启用kernel
[[email protected] yum.repos.d]# yum --disablerepo="*" --enablerepo="elrepo-kernel" list available 

Loaded plugins: fastestmirror
Repository base is listed more than once in the configuration
Repository updates is listed more than once in the configuration
Repository extras is listed more than once in the configuration
Repository centosplus is listed more than once in the configuration
Repository contrib is listed more than once in the configuration
Repository base is listed more than once in the configuration
Loading mirror speeds from cached hostfile
 * elrepo-kernel: mirror-hk.koddos.net
Available Packages
kernel-lt.x86_64                                                   5.4.111-1.el7.elrepo                                  elrepo-kernel
kernel-lt-devel.x86_64                                             5.4.111-1.el7.elrepo                                  elrepo-kernel
kernel-lt-doc.noarch                                               5.4.111-1.el7.elrepo                                  elrepo-kernel
kernel-lt-headers.x86_64                                           5.4.111-1.el7.elrepo                                  elrepo-kernel
kernel-lt-tools.x86_64                                             5.4.111-1.el7.elrepo                                  elrepo-kernel
kernel-lt-tools-libs.x86_64                                        5.4.111-1.el7.elrepo                                  elrepo-kernel
kernel-lt-tools-libs-devel.x86_64                                  5.4.111-1.el7.elrepo                                  elrepo-kernel
kernel-ml-devel.x86_64                                             5.11.13-1.el7.elrepo                                  elrepo-kernel
kernel-ml-doc.noarch                                               5.11.13-1.el7.elrepo                                  elrepo-kernel
kernel-ml-headers.x86_64                                           5.11.13-1.el7.elrepo                                  elrepo-kernel
kernel-ml-tools.x86_64                                             5.11.13-1.el7.elrepo                                  elrepo-kernel
#安装  kernel-ml 内核
[[email protected] yum.repos.d]# yum --disablerepo="*" --enablerepo="elrepo-kernel" install kernel-ml

#查看内核安装目录:
[[email protected] yum.repos.d]# rpm -ql kernel-ml |less

#看到内核了:
[[email protected] yum.repos.d]# ls /boot/
config-3.10.0-327.el7.x86_64                             initrd-plymouth.img
config-5.11.13-1.el7.elrepo.x86_64                       symvers-3.10.0-327.el7.x86_64.gz
grub                                                     symvers-5.11.13-1.el7.elrepo.x86_64.gz
grub2                                                    System.map-3.10.0-327.el7.x86_64
initramfs-0-rescue-73130982d56a42eebae4cd3fd350eade.img  System.map-5.11.13-1.el7.elrepo.x86_64
initramfs-3.10.0-327.el7.x86_64.img                      vmlinuz-0-rescue-73130982d56a42eebae4cd3fd350eade
initramfs-3.10.0-327.el7.x86_64kdump.img                 vmlinuz-3.10.0-327.el7.x86_64
initramfs-5.11.13-1.el7.elrepo.x86_64.img                vmlinuz-5.11.13-1.el7.elrepo.x86_64             (新的内核)
initramfs-5.11.13-1.el7.elrepo.x86_64kdump.img

缓存

[root10:31 AMcentos7 ]#ll  /var/cache/yum/x86_64/7/
total 64
drwxr-xr-x. 4 root root 4096 Apr 30 09:08 base
drwxr-xr-x  4 root root 4096 Apr 30 09:39 elrepo
drwxr-xr-x  4 root root 4096 Apr 30 09:33 elrepo-kernel
drwxr-xr-x. 4 root root 4096 Apr 30 09:08 epel
drwxr-xr-x  4 root root 4096 Apr 29 23:10 Epel
drwxr-xr-x  4 root root  156 Apr 30 08:11 epel-debuginfo
drwxr-xr-x  4 root root 4096 Apr 30 08:11 epel-source
drwxr-xr-x  4 root root 4096 Apr 30 08:11 epel-testing
drwxr-xr-x  4 root root 4096 Apr 30 08:11 epel-testing-debuginfo
drwxr-xr-x  4 root root 4096 Apr 30 08:11 epel-testing-source
drwxr-xr-x. 4 root root 4096 Apr 30 09:08 extras
drwxr-xr-x  4 root root 4096 Apr 30 09:57 extras_wanghua_2021_04_29
drwxr-xr-x  4 root root 4096 Apr 30 08:19 huawei-epel
drwxr-xr-x  4 root root 4096 Apr 30 08:19 mariadb
-rw-r--r--  1 root root  321 Apr 30 10:16 timedhosts
-rw-r--r--  1 root root  399 Apr 30 00:23 timedhosts.txt
drwxr-xr-x  4 root root  156 Apr 30 09:56 update_2021_04_30
drwxr-xr-x. 4 root root 4096 Apr 30 09:08 updates
drwxr-xr-x  4 root root  156 Apr 30 09:57 update_wanghua_2021_04_30

[root10:32 AMcentos7 ]#du -sh $_
599M    /var/cache/yum/x86_64/7/
#清空缓存:
[root10:36 AMcentos7 ]#yum clean all

yum 日志

/var/log/yum.log 
            centos8 是/var/log/dnf.log
/var/log/anaconda/packaging.log 

包组管理

#列出所有的包组
[root11:00 AMcentos7 ]#yum grouplist
或者
[root11:18 AMcentos7 ]#yum group list
yum     groupinfo    包组   (查看包组信息)

#安装带图形的包
[root11:19 AMcentos7 ]#yum groupinstall "Server with GUI"    加双引号表示是一个包

init   5

#卸载包组:
yum  groupremove  

删除rpm包以后的救援


[root11:02 AMcentos7 ]#rpm -e rpm  --nodeps
[root11:03 AMcentos7 ]#rpm -a
-bash: /usr/bin/rpm: No such file or directory
进入到救援模式
mkdir /mnt/cdrom
mount  /dev/sr0   /mnt/cdrom
rmp -ivh     /mnt/cdrom/Packages/rpm-4.11.3-40.el7.x86_64.rpm  --root=/mnt/sysimage
reboot

#因为此时的根不是真正的更,要声明根,让包安装在真正的根下

私有仓库的安装

#以centos8为例子
服务端的配置
1.关闭seLinux  防火墙  
2.开启httpd服务(服务端和客服端都开通httpd服务)
3.挂载光盘 (一块光盘可以挂载到多个挂载点上)
4.服务端配置: 首先保障服务器extras源,我看看自己服务器的仓库,我安装了四个仓库
mount   /dev/sr0    /var/www/html/centos/8
[root01:48 PMcentos8 /etc/yum.repos.d]#cat wanghua-8.repo 
[base]
name=BaseOS
baseurl=file:///msic/cd/BaseOS
    https://mirrors.aliyun.com/centos/8/BaseOS/x86_64/os/
    https://mirrors.huaweicloud.com/centos/8/BaseOS/x86_64/os/
gpgcheck=0

[epel]
name=Epel
baseurl=https://mirrors.aliyun.com/epel/$releasever/Everything/$basearch/           
         https://mirrors.huaweicloud.com/epel/8/Everything/x86_64/
gpgcheck=0

[AppStream]
name=AppStream
baseurl=file:///msic/cd/AppStrem
    https://mirrors.aliyun.com/centos/8/AppStream/x86_64/os/
        https://mirrors.huaweicloud.com/centos/8/BaseOS/x86_64/os/
gpgcheck=0

[extras]
name=Extras
baseurl=https://mirrors.aliyun.com/centos/$releasever/extras/$basearch/os/
        https://mirrors.huaweicloud.com/centos/8/extras/x86_64/os/

5.创建目录,以网络的extras为基础,将其拷贝到我的/var/www/html/centos下               
[root12:26 PMcentos8 /var/www/html/centos]#mkdir extras  创建extras目录
[root12:59 PMcentos8 /var/www/html/centos]#dnf reposync --repoid=extras  --download-metadata   -p /var/www/html/centos

       --repoid=extras 依照服务器的自己extras源
          --download-metadata  下载源数据

6.以网络的extras为基础,将其拷贝自己 /var/www/html/ 目录中, 首先自己要安装了epel源
epel源光盘上没有,特殊.默认只下载包,不下载元数据,确认服务器上是否有epel源仓库 
 --download-metadata指的是下载的元数据
[[email protected] backup]#dnf reposync --repoid=epel --download-metadata  -p /var/www/html/

=================================================================================================
=================================================================================================
#客服端配置:
[root11:57 AMcentos8 /etc/yum.repos.d]#vim client.repo 
[base]
name=base
baseurl=http://10.0.0.8/centos/8/BaseOS
gpgkey=/etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

[AppStrea]
name=AppStream
baseurl=http://10.0.0.8/centos/8/AppStream/

[extras]
name=extras
baseurl=http://10.0.0.8/centos/extras/

[epel]
name=epel
baseurl=http://10.0.0.8/epel/
gpgkey=https://mirrors.aliyun.com/epel/RPM-GPG-KEY-EPEL-8

#配置完成以后,客服端基于extras还可以安装 epel-release 包
[root01:19 PMcentos8 /etc/yum.repos.d]#yum install epel-release.noarch 
#客服端再次查看自己的仓库发现多了包:
[root01:19 PMcentos8 /etc/yum.repos.d]#yum repolist 
repo id                                                                  repo name
AppStrea                                                                 AppStream
base                                                                     base
epel                                                                     Extra Packages for Enterprise Linux 8 - x86_64
epel-modular                                                             Extra Packages for Enterprise Linux Modular 8 - x86_64
extras                                                                   extras

----------------------------------------------------------------------------------------------------------------

扫码领视频副本.gif

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号