,
server端操作
1.安装vsftpd服务(如无法安装,先配置本地yum源再进行安装)
[root@server ~]# rpm -q vsftpd vsftpd-3.0.2-28.el7.x86_64
2.创建镜像挂载目录并进行镜像挂载
[root@server ~]#yum install -y vsftpd
[root@server ~]# mkdir /var/ftp/dvd [root@server ~]# mount /dev/cdrom /var/ftp/dvd/ mount: /dev/sr0 is write-protected, mounting read-only [root@server ~]# ls /var/ftp/dvd/ CentOS_BuildTag EULA images LiveOS repodata RPM-GPG-KEY-CentOS-Testing-7 EFI GPL isolinux Packages RPM-GPG-KEY-CentOS-7 TRANS.TBL
3.重启vsftpd服务
[root@server ~]# systemctl restart vsftpd #重启服务 [root@server ~]# systemctl status vsftpd #查看服务状态 ● vsftpd.service - Vsftpd ftp daemon Loaded: loaded (/usr/lib/systemd/system/vsftpd.service; disabled; vendor preset: disabled) Active: active (running) since Sat 2023-05-20 05:57:51 CST; 8s ago Process: 1917 ExecStart=/usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf (code=exited, status=0/SUCCESS) Main PID: 1918 (vsftpd) CGroup: /system.slice/vsftpd.service └─1918 /usr/sbin/vsftpd /etc/vsftpd/vsftpd.conf May 20 05:57:51 server systemd[1]: Starting Vsftpd ftp daemon... May 20 05:57:51 server systemd[1]: Started Vsftpd ftp daemon.
4.设置防火墙信任模式,SElinux设置disabled
[root@server ~]# firewall-cmd --set-default-zone=trusted
[root@server-128 ~]# getenforce
Enforcing(强制执行模式)
[root@server-128 ~]# setenforce 0
[root@server-128 ~]# getenforce
Permissive
SE Linux的几种状态如下
[root@server ~]# vim /etc/selinux/config #关闭状态
getenforce #查询selinux的工作状态( Disabled、Enforcing、Permissive)
setenforce 0 #将selinux设置为宽容模式 permissive (立即生效)
setenforce 1 #将selinux设置为强制模式 Enforcing (立即生效)
Client端操作
1.是否能ping通服务端
[root@client-130 ~]# ping 192.168.145.128
PING 192.168.145.128 (192.168.145.128) 56(84) bytes of data.
64 bytes from 192.168.145.128: icmp_seq=1 ttl=64 time=1.21 ms
64 bytes from 192.168.145.128: icmp_seq=2 ttl=64 time=1.44 ms
64 bytes from 192.168.145.128: icmp_seq=3 ttl=64 time=1.48 ms
64 bytes from 192.168.145.128: icmp_seq=4 ttl=64 time=1.67 ms
2.curl查看是否能访问到Server端的光盘镜像内容
[root@client-130 ~]# curl ftp://192.168.145.128:/dvd/ 注:#192.168.145.128:/dvd/ = /var/ftp/dvd/
-rw-rw-r-- 1 0 0 14 May 02 2018 CentOS_BuildTag drwxr-xr-x 3 0 0 2048 May 03 2018 EFI -rw-rw-r-- 1 0 0 227 Aug 30 2017 EULA -rw-rw-r-- 1 0 0 18009 Dec 09 2015 GPL drwxr-xr-x 2 0 0 2048 May 03 2018 LiveOS drwxrwxr-x 2 0 0 1640448 May 03 2018 Packages -rw-rw-r-- 1 0 0 1690 Dec 09 2015 RPM-GPG-KEY-CentOS-7 -rw-rw-r-- 1 0 0 1690 Dec 09 2015 RPM-GPG-KEY-CentOS-Testing-7 -r--r--r-- 1 0 0 2883 May 07 2018 TRANS.TBL drwxr-xr-x 3 0 0 2048 May 03 2018 images drwxr-xr-x 2 0 0 2048 May 03 2018 isolinux drwxrwxr-x 2 0 0 4096 May 07 2018 repodata
3.备份yum源文件
[root@client-130 ~]# cp /etc/yum.repos.d/* repo.back/
4.编写ftp-yum源文件
[root@client-130 yum.repos.d]# vim ftp.repo
[centos] name=ftpclient baseurl=ftp://192.168.145.128/dvd/ gpgcheck=0 enabled=1
5.更新源文件
[root@client-130 ~]# yum repolist Loaded plugins: fastestmirror, langpacks centos | 3.6 kB 00:00:00 (1/2): centos/group_gz | 166 kB 00:00:00 (2/2): centos/primary_db | 5.9 MB 00:00:00 Determining fastest mirrors repo id repo name status centos ftpclient 9,911 repolist: 9,911
标签:ftp,192.168,server,vsftpd,yum,145.128,使用,root From: https://www.cnblogs.com/cndr/p/17416515.html