面板自带的安装脚本没有安装成功
先修 EPEL,再安装 Pure-FTPd:
grep -q '^ip_resolve=4$' /etc/dnf/dnf.conf || echo 'ip_resolve=4' >> /etc/dnf/dnf.conf
rpm --import https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8
printf '%s\n' '[epel]' 'name=Extra Packages for Enterprise Linux 8 - $basearch' 'baseurl=https://dl.fedoraproject.org/pub/epel/8/Everything/$basearch/' 'enabled=1' 'gpgcheck=1' 'gpgkey=https://dl.fedoraproject.org/pub/epel/RPM-GPG-KEY-EPEL-8' > /etc/yum.repos.d/epel.repo
dnf clean all
rm -rf /var/cache/dnf
dnf makecache
dnf install -y pure-ftpd
如果执行到 dnf makecache 或 dnf install -y pure-ftpd 时,又提示 BaseOS / AppStream 出错,再继续执行下面这些,也是一行一条:
sed -i 's|^mirrorlist=|#mirrorlist=|g' /etc/yum.repos.d/CentOS-Linux-*.repo
sed -i 's|^#baseurl=http://mirror.centos.org|baseurl=https://vault.centos.org|g' /etc/yum.repos.d/CentOS-Linux-*.repo
dnf clean all
rm -rf /var/cache/dnf
dnf makecache
dnf install -y pure-ftpd
安装完成后,继续一行一条配置并启动:
sed -ri 's|^#?\s*PureDB\s+.*|PureDB /etc/pure-ftpd/pureftpd.pdb|' /etc/pure-ftpd/pure-ftpd.conf
sed -ri 's|^#?\s*VerboseLog\s+.*|VerboseLog yes|' /etc/pure-ftpd/pure-ftpd.conf
sed -ri 's|^#?\s*NoAnonymous\s+.*|NoAnonymous yes|' /etc/pure-ftpd/pure-ftpd.conf
sed -ri 's|^#?\s*PassivePortRange\s+.*|PassivePortRange 39000 40000|' /etc/pure-ftpd/pure-ftpd.conf
systemctl enable --now pure-ftpd
systemctl status pure-ftpd --no-pager -l
如果服务器开了防火墙,再执行:
firewall-cmd --permanent --add-service=ftp
firewall-cmd --permanent --add-port=39000-40000/tcp
firewall-cmd --reload
你先执行到 dnf install -y pure-ftpd 这一步;如果报错,把报错原文贴给我,我直接接着帮你判断下一步。
阿里云服务器配置
39000/40000 需要这样写开放端口
你刚才那一串里,真正的根因只有一个:
dnf install -y pure-ftpd 没装成功。
所以后面这些才会全部报错:
/etc/pure-ftpd/pure-ftpd.conf 不存在
pure-ftpd.service 不存在
1Panel 也当然还是显示“未安装”
现在不要继续用刚才那个 dl.fedoraproject.org 源了。它返回的不是正常仓库 XML,而是一个 HTML 拒绝页,所以才会出现 repomd.xml parser error。直接改成阿里云镜像来装。
从这里重新开始,一行一条命令,按顺序执行:
mv /etc/yum.repos.d/epel.repo /etc/yum.repos.d/epel.repo.bak.$(date +%s) 2>/dev/null || true
curl -fsSL http://mirrors.cloud.aliyuncs.com/epel/RPM-GPG-KEY-EPEL-8 -o /tmp/RPM-GPG-KEY-EPEL-8
rpm --import /tmp/RPM-GPG-KEY-EPEL-8
printf '%s\n' '[epel]' 'name=Extra Packages for Enterprise Linux 8 - $basearch' 'baseurl=http://mirrors.cloud.aliyuncs.com/epel/8/Everything/$basearch/' 'enabled=1' 'gpgcheck=1' 'gpgkey=file:///tmp/RPM-GPG-KEY-EPEL-8' > /etc/yum.repos.d/epel.repo
dnf clean all
rm -rf /var/cache/dnf
dnf makecache
dnf install -y pure-ftpd
问题已经缩到一个点了:epel 主仓库已经正常,真正卡住的是 epel-modular。pure-ftpd 不需要 epel-modular,所以把它禁掉再装就行。firewalld 当前没启动,先不用管它。
按顺序执行下面这些,一行就是一条命令:
sed -ri '/^[epel-modular]/,/^[/{s/^enabled=.*/enabled=0/}' /etc/yum.repos.d/*epel*.repo
dnf clean all
rm -rf /var/cache/dnf
dnf makecache --disablerepo=epel-modular
dnf install -y --disablerepo=epel-modular pure-ftpd
rpm -q pure-ftpd
如果最后一条能看到类似 pure-ftpd-...x86_64,再继续执行这些:
grep -q '^PureDB ' /etc/pure-ftpd/pure-ftpd.conf && sed -ri 's|^#?\s*PureDB\s+.*|PureDB /etc/pure-ftpd/pureftpd.pdb|' /etc/pure-ftpd/pure-ftpd.conf || echo 'PureDB /etc/pure-ftpd/pureftpd.pdb' >> /etc/pure-ftpd/pure-ftpd.conf
grep -q '^VerboseLog ' /etc/pure-ftpd/pure-ftpd.conf && sed -ri 's|^#?\s*VerboseLog\s+.*|VerboseLog yes|' /etc/pure-ftpd/pure-ftpd.conf || echo 'VerboseLog yes' >> /etc/pure-ftpd/pure-ftpd.conf
grep -q '^NoAnonymous ' /etc/pure-ftpd/pure-ftpd.conf && sed -ri 's|^#?\s*NoAnonymous\s+.*|NoAnonymous yes|' /etc/pure-ftpd/pure-ftpd.conf || echo 'NoAnonymous yes' >> /etc/pure-ftpd/pure-ftpd.conf
grep -q '^PassivePortRange ' /etc/pure-ftpd/pure-ftpd.conf && sed -ri 's|^#?\s*PassivePortRange\s+.*|PassivePortRange 39000 39050|' /etc/pure-ftpd/pure-ftpd.conf || echo 'PassivePortRange 39000 39050' >> /etc/pure-ftpd/pure-ftpd.conf
systemctl enable --now pure-ftpd
systemctl status pure-ftpd --no-pager -l
终于安装成功