me小怪兽

导航

< 2025年3月 >
23 24 25 26 27 28 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31 1 2 3 4 5

统计

centos内网镜像挂载

 

centos挂载ISO镜像,配置yum源

由于内网无法访问网络,所以需先挂载centos7的ISO镜像,然后配置yum源安装编译所需要的依赖包

镜像下载地址:https://vault.centos.org/7.5.1804/isos/x86_64/CentOS-7-x86_64-DVD-1804.iso


创建ISO镜像存放目录并上传ISO镜像文件
上传镜像到/opt  
[root@localhost ~]# mount -o loop /opt/CentOS-7-x86_64-DVD-1804.iso /mnt 挂载镜像到/mnt
[root@localhost ~]# df -h   #查看挂载
1
#显示这一行说明已经镜像已经挂载成功
配置yum源:
[root@localhost ~]# mkdir /etc/yum.repos.d/yumbak 备份yum源

[root@localhost ~]# cd /etc/yum.repos.d 
[root@localhost ~]# mv *.repo yumbak/   #备份原有配置文件
[root@localhost ~]#  vim /etc/yum.repos.d/local.repo   #新建yum源

[local]
name=local
baseurl=file:///mnt   #此处写镜像挂载目录
gpgcheck=0
enabled=1

 

[root@localhost ~]#  yum clean all   #清空yum缓存
Loaded plugins: fastestmirror
Cleaning repos: centos7-iso
Cleaning up everything
Maybe you want: rm -rf /var/cache/yum, to also free up space taken by orphaned data from disabled or removed repos
Cleaning up list of fastest mirrors
[root@localhost ~]# yum makecache
[root@localhost ~]# yum -y install gcc  #尝试yum安装gcc是否可以安装

posted on   me小怪兽  阅读(1218)  评论(0编辑  收藏  举报

相关博文:
阅读排行:
· 分享4款.NET开源、免费、实用的商城系统
· 全程不用写代码,我用AI程序员写了一个飞机大战
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示