Fail2ban: How to upgrade 0.9.3 to 0.10 on ubuntu 16.04.5 LTS?

Created on 19 Dec 2018  路  2Comments  路  Source: fail2ban/fail2ban

Hello. Ubuntu 16.04.5 contains only 0.9.3 and I don't know how to upgrade fail2ban to 0.10 with ipv6 support without any bugs and repositary changes. https://packages.ubuntu.com/xenial/fail2ban

Please help.

closed-as-duplicate obsolete-version

Most helpful comment

Here's a step by step of what I did to make this work:

# REMOVE FAIL2BAN COMPLETELY AND BACKUP EXISTING INSTALL
service fail2ban stop
cp -a /etc/fail2ban/ /etc/fail2ban_backup/
apt-get remove --auto-remove fail2ban
apt-get purge --auto-remove fail2ban
rm -r /etc/fail2ban/

# DOWNLOAD NEWER RELEASE AND INSTALL MANUALLY
wget https://github.com/fail2ban/fail2ban/archive/0.10.4.tar.gz
tar xzf 0.10.4.tar.gz
cd fail2ban-0.10.4/
python setup.py install

# PUT UBUNTU SPECIFIC FILES INTO PLACE
cp files/bash-completion /etc/bash_completion.d/fail2ban
cp man/*.5 /usr/share/man/man5
cp man/*.1 /usr/share/man/man1
wget -O /etc/logrotate.d/fail2ban https://raw.githubusercontent.com/fail2ban/fail2ban/debian/debian/fail2ban.logrotate
cp build/fail2ban.service /lib/systemd/system/fail2ban.service
systemctl enable fail2ban
service rsyslog restart
service fail2ban start
service fail2ban status

Now enable some jails or copy rules from your old jail.local or jail.conf files and you should be in business.

All 2 comments

As correct noted in #2148 and others:

Distro package maintainers are responsible for distro packaging.

You may try to find some repository (e. g. neurodebian, launchpad, etc) that contains fail2ban could be installed on Ubuntu (16.04).
No idea which best repo it could be (just google).

The way for manual installation is described on the README, Installation section as well as in the wiki (e. g. How to test newer fail2ban version resp. use fail2ban standalone instance).

Although the default version is debian-friendly, it may not have your distro-specified configs/paths (and services), so:

  • may be merge with debian-branch would be good idea;
  • backup your old /etc/fail2ban (as well as init.d script and/or systemd-unit) before you uninstall it;
  • uninstall your stock version;
  • install fail2ban manually (see instruction in README, Installation section);
  • the system init/service script is not automatically installed, so to enable fail2ban as an automatic service, simply copy the script for your distro from the files directory to /etc/init.d or related systemd-unit (see instruction in README, Installation section).
  • restore your distro-related configs or newest from new versions of new distro-packets or adjust the file from github (like /etc/fail2ban/paths-debian.conf).

That's it.

Here's a step by step of what I did to make this work:

# REMOVE FAIL2BAN COMPLETELY AND BACKUP EXISTING INSTALL
service fail2ban stop
cp -a /etc/fail2ban/ /etc/fail2ban_backup/
apt-get remove --auto-remove fail2ban
apt-get purge --auto-remove fail2ban
rm -r /etc/fail2ban/

# DOWNLOAD NEWER RELEASE AND INSTALL MANUALLY
wget https://github.com/fail2ban/fail2ban/archive/0.10.4.tar.gz
tar xzf 0.10.4.tar.gz
cd fail2ban-0.10.4/
python setup.py install

# PUT UBUNTU SPECIFIC FILES INTO PLACE
cp files/bash-completion /etc/bash_completion.d/fail2ban
cp man/*.5 /usr/share/man/man5
cp man/*.1 /usr/share/man/man1
wget -O /etc/logrotate.d/fail2ban https://raw.githubusercontent.com/fail2ban/fail2ban/debian/debian/fail2ban.logrotate
cp build/fail2ban.service /lib/systemd/system/fail2ban.service
systemctl enable fail2ban
service rsyslog restart
service fail2ban start
service fail2ban status

Now enable some jails or copy rules from your old jail.local or jail.conf files and you should be in business.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

davidfavor picture davidfavor  路  29Comments

joe-average-user picture joe-average-user  路  32Comments

superpuffin picture superpuffin  路  18Comments

alasdairdc picture alasdairdc  路  18Comments

arekstuka picture arekstuka  路  21Comments