DirectAdmin Knowledge Base and Support

DirectAdmin is a web panel for a simple administration of both virtual and dedicated servers. DirectAdmin is faster, safe and more powerful than any other CP. And we know how to customize and support it.

How to install rspamd on CentOS 8 with DirectAdmin

| 00:00:01 08.10.2019

Rspamd, the fast, free and open-source spam filtering system, goes with a web interface, which provides basic functions for setting metric actions, scores, viewing statistic and learning. Here is a guide on how to get installed into DirectAdmin control panel on admin level.

Rspamd is an advanced spam filtering system that allows evaluation of messages by a number ;
of rules including regular expressions, statistical analysis and custom services such as URL black lists.

If you want to install Rspamd on CentOS 8 with DirectAdmin, here is a short guide on the matter. 

At the moment of the publication CentOS 8 repo is added for Rspamd experimental builds. There are no plans to add CentOS 8 support for 1.9.4, as claims the Rspamd author. So let's go and install it!

First make sure you've got CentOS 8 installed, run the command:

cat /etc/redhat-release

for this. You should see something like:

CentOS Linux release 8.0.1905 (Core)

It's expected to see CentOS Linux release 8 here. The other numbers might differ at the moment of a reading.

Add a repository

As root run the following command:

wget -O /etc/yum.repos.d/rspamd.repo

So, here we downloaded a file with information about Rspamd repository and installed it. The next step will be to install Rspamd.

Rspamd Installation with DirectAdmin

We will use CustomBuild to get Rspamd installed and configured for our needs:

cd /usr/local/directadmin/custombuild/
./build update
./build set spamd rspamd
./build rspamd

The final command is expected to give a similar output to the following one:

Enabling rspamd in systemd...
Disabling spamassassin in systemd...
Removed /etc/systemd/system/
Removed /etc/systemd/system/spamd.service.
Removing directory: /var/lib/spamassassin...
Removing directory: /usr/share/perl5/Mail/SpamAssassin...
Removing directory: /usr/lib64/perl5/auto/Mail/SpamAssassin...
Removing directory: /usr/share/spamassassin...
Removing directory: /etc/mail/spamassassin...
Removing directory: /root/.spamassassin...
Removing file: /usr/bin/spamassassin...
Removing file: /usr/bin/sa-check_spamd...
Removing file: /usr/bin/spamc...
Removing file: /usr/bin/sa-learn...
Removing file: /usr/bin/spamd...
Removing file: /usr/bin/sa-awl...
Removing file: /usr/bin/sa-update...
Removing file: /usr/bin/sa-compile...
Removing file: /etc/exim.spamassassin.conf...
Removing file: /etc/cron.daily/sa-update...
SpamAssassin has been successfully removed
Debug mode. Level 10

dataskq: command: action=rewrite&value=rspamd
Spam::write_spamd_conf: user_prefs for wp7test is not enabled.  Skipping this write.
Restarting rspamd.
Restarting exim.

So, Rspamd is installed! Need to do some additional tweaks:

Update iptables firewall

Make sure outgoing connections to remote UDP port 11335 are allowed. If blocked you will see an error:

got error on IO with server, on write, 1, Operation not permitted

If you use CSF/LFD just add the port into UDP_OUT and UDP6_OUT, then restart csf.

Changing statistics to work with sqlite (optional):

The Rspamd 2.0 moved to use redis as a backend, if it's not what you want you might need to roll back to sqlite, for this do the following.

Create a file /etc/rspamd/local.d/statistic.conf:

touch /etc/rspamd/local.d/statistic.conf

And now either open the file in an editor and populate with a content from the link at github or use the following command:

wget -O /etc/rspamd/local.d/statistic.conf

to install the needed config.

Then restart Rspamd:

systemctl restart rspamd

and check to make sure it's running:

[root@server rspamd]# ps aux | grep rspamd
_rspamd    568  4.1  1.7 180324 69620 ?        Ss   01:35   0:00 rspamd: main process
_rspamd    571  0.0  1.4 180324 56812 ?        S    01:35   0:00 rspamd: rspamd_proxy process (localhost:11332)
_rspamd    574  0.0  1.5 181464 58776 ?        S    01:35   0:00 rspamd: controller process (localhost:11334)
_rspamd    575  0.0  1.4 180684 58016 ?        S    01:35   0:00 rspamd: normal process (localhost:11333)
_rspamd    577  0.0  1.4 180324 56068 ?        S    01:35   0:00 rspamd: hs_helper process
root       580  0.0  0.0  10024   948 pts/1    R+   01:35   0:00 grep --color=auto rspamd
root     23030  0.0  0.0 166428   812 ?        Ss   00:01   0:00 gpg-agent --homedir /var/cache/dnf/rspamd-experimental-9db1f43f1540b7c6/pubring --use-standard-socket --daemon
[root@server rspamd]#

Web-UI in DirectAdmin for admins

You can install Rspamd plugin for DirectAdmin. It will add Rspamd WebUI into DirectAdmin at admin level

That's it!

About Us
We are a team of professionals, and specialize in installation, configuring and managing of remote virtual and dedicated servers powered by Linux/Unix-like OS with DirectAdmin. We support various sets of software, including web-servers Apache, Nginx; internet domain name servers Bind, PowerDNS; mail-servers with POP3, IMAP and SMTP, FTP-servers, etc. After years of working through the most complex server challenges our team has gathered valuable experience and universal solutions suitable for everyday tasks. We are here to lend you a helping hand and take care of your servers in order to let you have enough time to do more of what you love.

All of the information and data on this site is for informational purposes only and is provided for the convenience of the user.
Powered by: Amiro.CMS - Free edition