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 #查看挂载
#显示这一行说明已经镜像已经挂载成功
配置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是否可以安装