/**PageBeginHtml Block Begin **/ /***自定义返回顶部小火箭***/ /*生成博客目录的JS 开始*/ /*生成博客目录的JS 结束*/

Centos8 配置本地yum源

Centos8 配置本地yum源


centos8发行版通过 BaseOS 和应用流 (AppStream) 仓库发布,这篇文章主要介绍了CentOS8 配置本地yum源的详细教程,需要的朋友可以参考下

centos8发行版通过 BaseOS 和应用流 (AppStream) 仓库发布,AppStream 是对传统 rpm 格式的全新扩展,为一个组件同时提供多个主要版本

centos8 自带封装了NGINX,这篇文章给大家介绍CentOS8 配置本地yum源,具体内容如下所示:



1、创建目录

mkdir /mnt/cdrom

2.挂载你的cdrom文件。

2、光驱方式

采用光驱的方式,对于vmware用户来说,可以直接用镜像,如图所示

image


安装包下载地址:


Index of /centos/8-stream/isos/x86_64/

http://mirrors.aliyun.com/centos/8-stream/isos/x86_64/






然后进入目录,只要能够列出如下的文件说明挂载成功。

image


3、 进入/etc/yum.repos.d目录


image


4、编辑 CentOS-Linux-Media.repo


文件按照如下的方式修改,修改有6个地方
baseurl ,指定挂载的目录下的BaseOS 以及AppStream目录
gpgcheck 即不校验
enabled 启用该镜像

image

5、屏蔽默认的镜像

vim进入如下的3个文件,然后修改enabled=0;

大概如下所示 :如果日后希望使用网络的方式安装包,记得重新把这里修改为1 即重新启用。

[root@192 yum.repos.d]# vi CentOS-Linux-AppStream.repo
[root@192 yum.repos.d]# cat CentOS-Linux-AppStream.repo
# CentOS-Linux-AppStream.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client.  You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.

[appstream]
name=CentOS Linux $releasever - AppStream
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[root@192 yum.repos.d]# vi CentOS-Linux-BaseOS.repo
[root@192 yum.repos.d]# cat CentOS-Linux-BaseOS.repo
# CentOS-Linux-BaseOS.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client.  You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.

[baseos]
name=CentOS Linux $releasever - BaseOS
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
[root@192 yum.repos.d]# vi CentOS-Linux-Extras.repo
[root@192 yum.repos.d]# cat CentOS-Linux-Extras.repo
# CentOS-Linux-Extras.repo
#
# The mirrorlist system uses the connecting IP address of the client and the
# update status of each mirror to pick current mirrors that are geographically
# close to the client.  You should use this for CentOS updates unless you are
# manually picking other mirrors.
#
# If the mirrorlist does not work for you, you can try the commented out
# baseurl line instead.

[extras]
name=CentOS Linux $releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/$contentdir/$releasever/extras/$basearch/os/
gpgcheck=1
enabled=-
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial


6、清空cache,并重新创建cache

image

7、验证结果

image



7、开机自动挂盘

为了避免重启后,镜像源无法访问的问题。我们需要将挂盘的操作配置在我们的/etc/fstab文件中

7.1 使用mount -l 查看我们挂的盘的信息

image

从上面可以得到5个信息

/dev/cdrom /mnt/cdrom iso9660 defaults 0 0

其实也可以写成这样

/dev/cdrom /mnt/cdrom autodefaults 0 0

设备名是我经过链接过的,这里可以填写sr0就好了,但是我还是写/dev/cdrom

7.2 将信息配置入/etc/fstab文件中

image

posted @ 2023-04-07 13:45  一品堂.技术学习笔记  阅读(245)  评论(0编辑  收藏  举报