前提准备两台lcentos7 的操作系统并且两个能互相ping通
第一步安装vsftpd包
[root@compute ~]# yum install -y vsftpd
Loaded plugins: fastestmirror, langpacks
Packages | 2.9 kB 00:00:00
iaas | 2.9 kB 00:00:00
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package vsftpd.x86_64 0:3.0.2-11.el7_2 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================================
Package Arch Version Repository Size
========================================================================================================
Installing:
vsftpd x86_64 3.0.2-11.el7_2 iaas 167 k
Transaction Summary
========================================================================================================
Install 1 Package
Total download size: 167 k
Installed size: 347 k
Downloading packages:
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : vsftpd-3.0.2-11.el7_2.x86_64 1/1
Verifying : vsftpd-3.0.2-11.el7_2.x86_64 1/1
Installed:
vsftpd.x86_64 0:3.0.2-11.el7_2
Complete!
You have mail in /var/spool/mail/root
[root@compute ~]#
[root@compute ~]# systemctl restart vsftpd
[root@compute ~]# systemctl enable vsftpd
Created symlink from /etc/systemd/system/multi-user.target.wants/vsftpd.service to /usr/lib/systemd/system/vsftpd.service.
[root@compute ~]#
第二步指定ftp的路径
anon_root=/opt/
# Example config file /etc/vsftpd/vsftpd.conf
#
# The default compiled in settings are fairly paranoid. This sample file
# loosens things up a bit, to make the ftp daemon more usable.
# Please see vsftpd.conf.5 for all compiled in defaults.
#
# READ THIS: This example file is NOT an exhaustive list of vsftpd options.
# Please read the vsftpd.conf.5 manual page to get a full idea of vsftpd's
# capabilities.
第三步关闭防火墙我选择最粗暴的方式关闭防火墙和selinux
[root@compute ~]# systemctl stop firewalld
[root@compute ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Mar 14 23:42:14 compute systemd[1]: Stopped firewalld - dynamic firewall daemon.
Mar 14 23:42:42 compute systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@compute ~]# setenforce 0
[root@compute ~]# getenforce
Permissive
[root@compute ~]#
第四步配置客服端
[root@server yum.repos.d]# yum install -y vsftpd
[root@server yum.repos.d]# systemctl restart vsftpd.service
[root@server yum.repos.d]# systemctl enable vsftpd
[root@server yum.repos.d]#
**第五步配置客服端的yum 注意:不要写绝对路径不然会找不到位置报错因为刚才创建的ftp的路径指定的是opt所以直接写opt目录下的文件就行
[root@server yum.repos.d]# vim ftp.repo
[iaas]
name=iaas
baseurl=ftp://192.168.1.10/iaas-repo
gpgcheck=0
enabled=1
[Packages]
name= Packages
baseurl=ftp://192.168.1.10/Packages
gpgcheck=0
enabled=1
第六步照样关闭可客服端的防火墙设置selinux为permissive
[root@compute ~]# systemctl stop firewalld
[root@compute ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: inactive (dead)
Mar 14 23:42:14 compute systemd[1]: Stopped firewalld - dynamic firewall daemon.
Mar 14 23:42:42 compute systemd[1]: Stopped firewalld - dynamic firewall daemon.
[root@compute ~]# setenforce 0
[root@compute ~]# getenforce
Permissive
[root@compute ~]# systemctl restart vsftpd
第七步验证yum,可以发现我们使用的yum为Packages和iaas得到正确的yum仓库
[root@server yum.repos.d]# yum repolist all
Loaded plugins: fastestmirror, langpacks
Loading mirror speeds from cached hostfile
repo id repo name status
Packages Packages enabled: 3,723
iaas iaas enabled: 1,482
repolist: 5,205
[root@server yum.repos.d]#