Script install clamav on CentOS 6

by Daniel Pham
Published: Updated:

This article will give you a script to help you install clamav on centos faster, instead of having to run each command line. I wrote it as a function, you can copy this function into any of your other scripts to use.

There are some people who say that using Linux is safe, and that ordinary viruses can not work on Linux. That is completely wrong. Previously, people could say that because of the number of machines running Linux is relatively small. So hackers do not bother to write malicious code running on Linux.

But today, the number of machines using Linux has increased. And you need to protect yourself against the dangers. There are a number of antivirus solutions that are well known for Linux users, but not everyone has a lot of money. So we need free antivirus solutions – it’s clamav.

Script install clamav

Copy the content below to a file on the server and name it install_clamav.sh (or whatever name you want).

#!/bin/bash
# Script author: Danie Pham
# Script site: https://devopslite.com
# Script date: 31-12-2017
# Script ver: 1.0
# Script use to install clamav on CentOS 6.x

# Function install clamav
f_install_clamav () {

    # Command install epel-release package
    yum install epel-release -y

    # Command install clamav package
    yum install clamav clamav-db clamd -y

    # Set clamav auto start after reboot
    /etc/init.d/clamd on
    chkconfig clamd on

    # Update database for clamav
    /usr/bin/freshclam

    # Start clamav
    /etc/init.d/clamd start

    # Exclude some wrong signature of clamav
    cat > /var/lib/clamav/local.ign2 <<"EOF"
    PUA.Win.Trojan.EmbeddedPDF-1
    PUA.Pdf.Trojan.EmbeddedJavaScript-1
    PUA.Pdf.Trojan.EmbeddedJS-1
    Heuristics.OLE2.ContainsMacros
    EOF

    # Restart clamav
    /etc/init.d/clamd restart
}
# Main function
f_main () {

    # Call f_install_clamav function (you can use this method in other script)
    f_install_clamav
}
f_main

exit

You can download the script here.

Use script install clamav

After you finish copying the script, assign permissions to the script as follows:

chmod 700 install_clamav.sh

Read moreScript send email warning ssh login

Next, just run the command below to perform the clamav installation:

./install_clamav.sh
Script install clamav on CentOS 6
Use script to install clamav

After the script done the installation, will be notified as the image below.

Script install clamav on CentOS 6
The result when script finished

Conclusion

With the installation of clamav, you can feel secure about your Linux server or you can use it right on your personal computer. Of course clamav is a free solution and it can not be compared to commercial solutions like Bitdefender or Symantec …

(This is an article from my old blog that has been inactive for a long time, I don’t want to throw it away so I will keep it and hope it helps someone).

0 0 votes
Article Rating

You may also like

Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments

DevOps Lite is a personal blog specializing in technology with main topics about DevOps, DevSecOps, SRE and System Administrator. Articles are shared for free and contributed to the community.

SUPPORT US

FOLLOW US

Subscribe my Newsletter for new blog posts. Stay updated from your inbox!

© 2021-2024 DevOpsLite.com – All rights reserved.

Please write sources “DevOpsLite.com” when using articles from this website.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More

2
0
Would love your thoughts, please comment.x
()
x

Adblock Detected

Please support us by disabling your AdBlocker extension from your browsers for our website.