**
一、 环境需要
1、2台centos A和B
2、配置两台主机的ip
3、关闭防火墙(2台)
[root@localhost ~]# systemctl stop firewalld [root@localhost ~]# systemctl disable firewalld
关闭selinux
[root@localhost ~]# vim /etc/sysconfig/selinux
把SELINUX=enforcing改为SELINUX=diaabled如图
二、 安装主机A安装yum
1、 挂载镜像
1.1先在opt下创建centos目录
[root@localhost ~]# mdkir /opt/centos [root@localhost ~]# mdkir /opt/yum
**1.2把镜像挂载到/opt/centos 下**
[root@localhost ~]# mount -o loop /dev/cdrom /opt/centos
1.3配置yum源
备份yum源
[root@localhost ~]# mv /etc/yum.repos.d/* /opt/yum
写配置文件 [root@localhost ~]# vim /etc/yum.repos.d/local.repo [root@localhost ftp]# cat /etc/yum.repos.d/local.repo [centos] name=centos baseurl=file:///opt/centos gpgcheck=0 enabled=1 [root@localhost ftp]# yum makecache [root@localhost ftp]# yum repolist
成功。
三、 主机A安装ftp服务
*1、 下载vsftpd
[root@localhost ftp]# yum -y install vsftpd
**2、修改配置文件**
[root@ localhost ~]# vi /etc/vsftpd/vsftpd.conf 添加anon_root=/opt
保存退出
3、启动
[root@localhost ftp]# systemctl retsatr vsftpd [root@localhost ftp]# systemctl enabled vsftpd
四、主机B配置
1、配置yum源
备份yum源
[root@localhost ~]# mv /etc/yum.repos.d/* /opt/yum 写配置文件 [root@localhost ~]# vim /etc/yum.repos.d/local.repo [root@localhost ftp]# cat /etc/yum.repos.d/local.repo [ftpyum] name=ftpyum baseurl=ftp://主机A的ip /centos gpgcheck=0 enabled=1 [root@localhost ftp]# yum makecache [root@localhost ftp]# yum repolist
成功配置主机B通过ftp服务主机A的yum提供服务******