Previously, we have said about Linux security, In this article, we are going to learn how to install ClamAV antivirus on CentOS 7 for better server protection.
Table of Contents
Install ClamAV antivirus on CentOS 7
First, let’s know why should we install an antivirus. While Linux is one of the most secure systems, but if you need to protect your Linux VPS or server, it is better to install an antivirus. Between all available options, you are recommended to use ClamaAV. As it is an open-source antivirus and is successfully against trojans, malware, and other security threats.
A Step-by-Step Guide
In the beginning, make sure that you did root access to your CentOS 7 server or VPS.
Note: you need to know how to use Putty to establish the SSH connection.
1. ClamAV does not come prepackaged in CentOs by default, so you need to add the repository by running yum commands.
yum install -y epel-release
2. After connecting to your terminal, enter the following command to download prerequisites for installation.
yum install -y clamav
3. After a while, the ClamAV antivirus is installed on your CentOS Linux and is ready to run.
4. Before scanning and working with ClamAV antivirus, please update it.
Note: the ClamAV antivirus, has a database that needs to be updated from time to time.
freshclam
Some useful commands for ClamAV antivirus
1. Use the following command to immediately scan the main branches.
clamscan
2. You can use the -r switch to scan a specific folder. For example, we want to scan the / home directory.
clamscan -r /home
3. To have a full scan of the root branch, enter the following command.
clamscan -r /
4. Use the -i switch if you want to show virus files.
clamscan -r -i /home
5. To remove viruses, use the -remove switch.
clamscan -r -remove /home
6. Use the help parameter to get acquainted with other switches and other features of ClamAV antivirus.
clamscan --help
conclusion
And, at the end of this article, we recommend users who face several attacks or frequent unknown file transactions, to install ClamAV antivirus on CentOS to prevent from spreading immediately if malware is detected.