CentOS 8挂载本地源
创始人
2024-11-12 01:10:03
0

CentOS 8挂载本地源

  • 1.虚拟机连接centos镜像
  • 2.系统查看centos镜像是否在连接上
  • 3. 挂载ISO镜像
  • 4.配置YUM源
    • 1. 备份现有YUM源配置
    • 2. 创建新的YUM源配置文件
    • 3. 清理YUM缓存并重新生成
  • 5.验证YUM源

1.虚拟机连接centos镜像

在这里插入图片描述

2.系统查看centos镜像是否在连接上

[root@localhost ~]# lsblk  NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT sda           8:0    0   30G  0 disk  ├─sda1        8:1    0  600M  0 part /boot/efi ├─sda2        8:2    0    1G  0 part /boot └─sda3        8:3    0 28.4G  0 part    ├─cl-root 253:0    0 56.4G  0 lvm  /   └─cl-swap 253:1    0    2G  0 lvm  [SWAP] sdb           8:16   0   30G  0 disk  └─cl-root   253:0    0 56.4G  0 lvm  / sr0          11:0    1 10.1G  0 rom  #centos镜像 

3. 挂载ISO镜像

[root@localhost ~]# mount /dev/sr0 /mnt/ mount: /mnt: WARNING: device write-protected, mounted read-only. [root@localhost ~]# cd /mnt/ [root@localhost mnt]# ls AppStream  BaseOS  EFI  images  isolinux  LICENSE  media.repo  TRANS.TBL 

4.配置YUM源

1. 备份现有YUM源配置

为了避免冲突,建议先备份现有的YUM源配置文件。这些文件通常位于/etc/yum.repos.d/目录下:

[root@localhost mnt]# cd /etc/yum.repos.d/ [root@localhost yum.repos.d]# ls centos  CentOS-Base.repo [root@localhost yum.repos.d]# mv CentOS-Base.repo  CentOS-Base.repo.bake  

2. 创建新的YUM源配置文件

使用文本编辑器(如vi或vim)创建新的YUM源配置文件。假设你创建的文件名为local.repo:

vi /etc/yum.repos.d/local.repo #添加以下内容: [BaseOS] name=CentOS-$releasever - BaseOS   baseurl=file:///mnt/BaseOS       enabled=1   gpgcheck=0      [AppStream]   name=CentOS-$releasever - AppStream baseurl=file:///mnt/AppStream        enabled=1   gpgcheck=0 

3. 清理YUM缓存并重新生成

[root@localhost yum.repos.d]# yum clean all  18 文件已删除 [root@localhost yum.repos.d]# yum makecache  CentOS-8 - BaseOS                                       193 kB/s | 2.6 MB     00:13     CentOS-8 - AppStream                                    1.5 MB/s | 7.5 MB     00:05     元数据缓存已建立。 [root@localhost yum.repos.d]#   

5.验证YUM源

[root@localhost yum.repos.d]# yum repolist 仓库 id                                仓库名称 AppStream                              CentOS-8 - AppStream BaseOS                                 CentOS-8 - BaseOS [root@localhost yum.repos.d]# yum install nginx -y 上次元数据过期检查:0:01:03 前,执行于 2024年08月02日 星期五 23时27分11秒。 依赖关系解决。 ========================================================================================  软件包                   架构   版本                                   仓库       大小 ======================================================================================== 安装:  nginx                    x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream 570 k 安装依赖关系:  nginx-all-modules        noarch 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream  23 k  nginx-filesystem         noarch 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream  24 k  nginx-mod-http-image-filter                           x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream  35 k  nginx-mod-http-perl      x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream  45 k  nginx-mod-http-xslt-filter                           x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream  33 k  nginx-mod-mail           x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream  64 k  nginx-mod-stream         x86_64 1:1.14.1-9.module_el8.0.0+184+e34fea82 AppStream  85 k 启用模块流:  nginx                           1.14                                                    事务概要 ======================================================================================== 安装  8 软件包  总计:881 k 安装大小:2.0 M 下载软件包: 运行事务检查 事务检查成功。 运行事务测试 事务测试成功。 运行事务   准备中  :                                                                                                                           1/1    运行脚本: nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch                                                            1/8    安装    : nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch                                                            1/8    安装    : nginx-mod-http-image-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                 2/8    运行脚本: nginx-mod-http-image-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                 2/8    安装    : nginx-mod-http-perl-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                         3/8    运行脚本: nginx-mod-http-perl-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                         3/8    安装    : nginx-mod-http-xslt-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                  4/8    运行脚本: nginx-mod-http-xslt-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                  4/8    安装    : nginx-mod-mail-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                              5/8    运行脚本: nginx-mod-mail-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                              5/8    安装    : nginx-all-modules-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch                                                           6/8    安装    : nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                                       7/8    运行脚本: nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                                       7/8    安装    : nginx-mod-stream-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                            8/8    运行脚本: nginx-mod-stream-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                            8/8    验证    : nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                                       1/8    验证    : nginx-all-modules-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch                                                           2/8    验证    : nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch                                                            3/8    验证    : nginx-mod-http-image-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                 4/8    验证    : nginx-mod-http-perl-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                         5/8    验证    : nginx-mod-http-xslt-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                  6/8    验证    : nginx-mod-mail-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                              7/8    验证    : nginx-mod-stream-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                            8/8   已安装:   nginx-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                                                        nginx-all-modules-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch                                                                            nginx-filesystem-1:1.14.1-9.module_el8.0.0+184+e34fea82.noarch                                                                             nginx-mod-http-image-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                                  nginx-mod-http-perl-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                                          nginx-mod-http-xslt-filter-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                                   nginx-mod-mail-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                                               nginx-mod-stream-1:1.14.1-9.module_el8.0.0+184+e34fea82.x86_64                                                                            完毕! [root@localhost yum.repos.d]#   

相关内容

热门资讯

透视绝活!wepoker看底牌... 透视绝活!wepoker看底牌,wejoker手机版透视脚本(脚本)详细教程(切实真的有挂)-哔哩哔...
透视曝光!wpk私人辅助(透视... 透视曝光!wpk私人辅助(透视)wpk德州局怎么透视,教程指南(今日头条)-哔哩哔哩1、许多玩家不知...
透视要领!wepoker轻量版... 透视要领!wepoker轻量版辅助,wepoker辅助插件功能(脚本)关于教程(都是是真的挂)-哔哩...
透视分享!wpk透视工作室(透... 透视分享!wpk透视工作室(透视)wpk透视最怕三个东西,教程策略(有挂方法)-哔哩哔哩1、上手简单...
透视大纲!wepoker私人局... 透视大纲!wepoker私人局规律,wepoker代打辅助机器人(脚本)辅助教程(一直是真的挂)-哔...
透视普及!wpk安卓下载辅助(... 透视普及!wpk安卓下载辅助(透视)wpk模拟器是什么,教程烘培(真的有挂)-哔哩哔哩透视普及!wp...
透视模块!wepoker透视脚... 透视模块!wepoker透视脚本免费,wepoker俱乐部辅助(脚本)教你教程(好像有挂)-哔哩哔哩...
透视有挂!wpk插件(透视)w... 透视有挂!wpk插件(透视)wpk透视辅助,教程绝活儿(有挂秘诀)-哔哩哔哩一、wpk透视辅助游戏安...
透视诀窍!wepoker插件下... 透视诀窍!wepoker插件下载,wepoker轻量版书签(脚本)解迷教程(竟然是有挂)-哔哩哔哩w...
透视必备!wpk透视辅助下载(... 透视必备!wpk透视辅助下载(透视)wpk官网下载链接,教程方式(有挂头条)-哔哩哔哩亲,关键说明,...