UPDATE: the project seems to be heavilly outdated: https://sourceforge.net/projects/denyhosts/files/denyhosts/
One can use Fail2ban instead.

How do you install and configure Denyhosts?

Here is what worked for me: yum install denyhosts 2>/dev/null||apt install denyhosts 2>/dev/null

add my IP (www.myip.ms) to the /etc/hosts.allow to whitelist myself. The line should look like this for example:

configuration file (not required to modify it): /etc/denyhosts.conf

start the service: service denyhosts start

make the service to run at server start: chkconfig denyhosts on 2>/dev/null||systemctl enable denyhosts 2>/dev/null

remove all blocked IPs? I do not know, "denyhosts --purge-all" returns errors, so if you made no configuration changes to denyhosts, you may try:
1. remove the package: yum erase denyhosts 2>/dev/null||apt purge denyhosts 2>/dev/null
2. list firewall blocks: iptables -S INPUT
3. copy the rules you want to retain and purge all rules in the INPUT chain you have just listed. Then run the rules you have copied earlier.
4. install denyhosts again