Centos搭建共享yum源

环境部署:
1、准备两台及两台以上的机器
2、关闭selinux和iptables或者是firewalld
3、保证两台机器在同一网段,并且可以互通

部署过程:
1、将镜像光盘或者是镜像文件进行挂载

          mkdir /mnt/share
          mount -t iso9960 /XXX.iso /mnt/share

2、搭建本地yum源

          [root@centos yum.repos.d]# vim myshare.repo
          [myrepo]
          name=myrepo
          baseurl=file:///mnt/share
          gpgcheck=0
          enable=1

3、安装httpd服务并且启动

         yum -y install httpd
         systemctl start httpd
         systemctl status httpd

使用本地浏览器测试一下,本地浏览器输入http://192.168.5.21/mnt/share

4、客户端的配置

新建yum源文件,新建一个文件夹,将原有的yum源文件全部移动进去,使现有的yum源生效

		 [root@centos yum.repos.d]# vim /etc/yum.repos.d/yumshare.repo
         [yumshare]
         name=yumshare
         baseurl=http://192.168.5.21/mnt/share/
         gpgcheck=0
         enable=1

然后执行:
yum clean all
yum makecache
yum list
就可以使用了

猜你喜欢

转载自blog.csdn.net/weixin_43466473/article/details/88836642