How to install ClamAV Ubuntu
Nicholas Mutsaerts
????System Administrator | Microsoft 365 Administrator | IT Support Specialist | Technical Writer | Linux Enthusiast
Linux is generally less prone to malware compared to other operating system. Nonetheless, it is good practice to install an antivirus software to provide essential protection for servers, email scanning, and overall system security.
ClamAV is an open-source antivirus program designed to detect trojans, viruses, malware, and other malicious threats.
Installing ClamAV on Ubuntu
1. Update Package List via Terminal
sudo apt update
sudo apt upgrade
2. Install ClamAV
sudo apt install clamav
3. Install ClamAV’s dameon (clamd)
sudo apt install clamav-daemon
Select ‘Y’ to install ClamAV. During the installation process, you might be prompted to configure ‘clamd’ to boot on start.
4. Update ClamAV’s Virus Definitions.
sudo freshclam
5. Configure Automatic Updates (Optional):
It might be more convenient to setup automatic updates for ClamAV’s virus database. Proceed to edit the ‘Freshclam’ configuration file.
sudo nano /etc/clamav/freshclam.conf
Proceed to find the line that says ‘# Comment or remove the line below.’ And uncomment (remove the ‘#’ symbol) from the line:
# Comment or remove the line below.
DatabaseMirror database.clamav.net
Save the file and exit.
6. Start the ClamAV Daemon (clamd)
sudo systemctl start clamav-daemon
7. Enable ClamAV Daemon to Start on Boot (Optional):
sudo systemctl enable clamav-daemon
You can scan files, directories, or your entire system using the ‘clamscan’ command. For example,
clamscan -r /path/to/scan
Make sure to replace ‘/path/to/scan’ with the actual path you want to scan.