centos8.5安装fail2ban

当直接使用dnf install fail2ban时会提示:

Last metadata expiration check: 3:15:22 ago on Sat 28 Sep 2024 05:19:44 PM CST.
Error: 
 Problem: problem with installed package selinux-policy-targeted-3.14.3-80.el8_5.2.noarch
  - package fail2ban-server-1.0.2-3.el8.noarch requires (fail2ban-selinux if selinux-policy-targeted), but none of the providers can be installed
  - package fail2ban-1.0.2-3.el8.noarch requires fail2ban-server = 1.0.2-3.el8, but none of the providers can be installed
  - conflicting requests
  - nothing provides selinux-policy >= 3.14.3-108.el8_7.1 needed by fail2ban-selinux-1.0.2-3.el8.noarch
  - nothing provides selinux-policy-base >= 3.14.3-108.el8_7.1 needed by fail2ban-selinux-1.0.2-3.el8.noarch
(try to add '--skip-broken' to skip uninstallable packages or '--nobest' to use not only best candidate packages)
 

这是因为安装源自动安装fail2ban的1.0.2-3版本,其需要:

selinux-policy >= 3.14.3-108.el8_7.1,

selinux-policy-base >= 3.14.3-108.el8_7.1

但是centos8.5这两项内容版本较低,网上找不到centos8.5对应的这两项。

阿里云同样是centos8.5但安装的是fail2ban 0.10.5,这个版本是可以安装成功的,但是找不到对应的二进制安装文件,安装文件在阿里云专用的镜像市场中:mirrors.cloud.aliyuncs.com,找不到,因此,需要下载fail2ban 0.10.5源代码重新安装。

源代码链接:

https://github.com/fail2ban/fail2ban/releases/tag/0.10.5

安装教程在此链接的下面:

How to install or upgrade fail2ban manually · fail2ban/fail2ban Wiki · GitHub

fail2ban/README.md at 1.0 · fail2ban/fail2ban · GitHub

接下来按照以下步骤进行安装:
1、首先服务器上已经安装Python3

2、然后将源代码上传到服务器,并进行解压,并进入解压后的文件夹

3、因为fail2ban使用Python写的,所以执行以下命令:

      python3 setup.py install

4、安装完后当前目录下会出现build文件夹,然后将fail2ban.service加入系统自启动

sudo cp ./build/fail2ban.service /etc/systemd/system/fail2ban.service
sudo systemctl enable fail2ban

5、然后可以通过下面命令启动,查看是否已启动成功

systemctl start fail2ban

systemctl status fail2ban

安装成功后就可以按照教程去设置一些安全措施了。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值