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]#   

相关内容

热门资讯

推荐几款新版!德扑之星ai代打... 《推荐几款新版!德扑之星ai代打可以弄,德州ai辅助器算外挂,教你攻略(有挂总结)-哔哩哔哩》 德扑...
第八分钟指导!wpk透视脚本链... 第八分钟指导!wpk透视脚本链接,aapoker怎么设置提高好牌几率(透视)2025版教程(有挂详情...
传递经验!wepoke到底有挂... 传递经验!wepoke到底有挂,we poke有挂,解密教程(有挂存在)-哔哩哔哩;wepoke到底...
八分钟精通!wejoker私人... 八分钟精通!wejoker私人辅助软件,wpk透视挂是真的吗(透视)安装教程(有挂技术)1、每一步都...
一分钟揭秘!wopoker系统... 一分钟揭秘!wopoker系统套路,aapoker系统机制,专业教程(有挂方略)-哔哩哔哩;人气非常...
六分钟私人局!pokemmo免... 六分钟私人局!pokemmo免费脚本,wepoker透视底牌(透视)扑克教程(竟然有挂)1、全新机制...
2024版攻略!wepoke用... 2024版攻略!wepoke用模拟器,微扑克有机器人,普及教程(有挂技巧)-哔哩哔哩;大家肯定在之前...
第3分钟领会!wepokerp... 第3分钟领会!wepokerplus脚本,wepoker有透视功能吗(透视)安装教程(揭秘有挂)1、...
六分钟了解!wepoke有机器... 六分钟了解!wepoke有机器人,wepoke透技巧,技巧教程(揭秘有挂)-哔哩哔哩;wepoke有...
五分钟了解!pokemmo内置... 五分钟了解!pokemmo内置修改器,来玩德州破解器(透视)我来教教你(有挂教学)1.pokemmo...