在安装FTP服务之前,首先要配置好yum源指向,以及更改selinux为disabled
[root@localhost ~]# vim /etc/sysconfig/selinux
[root@localhost ~]# cat /etc/sysconfig/selinux
his file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# minimum - Modification of targeted policy. Only selected processes are protected.
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@localhost ~]# reboot
##重启
[root@localhost ~]# getenforce
##显示当前selinux
Disabled
[root@localhost ~]# vim /etc/sysconfig/network-scripts/ifcfg-eth0
##配置网络
[root@localhost ~]# cat /etc/sysconfig/network-scripts/ifcfg-eth0
eth0
BOOTPROTO=none
IPADDR=172.25.24.220
PREFIX=24
ONBOOT=yes
TYPE=Ethernet
USERCTL=yes
PEERONS=yes
IPV6INIT=no
PERSISTENT_DHCLTENT=1
[root@localhost ~]# systemctl restart network
##重启网络服务
root@localhost ~]# vim /etc/yum.repos.d/rhel_dvd.repo
##设定yum源指向
[root@localhost ~]# cat /etc/yum.repos.d/rhel_dvd.repo
by cloud-init on Thu, 10 Jul 2014 22:19:11 +0000
[rhel_dvd]
gpgcheck = 0
enabled = 1
baseurl = http://172.25.254.48/rhel7.0
name = Remote classroom copy of dvd
接下来开始安装FTP服务
[root@localhost ~]# yum clean all ##安装之前清除缓存
Loaded plugins: langpacks
Cleaning repos: rhel_dvd
Cleaning up everything
[root@locot@locaoot@localhost ~]# yum search ftp ##查找
ugins: langpacks
rhel_dvd | 4.1 kB 00:00:00
(1/2): rhel_dvd/group_gz | 134 kB 00:00:00
(2/2): rhel_dvd/primary_db | 3.4 MB 00:00:00
=============================== N/S matched: ftp ================================
ftp.x86_64 : The standard UNIX FTP (File Transfer Protocol) client
tftp.x86_64 : The client for the Trivial File Transfer Protocol (TFTP)
tftp-server.x86_64 : The server for the Trivial File Transfer Protocol (TFTP)
vsftpd.x86_64 : Very Secure Ftp Daemon
curl.x86_64 : A utility for getting files from remote servers (FTP, HTTP, and
: others)
lftp.i686 : A sophisticated file transfer program
lftp.x86_64 : A sophisticated file transfer program
wget.x86_64 : A utility for retrieving files using the HTTP or FTP protocols
Name and summary matches only, use "search all" for everything.
[root@localhost ~]# yum install vsftpd.x86_64
ins: langpacks
Package vsftpd-3.0.2-9.el7.x86_64 already installed and latest version
Nothing to do ##已经安装好了,说明之前已经安装过了
[root@localhost ~]# systemctl start vsftpd
##打开vsftpd服务
[root@localhost ~]# systemctl start firewalld
##打开防火墙
[root@localhost ~]# systemctl enable firewalld
[root@localhost ~]# firewall-cmd --listl
##列出防火墙允许的服务
public (default, active)
interfaces: eth0
sources:
services: dhcpv6-client ssh
ports:
masquerade: no
forward-ports:
icmp-blocks:
rich rules:
[root@localhost ~]# firewall-cmd --permanent --add-service=ftp ##添加ftp (注意是两个- )
服务
success
[root@localhost ~]# firewall-cmd --reload ##刷新(注意是两个-)
success
在另一边用主机lftp 172.25.254.220查看
[kiosk@foundation20 Desktop]$ lftp 172.25.254.220
Interrupt
lftp 172.25.254.220:~> ls
Interrupt
lftp 172.25.254.220:~> ls
Interrupt
lftp 172.25.254.220:~> ls
drwxr-xr-x 2 0 0 6 Mar 07 2014 pub
lftp 172.25.254.220:/> ls
drwxr-xr-x 2 0 0 6 Mar 07 2014 pub
lftp 172.25.254.220:/>