在配置完成本地yum仓库的前提下

1.安装FTP服务

[root@localhost ~]# yum install -y vsftpd 已加载插件:fastestmirror Loading mirror speeds from cached hostfile centos | 3.6 kB 00:00:00
正在解决依赖关系 —> 正在检查事务 —-> 软件包 vsftpd.x86_64.0.3.0.2-28.el7 将被 安装 —> 解决依赖关系完成

依赖关系解决

============================================================================================================

Package 架构 版本 源 大小

正在安装: vsftpd x86_64 3.0.2-28.el7 centos 172 k

事务概要

安装 1 软件包

总下载量:172 k 安装大小:353 k Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction 正在安装 : vsftpd-3.0.2-28.el7.x86_64 1/1 验证中 : vsftpd-3.0.2-28.el7.x86_64 1/1

已安装: vsftpd.x86_64 0:3.0.2-28.el7

完毕!

2.编辑FTP服务的配置文件

在最上方一行添加”anon_root=/opt”

[root@localhost ~]# vi /etc/vsftpd/vsftpd.conf anon_root=/opt

Example config file /etc/vsftpd/vsftpd.conf

……

3.启动FTP服务

[root@localhost ~]# systemctl start vsftpd [root@localhost ~]# netstat -nplt -bash: netstat: 未找到命令 //此时需要使用yum库安装netstat命令 [root@localhost ~]# yum install net-tools [root@localhost ~]# netstat -nplt Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:22 0.0.0.0: LISTEN 998/sshd
tcp 0 0 127.0.0.1:25 0.0.0.0:
LISTEN 1189/master
tcp6 0 0 :::21 ::: LISTEN 2672/vsftpd
tcp6 0 0 :::22 :::
LISTEN 998/sshd
tcp6 0 0 ::1:25 :::* LISTEN 1189/master

4.在使用浏览器访问FTP服务之前,关闭防火墙

[root@localhost ~]# setenforce 0 [root@localhost ~]# systemctl stop firewalld

5.使用浏览器访问FTP服务

例如本机地址为192.168.223.9
则在浏览器输入 ftp://192.168.223.9(注意使用英文冒号)
image.png
至此FTP服务可以正常使用