请帮我了解我错在哪里,因为我已经阅读了很多文章,也看过很多 Youtube 视频,但最终总是得到相同的错误结果。
因此,在我的 服务器(192.168.25.146)我已经从 rpms 安装了:ftp
、、vsftpd
和createrepo
软件包dnf-utils
。然后,我移至 OS iso 目录内(/运行/媒体/dmitriy/RHEL-8-0-0-BaseOS-x86_64/)并将其所有内容复制到/var/ftp/pub目录。
接下来,我转到vsftpd
配置文件并进行如下更改:
匿名启用=是
anon_upload_enable=YES
chown_uploads=是
chown_用户名=守护进程
之后,我添加了端口 21/tcp 和服务到firewalld
:
public (active)
target: default
icmp-block-inversion: no
interfaces: ens160
sources:
services: cockpit dhcpv6-client ftp ssh
ports: 21/tcp 22/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
然后,我配置了我的本地 repo 文件(/etc/yum.repos.d/server.repo):
[server]
name=server
baseurl=ftp://192.168.25.146/pub
enabled=1
gpgcheck=0
然后,我启用了布尔值:
getsebool -a | grep ftp
ftpd_full_access --> on
之后我表演了创建 repo /var/ftp/pub
最后,我重新启动了机器vsftpd
,yum repolist 命令显示服务器机器上一切正常:
[root@control ~]# yum repolist
Updating Subscription Management repositories.
Last metadata expiration check: 0:27:12 ago on Sat 04 Jul 2020 12:15:21 AM EEST.
repo id repo name status
server server 6,328
ansible-2.8-for-rhel-8-x86_64-rpms Red Hat Ansible Engine 2.8 for RHEL 8 x86_64 (RPMs) 13
rhel-8-for-x86_64-appstream-rpms Red Hat Enterprise Linux 8 for x86_64 - AppStream (RPMs) 10,766
rhel-8-for-x86_64-baseos-rpms Red Hat Enterprise Linux 8 for x86_64 - BaseOS ( RPMs) 4,834
另外,查看ftp
与本地主机的连接:
[root@control ~]# ftp localhost
Trying ::1...
Connected to localhost (::1).
220 (vsFTPd 3.0.3)
Name (localhost:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
229 Entering Extended Passive Mode (|||17555|)
150 Here comes the directory listing.
drwxr-xr-x 3 0 0 380928 Jul 03 19:33 pub
226 Directory send OK.
ftp>
现在我去我的客户端计算机 我在** /etc/yum.repos.d/client.repo 中配置了我的 repo 文件
[root@ansible1 ~]# cat /etc/yum.repos.d/client.repo
[client]
name = client
baseurl = ftp://192.168.24.146/pub
gpgcheck = 0
enabled = 1
我启用了布尔值,并在/etc/vsftpd/vsftpd.conf,安装了 ftp、vsftpd,但是当我登录到 ftp 时我看不到我的包。
我也没有在客户端机器上做所有这些事情,而只是配置了 repo 文件,但结果是一样的,当我执行yum 重新排序我有:
[root@ansible1 ansible]# yum repolist
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
client 0.0 B/s | 0 B 00:21
Failed to synchronize cache for repo 'client', ignoring this repo.
客户端到服务器的 FTP 连接:
[root@ansible1 ~]# ftp 192.168.25.146
Connected to 192.168.25.146 (192.168.25.146).
220 (vsFTPd 3.0.3)
Name (192.168.25.146:root): anonymous
331 Please specify the password.
Password:
230 Login successful.
Remote system type is UNIX.
Using binary mode to transfer files.
ftp> ls
227 Entering Passive Mode (192,168,25,146,121,86).
ftp: connect: No route to host
ftp
我还添加了
#/etc/vsftpd/vsftpd.conf
pasv_max_port=40000
pasv_min_port=
防火墙
[root@control ~]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens160
sources:
services: cockpit dhcpv6-client ftp ssh
ports: 21/tcp 22/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
请帮助我了解我错在哪里!!!