zoukankan      html  css  js  c++  java
  • Linux_配置本地YUM源(RHEL8)

    【RHEL8】

    Linux—RHEL8配置本地YUM 源,按照之前传统的配置本地YUM的方法肯定不行,在RHEL8版本的软件源发生了变化,在RHEL8版本的软件仓库分成了两部分:【AppStream】和【BaseOS】,所以我们在配置YUM 源的适合需要配置连个部分;具体来看操作吧!

    一、配置RHEL8本地源

    1、开启RHEL8的虚拟机

    [root@localhost ~]# cat /etc/system-release
    Red Hat Enterprise Linux release 8.1 (Ootpa)
     //首先确认一下,自己装的是RHEL8系统
    

    2、确认自己的镜像是否连接

     3、将本地的镜像源挂载到 /mnt上(/mnt是系统的临时挂载目录)

    [root@localhost ~]# mount /dev/sr0 /mnt/
    mount: /mnt: WARNING: device write-protected, mounted read-only.
    [root@localhost ~]# df -h
    文件系统               容量  已用  可用 已用% 挂载点
    devtmpfs               966M     0  966M    0% /dev
    tmpfs                  983M     0  983M    0% /dev/shm
    tmpfs                  983M  8.7M  974M    1% /run
    tmpfs                  983M     0  983M    0% /sys/fs/cgroup
    /dev/mapper/rhel-root   50G  2.0G   49G    4% /
    /dev/nvme0n1p1        1014M  156M  859M   16% /boot
    /dev/mapper/rhel-home   67G  511M   67G    1% /home
    tmpfs                  197M     0  197M    0% /run/user/0
    /dev/sr0               7.4G  7.4G     0  100% /mnt
     //出现最后一行的信息,说明已经挂载成功
    

     

    4、在 /etc/fstab 文件写入开机自动挂载

    [root@localhost ~]# echo '/dev/sr0 /mnt iso9660 defaults 0 0' >> /etc/fstab 
    [root@localhost ~]# cat /etc/fstab 
    
    #
    # /etc/fstab
    # Created by anaconda on Tue Jul 28 00:28:19 2020
    #
    # Accessible filesystems, by reference, are maintained under '/dev/disk/'.
    # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
    #
    # After editing this file, run 'systemctl daemon-reload' to update systemd
    # units generated from this file.
    #
    /dev/mapper/rhel-root   /                       xfs     defaults        0 0
    UUID=a9a8d47d-f331-4287-9d14-c9bb5598c1a4 /boot                   xfs     defaults        0 0
    /dev/mapper/rhel-home   /home                   xfs     defaults        0 0
    /dev/mapper/rhel-swap   swap                    swap    defaults        0 0
    /dev/sr0 /mnt iso9660 defaults 0 0
     //最后一行就是刚刚写入的开机自动挂载命令
    

     

    5、编辑本地软件仓库源

    [root@localhost ~]# ls /mnt/
    AppStream  BaseOS  EFI  EULA  extra_files.json  GPL  images  isolinux  media.repo  RPM-GPG-KEY-redhat-beta  RPM-GPG-KEY-redhat-release  TRANS.TBL
     //刚刚将RHEL8的镜像挂载到/mnt下,现在就回看到里面有AppStream和BaseOS这两个目录
    [root@localhost ~]# cd /etc/yum.repos.d/
    [root@localhost yum.repos.d]# vim dvd.repo 
    [root@localhost yum.repos.d]# cat dvd.repo 
    [BaseOS]
    name=BaseOS
    baseurl=file:///mnt/BaseOS
    gpgcheck=0
    enabled=1
    
    [AppStream]
    name=AppStream
    baseurl=file:///mnt/AppStream
    gpgcheck=0
    enabled=1
     //file:后面的文件名一定要跟/mnt下面的文件名一样
    

    6、清理缓存、建立元数据

    [root@localhost yum.repos.d]# yum clean all
    Updating Subscription Management repositories.
    Unable to read consumer identity
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    12 文件已删除
    [root@localhost yum.repos.d]# yum makecache
    Updating Subscription Management repositories.
    Unable to read consumer identity
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    BaseOS                                                                                                                                                       62 MB/s | 2.2 MB     00:00    
    AppStream                                                                                                                                                    88 MB/s | 5.6 MB     00:00    
    上次元数据过期检查:0:00:01 前,执行于 2020年07月28日 星期二 15时25分49秒。
    元数据缓存已建立。
    

     

    7、查看仓库

    [root@localhost yum.repos.d]# yum repolist all
    Updating Subscription Management repositories.
    Unable to read consumer identity
    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    上次元数据过期检查:0:00:59 前,执行于 2020年07月28日 星期二 15时25分49秒。
    仓库标识                                                                                仓库名称                                                                                 状态
    AppStream                                                                               AppStream                                                                                启用: 4,820
    BaseOS                                                                                  BaseOS                                                                                   启用: 1,661
    

     

    8、RHEL8版本,安装软件可以用YUM,也可以用dnf (注:yum 是 dnf 的一个软连接,yum和 dnf 在RHEL8中都可以使用)

    yum install -y 软件包名
    dnf install -y 软件包名
    yum remove -y 软件包名
    dnf remove -y 软件包名
    yum update -y 软件包名
    dnf update -y 软件包名
  • 相关阅读:
    centos7 go ENV 部署
    sock5客户端解密数据流
    sock5协议转换http协议工具polipo使用笔记(Centos7)
    【转】nc 使用说明
    前端移动框架Framework7入门
    Ext.NET-WebForm之TreePanel组件
    在VS2019创建WebForm程序,开个箱
    web认证
    ABP框架是怎么一回事呢?
    C#4并行计算
  • 原文地址:https://www.cnblogs.com/itwangqiang/p/13391401.html
Copyright © 2011-2022 走看看