栏目分类:
子分类:
返回
名师互学网用户登录
快速导航关闭
当前搜索
当前分类
子分类
实用工具
热门搜索
名师互学网 > IT > 系统运维 > 运维 > Linux

Linux配置本地YUM源(RHEL8)

Linux 更新时间: 发布时间: IT归档 最新发布 模块sitemap 名妆网 法律咨询 聚返吧 英语巴士网 伯小乐 网商动力

Linux配置本地YUM源(RHEL8)

【RHEL8.1】

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

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

enbaled=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 软件包名

转载请注明:文章转载自 www.mshxw.com
本文地址:https://www.mshxw.com/it/748386.html
我们一直用心在做
关于我们 文章归档 网站地图 联系我们

版权所有 (c)2021-2022 MSHXW.COM

ICP备案号:晋ICP备2021003244-6号