{"id":3526,"date":"2009-04-27T19:39:41","date_gmt":"2009-04-27T23:39:41","guid":{"rendered":"http:\/\/underhost.com\/blog\/?p=3526"},"modified":"2025-03-07T08:25:00","modified_gmt":"2025-03-07T13:25:00","slug":"install-clamav-in-centos-with-cpanel","status":"publish","type":"post","link":"https:\/\/underhost.com\/blog\/install-clamav-in-centos-with-cpanel\/","title":{"rendered":"Updated MARCH 2025: How to Install and Configure ClamAV Antivirus on a VPS or Dedicated Server"},"content":{"rendered":"<h2><strong>Why Install Antivirus on Your Server?<\/strong><\/h2>\n<p>\nIf you run a <a href=\"https:\/\/underhost.com\/offshore-vps.php\">VPS<\/a> or <a href=\"https:\/\/underhost.com\/dedicated-servers-offshore.php\">Dedicated Server<\/a>, having an antivirus is essential. Malware, worms, and trojans can infiltrate your server unnoticed, compromising security and data integrity.\n<\/p>\n<p>\nClamAV is a free, open-source antivirus designed for Linux servers, offering powerful malware detection and email filtering. Below are the steps to install and configure it on your server.\n<\/p>\n<h2><strong>Installing ClamAV on cPanel\/WHM<\/strong><\/h2>\n<p>\nThe easiest way to install ClamAV on a cPanel server is via WHM\u2019s plugin installer:\n<\/p>\n<pre>\r\nWHM > Cpanel Install Plugin > Enable ClamAV Connector\r\n<\/pre>\n<p>\nOnce installed, ClamAV will be available for scanning files and emails directly through WHM and cPanel.\n<\/p>\n<h2><strong>Manual Installation of ClamAV on CentOS\/AlmaLinux<\/strong><\/h2>\n<p>\nTo install ClamAV manually via SSH, run the following command as root:\n<\/p>\n<pre>\r\nyum install clamd\r\n<\/pre>\n<p>\nIf the above doesn\u2019t work, try:\n<\/p>\n<pre>\r\nyum install clamav\r\n<\/pre>\n<h3><strong>Alternative Installation Using RPMForge Repository<\/strong><\/h3>\n<p>\nIf ClamAV is not available in your default repositories, you may need to install the RPMForge repo:\n<\/p>\n<pre>\r\nrpm -Uhv http:\/\/apt.sw.be\/packages\/rpmforge-release\/rpmforge-release-0.3.6-1.el4.rf.i386.rpm\r\n<\/pre>\n<p>\nOnce the repository is added, retry installing ClamAV:\n<\/p>\n<pre>\r\nyum install clamd\r\n[OR]\r\nyum install clamav\r\n<\/pre>\n<h2><strong>Basic ClamAV Commands<\/strong><\/h2>\n<h3><strong>1. Update the Antivirus Database<\/strong><\/h3>\n<p>\nBefore scanning, update the virus definitions to ensure ClamAV can detect the latest threats:\n<\/p>\n<pre>\r\nfreshclam\r\n<\/pre>\n<h3><strong>2. Scan a Directory for Malware<\/strong><\/h3>\n<p>\nTo manually scan the <code>\/home<\/code> directory for infected files, run:\n<\/p>\n<pre>\r\nclamscan -r \/home\r\n<\/pre>\n<h3><strong>3. Automate Daily Scanning with a Cron Job<\/strong><\/h3>\n<p>\nTo schedule an automatic daily scan at 1:02 AM, edit the crontab file:\n<\/p>\n<pre>\r\ncrontab -e\r\n<\/pre>\n<p>\nAdd the following line and save the file:\n<\/p>\n<pre>\r\n02 1 * * * root clamscan -R \/home\r\n<\/pre>\n<p>\nThis will scan the <code>\/home<\/code> directory every day. You can modify the path to scan other directories, such as mail folders.\n<\/p>\n<h2><strong>Why Choose UnderHost for Secure Hosting?<\/strong><\/h2>\n<p>\nA secure hosting environment is key to preventing malware infections. UnderHost offers <a href=\"https:\/\/underhost.com\/managed-business-hosting.php\">Managed Hosting<\/a> solutions with built-in security features, regular virus scans, and expert support.\n<\/p>\n<p>\nFor more information, visit <a href=\"https:\/\/customerpanel.ca\/client\">UnderHost Customer Panel<\/a>.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Protect your Linux server from malware, trojans, and viruses by installing ClamAV. Learn how to install, update, and schedule automatic scans on cPanel or manually via SSH.<\/p>\n","protected":false},"author":1,"featured_media":5015,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[33,3],"tags":[],"class_list":["post-3526","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-centos","category-controlpanel"],"_links":{"self":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts\/3526","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/comments?post=3526"}],"version-history":[{"count":3,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts\/3526\/revisions"}],"predecessor-version":[{"id":5097,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/posts\/3526\/revisions\/5097"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/media\/5015"}],"wp:attachment":[{"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/media?parent=3526"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/categories?post=3526"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/underhost.com\/blog\/wp-json\/wp\/v2\/tags?post=3526"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}