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

相关内容

热门资讯

广东雀神智能插件安装包,长春科... 广东雀神智能插件安装包,长春科乐作弊,创思维激k辅助器规律广东雀神智能插件安装包辅助器中分为三种模型...
透视私人局!德普之星有透视辅助... 透视私人局!德普之星有透视辅助吗,德普之星透视辅助,曝光教程(有挂介绍);致您一封信;亲爱德普之星有...
透视了解!aapoker破解侠... 透视了解!aapoker破解侠是真的吗,aapoker怎么拿好牌,黑科技教程(有挂插件)1、许多玩家...
透视黑科技!wepoker有插... 透视黑科技!wepoker有插件吗(透视)原来是有挂(必赢方法)1、游戏颠覆性的策略玩法,独创攻略技...
透视安装!德普之星怎么开辅助,... 透视安装!德普之星怎么开辅助,德普之星透视,第三方教程(有挂工具)1、金币登录送、破产送、升级送、活...
雀神智能插件安装价格,微信随意... 雀神智能插件安装价格,微信随意玩辅助器有开挂吗,新广西老友麻将开挂攻略小薇(透视辅助)致您一封信;亲...
透视存在!aapoker辅助怎... 透视存在!aapoker辅助怎么用,aapoker辅助器是真的吗,透牌教程(有挂脚本)1、打开软件启...
透视数据!wepoker破解器... 透视数据!wepoker破解器激活码(透视)果然真的有挂(扑克教程)1、游戏颠覆性的策略玩法,独创攻...
透视计算!德普之星私人局透视,... 透视计算!德普之星私人局透视,德扑之心免费透视,攻略教程(有挂揭秘)是一款可以让一直输的玩家,快速成...
广东雀神智能插件试用,好友赣南... 广东雀神智能插件试用,好友赣南插件,雀神广东智能插件价格揭秘1、点击下载安装,广东雀神智能插件插件透...