# ClamAV Installation and Configuration Guide for Ubuntu 24.04 ## 1. Introduction This guide provides step-by-step instructions for installing and configuring ClamAV on Ubuntu 24.04. The configuration files will be moved to a custom directory: `/opt/calypso/conf/clamav`. ## 2. Installation First, update the package lists and install the `clamav` and `clamav-daemon` packages. ```bash sudo apt-get update sudo apt-get install -y clamav clamav-daemon ``` ## 3. Configuration File Migration Create the new configuration directory and copy the default configuration files. ```bash sudo mkdir -p /opt/calypso/conf/clamav sudo cp /etc/clamav/clamd.conf /opt/calypso/conf/clamav/clamd.conf sudo cp /etc/clamav/freshclam.conf /opt/calypso/conf/clamav/freshclam.conf ``` Change the ownership of the new directory to the `clamav` user and group. ```bash sudo chown -R clamav:clamav /opt/calypso/conf/clamav ``` ## 4. Systemd Service Configuration Create override files for the `clamav-daemon` and `clamav-freshclam` services to point to the new configuration file locations. ### 4.1. clamav-daemon Service ```bash sudo mkdir -p /etc/systemd/system/clamav-daemon.service.d sudo bash -c 'cat > /etc/systemd/system/clamav-daemon.service.d/override.conf < /etc/systemd/system/clamav-freshclam.service.d/override.conf < /etc/apparmor.d/local/usr.bin.freshclam ``` ### 5.2. clamd AppArmor Profile ```bash sudo echo "/opt/calypso/conf/clamav/clamd.conf r," > /etc/apparmor.d/local/usr.sbin.clamd ``` You also need to grant execute permissions to the parent directory for the clamav user to be able to traverse it. ```bash sudo chmod o+x /opt/calypso/conf ``` Reload the AppArmor profiles to apply the changes. ```bash sudo systemctl reload apparmor ``` ## 6. Starting and Verifying Services Restart the ClamAV services and check their status to ensure they are using the new configuration file. ```bash sudo systemctl restart clamav-daemon clamav-freshclam sudo systemctl status clamav-daemon clamav-freshclam ``` You should see that both services are `active (running)`.