局域网远程yum源制作

 操作系统:centos7.4
 ​
 资源: CentOS-7-x86_64-DVD-1708.iso镜像
 实验服务器两台:
 ​
 192.168.246.170  (作为vsftpd服务端)
 ​
 192.168.246.169  (客户端)
  
 首先测试两台主机可否ping通
  
 在192.168.246.170上操作
 [root@192 ~]# ping 192.168.246.169
 PING 192.168.246.169 (192.168.246.169) 56(84) bytes of data.
 64 bytes from 192.168.246.169: icmp_seq=1 ttl=64 time=0.644 ms
 [root@192 ~]# systemctl stop firewalld
 [root@192 ~]# setenforce 0  #关闭selinux
 ​
 在192.168.246.169上操作:
 [root@linux-server ~]# ping 192.168.246.170
 PING 192.168.246.170 (192.168.246.170) 56(84) bytes of data.
 64 bytes from 192.168.246.170: icmp_seq=1 ttl=64 time=0.374 ms
 [root@linux-server ~]# systemctl stop firewalld
 [root@linux-server ~]# setenforce 0
 ​
 ==========================================================
 在192.168.246.170上操作---制作本地yum源,作为yum服务端
 ​
 将CentOS-7-x86_64-DVD-1708.iso 上传到/opt目录下
 ​
 [root@192 ~]# mkdir /opt/yum-iso   #创建挂载点
 ​
 [root@192 ~]# mount /opt/CentOS-7-x86_64-DVD-1708.iso /opt/yum-iso/
 ​
 [root@192 ~]# yum install -y vsftpd
 ​
 [root@192 ~]# systemctl start vsftpd
 ​
 [root@192 ~]# cp -r /opt/yum-iso/* /var/ftp/pub/
 ​
 [root@192 ~]# cd /var/ftp/
 ​
 [root@192 ftp]# yum install -y createrepo
 ​
 [root@192 ftp]# createrepo pub/
 ​
 [root@192 ftp]# cd /etc/yum.repos.d/
 [root@192 yum.repos.d]# vim myyum.repo
 [ftpYum]
 name=ftpYum
 baseurl=file:///opt/yum-iso
 enabled=1
 gpgcheck=0
 [root@192 yum.repos.d]# yum clean all
 [root@192 yum.repos.d]# yum makecache
 [root@192 yum.repos.d]# yum repolist 
 ===================================================================
 yum客户端
 在192.168.246.169上操作:
 [root@linux-server ~]# cd /etc/yum.repos.d/
 [root@linux-server yum.repos.d]# vim my.repo
 [ftpYum]
 name=centos
 baseurl=ftp://192.168.246.170/pub
 enabled=1
 gpgcheck=0
 [root@linux-server yum.repos.d]# yum clean all
 [root@linux-server yum.repos.d]# yum makecache
 [root@linux-server yum.repos.d]# yum repolist
已标记关键词 清除标记