[[email protected] ~]# iptables -F
[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# systemctl disable firewalld
[[email protected] ~]# setenforce 0
1配置基于HTTP协议的yum源服务器
#mkdir /media/cdrom
#mount /dev/cdrom /media/cdrom
yum -y install httpd
直接挂载 服务器 mkdir /var/www/html/centos
umount /dev/cdrom cp -r /media/cdrom/* /var/www/html/centos
mkdir /var/www/html/centos
mount /dev/cdrom/ /var/www/html/centos
systemctl start httpd
systemctl enable httpd
3配置基于FTP协议的yum 源服务器
#mkdir /media/cdrom
#mount /dev/cdrom /media/cdrom
yum -y install vsftpd*
直接挂载 服务器 mkdir /var/ftp/centos
umount /dev/cdrom cp -r /media/cdrom/* /var/ftp/centos
mkdir /var/ftp/centos
mount /dev/cdrom/ /var/ftp/centos
用户收集的其他软件包需要手工创建repodata数据文件和存放目录,工具createrepo(光盘已有)
mkdir /var/ftp/other //将软件包服务进来
cd /var/ftp/other
createrepo -g /var/ftp/centos/repodata/repomd.xml ./ //以现有的repodata目录为样板
ls -lh repodata
客户机操作
cd /etc/yum.repos.d
mkdir backup
mv *.repo backup
vim /etc/yum.repos.d/centos.repo
cd
[ftp-media]
name=ftp-media
baseurl=ftp://192.168.30.24/centos 指定服务器的IP地址
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
[other]
name=other rpm Packages
baseurl=ftp://192.168.30.24/other
enabled=1
gpgcheck=0
~
客户机指定yum.repos.d
安装vsftpd
首先搭建好yum本地仓库,安装yum -y install vsftpd
关闭防火墙
关闭selinux
cd /etc/yum.repos.d
rm -rf CentOS-Media.repo 删除之前的仓库信息
ls
cp bak/centos.repo ./ 把vsftpd导入进来
yum -y clean all
yum makecache
原文地址:https://www.cnblogs.com/zc1741845455/p/10921281.html