ClamAV - Antivirus Scanner on Fedora8

I’ve just spent the best part of two hours fighting with the set-up of clamav on a relatively new Fedora 8 Server.  The documentation wasn’t the greatest so I’ve decided to do my bit to patch some of the holes.

Download clam

# sudo yum clamav clamav-server clamav-update

A number of instances of the clamd daemon can run concurrently. Each instance needs to be provided with a unique name. To keep things simple, we’re going to run one instance and call it ’server’. This name has implications for what is to follow.
Setting up the daemon up as running service involves the following steps:

Phase 1 - create a daemon user

When you install clamav using the yum utility, a new user is created automatically - The user is clamav. Most documentation uses this user as the daemon user - this isn’t a good idea. The clamav user has rights to update the database containig the list of known virii.   Create a new user clamd with no login rights.

#sudo useradd -s /sbin/nologin/ clamd

Phase 2 - Copying and renaming config files

Copy assorted files from /usr/share/doc/clamav-server-nn.nn.nn/ (where nn is the version number of your install) to assorted folders, renaming them and modifying their content.

# cp /usr/share/doc/clam-server-nn.nn.nn/clamd.conf /etc/clamd.d/
# cp /usr/share/doc/clam-server-nn.nn.nn/clamd.sysconfig /etc/sysconfig/clamd.server
# cp /usr/share/doc/clam-server-nn.nn.nn/clamd.logrotate /etc/logrotate.d/clamd

Phase 3 - Editing the configuration files

Start by editing the /etc/clamd.d/clamd.conf file.

Firstly, comment out the line saying Example in file clamd.conf

LogFile /var/log/clamd/clamd.log
Edit the LogSysLog setting LogSysLog yes
PidFile /var/run/clamd.server/clamd.pid
LocalSocket /var/run/clamd.server/clamd.sock
TcpAddr 127.0.0.1
User clamd

Phase 3 - Create the folders

Create the /var/run/clamd.server folder

#mkdir /var/run/clamd.server
#chown clamd.clamd /var/run/clamd.server

Create the clamd log folder

#mkdir /var/log/clamd
#touch /var/log/clamd/clamd.log
#chown clamd.clamd -R /var/log/clamd/
#chmod 0620 /var/log/clamd/clamd.log

Copy the clamd-wrapper to clamd.server

# cp /etc/init.d/clamd-wrapper /etc/init.d/clamd.server

Edit the CLAMD_SERVICE variable in the /etc/init.d/clamd.server file

CLAMD_SERVICE=server

Geez..this is getting complicated…one final step

Create a clamd.server file in /usr/sbin that links to the original clamd file

# ln -s /usr/sbin/clamd.server /usr/sbin/clamd

OK..all systems go…

now start the daemon

#etc/init.d/clamd.server start

If you want the daemon to start on reboot add it to the startup list using chkconfig

# /sbin/chkconfig clamd.server start

Hopefully you get the green light and have a running clamd daemon. If you don’t (check using ps auxw | grep clamd) please post a comment and let me know what grief you’re having.

Share/Save/Bookmark