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用户来说,可以直接用镜像,如图所示
安装包下载地址:
Index of /centos/8-stream/isos/x86_64/
File Name File Size Date Parent directory/ - - CHECKSUM 712.0 B 2023-04-04 23:16 CentOS-Stream-8-20230404.0-x86_64-boot.iso 912.0 MB 2023-04-04 22:24 CentOS-Stream-8-20230404.0-x86_64-boot.iso.manifest 635.0 B 2023-04-04 22:27 CentOS-Stream-8-20230404.0-x86_64-dvd1.iso 10.9 GB 2023-04-04 22:41 CentOS-Stream-8-20230404.0-x86_64-dvd1.iso.manifest 507.0 KB 2023-04-04 22:41 CentOS-Stream-8-x86_64-latest-boot.iso 912.0 MB 2023-04-04 22:24 CentOS-Stream-8-x86_64-latest-boot.iso.manifest 635.0 B 2023-04-04 22:27 CentOS-Stream-8-x86_64-latest-dvd1.iso 10.9 GB 2023-04-04 22:41 CentOS-Stream-8-x86_64-latest-dvd1.iso.manifest 507.0 KB 2023-04-04 22:41 http://mirrors.aliyun.com/centos/8-stream/isos/x86_64/
然后进入目录,只要能够列出如下的文件说明挂载成功。
3、 进入/etc/yum.repos.d目录
4、编辑 CentOS-Linux-Media.repo
文件按照如下的方式修改,修改有6个地方
baseurl ,指定挂载的目录下的BaseOS 以及AppStream目录
gpgcheck 即不校验
enabled 启用该镜像
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
7、验证结果
7、开机自动挂盘
为了避免重启后,镜像源无法访问的问题。我们需要将挂盘的操作配置在我们的/etc/fstab文件中
7.1 使用mount -l 查看我们挂的盘的信息
从上面可以得到5个信息
/dev/cdrom /mnt/cdrom iso9660 defaults 0 0
其实也可以写成这样
/dev/cdrom /mnt/cdrom autodefaults 0 0
设备名是我经过链接过的,这里可以填写sr0就好了,但是我还是写/dev/cdrom
7.2 将信息配置入/etc/fstab文件中
为人:谦逊、激情、博学、审问、慎思、明辨、 笃行
学问:纸上得来终觉浅,绝知此事要躬行
为事:工欲善其事,必先利其器。
态度:道阻且长,行则将至;行而不辍,未来可期
.....................................................................
------- 桃之夭夭,灼灼其华。之子于归,宜其室家。 ---------------
------- 桃之夭夭,有蕡其实。之子于归,宜其家室。 ---------------
------- 桃之夭夭,其叶蓁蓁。之子于归,宜其家人。 ---------------
=====================================================================
* 博客文章部分截图及内容来自于学习的书本及相应培训课程以及网络其他博客,仅做学习讨论之用,不做商业用途。
* 如有侵权,马上联系我,我立马删除对应链接。 * @author Alan -liu * @Email no008@foxmail.com
转载请标注出处! ✧*꧁一品堂.技术学习笔记꧂*✧. ---> https://www.cnblogs.com/ios9/
学问:纸上得来终觉浅,绝知此事要躬行
为事:工欲善其事,必先利其器。
态度:道阻且长,行则将至;行而不辍,未来可期
.....................................................................
------- 桃之夭夭,灼灼其华。之子于归,宜其室家。 ---------------
------- 桃之夭夭,有蕡其实。之子于归,宜其家室。 ---------------
------- 桃之夭夭,其叶蓁蓁。之子于归,宜其家人。 ---------------
=====================================================================
* 博客文章部分截图及内容来自于学习的书本及相应培训课程以及网络其他博客,仅做学习讨论之用,不做商业用途。
* 如有侵权,马上联系我,我立马删除对应链接。 * @author Alan -liu * @Email no008@foxmail.com
转载请标注出处! ✧*꧁一品堂.技术学习笔记꧂*✧. ---> https://www.cnblogs.com/ios9/