OS: CentOS8本地源配置过程

CentOS8-stream 本地源配置

 


一、配置软件仓库(软件仓库位置:/media/CentOS)


1、建立目录 “CentOS” 。(mkdir -p /media/CentOS)


2、挂载光盘“CentOS-Stream-8-x86_64-20210506-dvd1.iso”。


3、将光盘文件夹“AppStream”、“BaseOS” 复制到 “/media/CentOS”目录。
    (cp    -r     AppStream/    BaseOS/           /media/CentOS

 

二、配置软件仓库文件(/etc/yum.repos.d/)


1、查看本地源配置文件:


[root@centos yum.repos.d]# cat CentOS-Stream-Media.repo
# CentOS-Stream-Media.repo
#
# You can use this repo to install items directly off the installation media.
# Verify your mount point matches one of the below file:// paths.

[media-baseos]
name=CentOS Stream $releasever - Media - BaseOS
baseurl=file:///media/CentOS/BaseOS
file:///media/cdrom/BaseOS
file:///media/cdrecorder/BaseOS
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial

[media-appstream]
name=CentOS Stream $releasever - Media - AppStream
baseurl=file:///media/CentOS/AppStream
file:///media/cdrom/AppStream
file:///media/cdrecorder/AppStream
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[root@centos yum.repos.d]#


2、开启仓库,将 “enabled=0”, 改为“enabled=1”

 

三、测试本地源仓库:

 

[root@centos yum.repos.d]# dnf clean all
13 files removed
[root@centos yum.repos.d]# dnf makecache
CentOS Stream 8 - Media - BaseOS 68 MB/s | 2.5 MB 00:00
CentOS Stream 8 - Media - AppStream 72 MB/s | 7.1 MB 00:00
Last metadata expiration check: 0:00:01 ago on Sat 22 May 2021 03:31:48 PM CST.
dnf Metadata cache created.
[root@centos yum.repos.d]# dnf grouplist
Last metadata expiration check: 0:00:13 ago on Sat 22 May 2021 03:31:48 PM CST.
Available Environment Groups:
Server
Minimal Install
Workstation
Custom Operating System
Virtualization Host
Installed Environment Groups:
Server with GUI
Installed Groups:
Container Management
Headless Management
Available Groups:
Legacy UNIX Compatibility
Development Tools
.NET Core Development
Graphical Administration Tools
Network Servers
RPM Development Tools
Scientific Support
Security Tools
Smart Card Support
System Tools
[root@centos yum.repos.d]#

 

 

本文由lnlidawei(https://www.cnblogs.com/lnlidawei)原创或整理,转载请注明出处。
原文地址:https://www.cnblogs.com/lnlidawei/p/14799050.html