1、安装所需要的包,建立yum源
yum install yum-utils createrepo vsftpd -y
vi /etc/yum.repos.d/epel-centos7.repo
[epel-centos7]
name=CentOS-7-epel-source
baseurl=https://mirrors.aliyun.com/epel/7/x86_64/
gpgcheck=0
2、同步yum源
mkdir -p /var/ftp/epel-centos7/
reposync -n --repoid=epel-centos7 -p /var/ftp/epel-centos7/ #同步epel源到本地
reposync -p /rpms #同步所有源到本地
3、建立本地yum源,启动ftp服务
yum -y install createrepo
cd /var/ftp/epel-centos7/
createrepo .
systemctl start vsftpd
4、更新RPM包后执行
createrepo --update .
5、在客户机上建立repo文件
vi /etc/yum.repos.d/epel-centos7.repo
[epel-centos7]
name=epel-centos7
baseurl=ftp://192.168.2.106/epel-centos7/
enabled=1
gpgcheck=0