{"id":357,"date":"2013-10-13T05:40:07","date_gmt":"2013-10-13T05:40:07","guid":{"rendered":"http:\/\/blog.shineservers.com\/?p=357"},"modified":"2013-10-13T05:40:07","modified_gmt":"2013-10-13T05:40:07","slug":"install-clamav-configure-daily-scanning-centos","status":"publish","type":"post","link":"https:\/\/www.shineservers.com\/2013\/10\/13\/install-clamav-configure-daily-scanning-centos\/","title":{"rendered":"How to Install ClamAV and Configure Daily Scanning on CentOS"},"content":{"rendered":"<p>ClamAV is an open source (GPL) antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats on Linux. In this article, we will only be configuring ClamAV to run scheduled\/on-demand scans; not resident scans.<\/p>\n<h3>A. Install ClamAV<\/h3>\n<h5>1. Install EPEL repo<\/h5>\n<p>Before we can do proceed, you must ensure that you have the EPEL yum repository enabled.<\/p>\n<p>The EPEL repo is enabled by simply installing an RPM. Please use the command below to install the EPEL repository on your CentOS server.<\/p>\n<h4>CentOS 6 \u2013 32-bit<\/h4>\n<div id=\"highlighter_391443\">\n<table>\n<tbody>\n<tr>\n<td><code>\u00a0<\/code><\/td>\n<td><code>rpm -Uvh\u00a0<a href=\"http:\/\/mirror.overthewire.com.au\/pub\/epel\/6\/i386\/epel-release-6-8.noarch.rpm\">http:\/\/mirror.overthewire.com.au\/pub\/epel\/6\/i386\/epel-release-6-8.noarch.rpm<\/a><\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h4>\u00a0CentOS 6 \u2013 64-bit<\/h4>\n<div id=\"highlighter_177804\">\n<table>\n<tbody>\n<tr>\n<td><code>\u00a0<\/code><\/td>\n<td><code>rpm -Uvh\u00a0<a href=\"http:\/\/download.fedoraproject.org\/pub\/epel\/6\/x86_64\/epel-release-6-8.noarch.rpm\">http:\/\/download.fedoraproject.org\/pub\/epel\/6\/x86_64\/epel-release-6-8.noarch.rpm<\/a><\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h4>\u00a0CentOS 5 \u2013 32-bit<\/h4>\n<div id=\"highlighter_287688\">\n<table>\n<tbody>\n<tr>\n<td><code>\u00a0<\/code><\/td>\n<td><code>rpm -Uvh\u00a0<a href=\"http:\/\/dl.fedoraproject.org\/pub\/epel\/5\/i386\/epel-release-5-4.noarch.rpm\">http:\/\/dl.fedoraproject.org\/pub\/epel\/5\/i386\/epel-release-5-4.noarch.rpm<\/a><\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<h4>\u00a0CentOS 5 \u2013 64-bit<\/h4>\n<div id=\"highlighter_915678\">\n<table>\n<tbody>\n<tr>\n<td><code>\u00a0<\/code><\/td>\n<td><code>rpm -Uvh\u00a0<a href=\"http:\/\/dl.fedoraproject.org\/pub\/epel\/5\/x86_64\/epel-release-5-4.noarch.rpm\">http:\/\/dl.fedoraproject.org\/pub\/epel\/5\/x86_64\/epel-release-5-4.noarch.rpm<\/a><\/code><\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<\/div>\n<p>After running the above commands for your relevant CentOS version, the following file is created:<\/p>\n<pre>\/etc\/yum.repos.d\/epel.repo<\/pre>\n<p>The above file can be edited directly to enable or disable the EPEL repo.<\/p>\n<h5>2. Install required packages<\/h5>\n<pre title=\"Install clamav and clamd\">yum install clamav clamd<\/pre>\n<h5>3. Start the clamd service and set it to auto-start<\/h5>\n<pre>chkconfig clamd on\n\/etc\/init.d\/clamd start<\/pre>\n<h5>4. Update ClamAV\u2019s signatures<\/h5>\n<pre>\/usr\/bin\/freshclam<\/pre>\n<p>Note: ClamAV will update automatically, as part of \/etc\/cron.daily\/freshclam.<\/p>\n<h3>B. Configure Daily Scan<\/h3>\n<p>In this example, we will configure a cronjob to scan the \/home\/ directory every day:<\/p>\n<h5>1. Create cron file:<\/h5>\n<pre>vim \/etc\/cron.daily\/manual_clamscan<\/pre>\n<p>Add the following to the file above. Be sure to change SCAN_DIR to the directory that you want to scan:<\/p>\n<pre>#!\/bin\/bash\nSCAN_DIR=\"\/home\"\nLOG_FILE=\"\/var\/log\/clamav\/manual_clamscan.log\"\n\n\/usr\/bin\/clamscan -i -r $SCAN_DIR &gt;&gt; $LOG_FILE<\/pre>\n<p>Give our cron script executable permissions:<\/p>\n<pre>chmod +x \/etc\/cron.daily\/manual_clamscan<\/pre>\n<p>You can even run the above script to ensure that it works correctly.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>ClamAV is an open source (GPL) antivirus engine designed for detecting Trojans, viruses, malware and other malicious threats on Linux. In this article, we will only be configuring ClamAV to run scheduled\/on-demand scans; not resident scans. A. Install ClamAV 1. Install EPEL repo Before we can do proceed, you must ensure that you have the [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"inline_featured_image":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[58,60],"tags":[139],"class_list":["post-357","post","type-post","status-publish","format-standard","hentry","category-cpanel-control-panel","category-linux","tag-install-clamav-on-centos"],"acf":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts\/357","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/comments?post=357"}],"version-history":[{"count":0,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/posts\/357\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/media?parent=357"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/categories?post=357"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.shineservers.com\/wp-json\/wp\/v2\/tags?post=357"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}