系统相关
首页 > 系统相关> > redhat9中配置yum仓库

redhat9中配置yum仓库

作者:互联网

 

1、查看系统

[root@PC1 home]# cat /etc/redhat-release 
Red Hat Enterprise Linux release 9.0 (Plow)

 

2、测试yum仓库

[root@PC1 home]# yum install httpd
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.

Error: There are no enabled repositories in "/etc/yum.repos.d", "/etc/yum/repos.d", "/etc/distro.repos.d".

 

 

 

3、创建挂载点

[root@PC1 home]# mkdir -p /media/cdrom

 

4、进入/etc/yum.repos.d/目录,列出yum仓库配置文件:

[root@PC1 home]# cd /etc/yum.repos.d/
[root@PC1 yum.repos.d]# ls
redhat.repo

 

5、使用vim编辑器编辑redhat.repo文件,保存退出:

[root@PC1 yum.repos.d]# vim redhat.repo
[BaseOS]
name=BaseOS
baseurl=file:///media/cdrom/BaseOS
gpgcheck=0
enabled=1

[AppStream]
name=AppStream
baseurl=file:///media/cdrom/AppStream
gpgcheck=0
enabled=1

 

 

 

6、设置开启自启

[root@PC1 yum.repos.d]# vim /etc/fstab       ## 最后一行增加如下内容,保存退出
/dev/cdrom      /media/cdrom    iso9660 defaults        0       0

 

 

 

7、查看挂载情况

[root@PC1 yum.repos.d]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        1.8G     0  1.8G   0% /dev
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           740M  9.6M  730M   2% /run
/dev/nvme0n1p2  100G  4.5G   96G   5% /
/dev/nvme0n1p5  392G  2.8G  390G   1% /data
/dev/nvme0n1p1  4.0G  278M  3.8G   7% /boot
tmpfs           370M  128K  370M   1% /run/user/0
/dev/sr0        8.0G  8.0G     0 100% /run/media/root/RHEL-9-0-0-BaseOS-x86_64

 

 8、挂载

[root@PC1 yum.repos.d]# mount -a
mount: /media/cdrom: WARNING: source write-protected, mounted read-only.

 

9、查看挂载情况

[root@PC1 yum.repos.d]# df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        1.8G     0  1.8G   0% /dev
tmpfs           1.9G     0  1.9G   0% /dev/shm
tmpfs           740M  9.6M  730M   2% /run
/dev/nvme0n1p2  100G  4.5G   96G   5% /
/dev/nvme0n1p5  392G  2.8G  390G   1% /data
/dev/nvme0n1p1  4.0G  278M  3.8G   7% /boot
tmpfs           370M  128K  370M   1% /run/user/0
/dev/sr0        8.0G  8.0G     0 100% /media/cdrom

 

10、测试yum仓库

[root@PC1 yum.repos.d]# yum install httpd

 

标签:仓库,repos,PC1,dev,etc,yum,root,redhat9
来源: https://www.cnblogs.com/liujiaxin2018/p/16331458.html