How to install CalmAV on AWS?

How to install CalmAV on AWS?

May 5, 2020 / Eternal Team

We have written a detailed blog explaining ClamAV. Please visit our blog of what is ClamAV and what it is used for to get started.

How to launch an EC2 instance ?

  • Step 1: Login In to your “AWS Console

  • Step 2: Click on “Services” on the top left corner of the console

  • Step 3: Select “EC2“ under compute section

  • Step 4: Click on “Running Instance

  • Step 5: Select “Launch Instance“ to launch a new instance ( If you have already have an server please jump to Step 17 )

  • Step 6: We are selecting “Ubuntu Server 18.04 LTS (HVM)“ ami for our instance

  • Step 7: Type of the instance is “t2.micro“ (we are using t2.micro for demonstration purposes, you can use your own setup)

  • Step 8: We are keeping all the configuration default in “Configure instance details
  • Click on “Next

  • Step 9: We are taking default as 8GB but you can extend it as you want “Add Storage
  • Click on “Next

  • Step 10: Add the Name tag as seen in the image below “Add Tags“ this is to give a name to your server
  • Click on “Next

  • Step 11: For now we only need 22 port open “Configure Security Group

  • Step 12: Review your server configuration and click on launch “Review & Launch

  • Step 13: Download of select the key pair “Key pair
  • Click on “Launch

  • Step 14: Check the status is “running“ of your instance

  • Step 15: Open terminal and locate your key pair file
  • Change the permissions of the downloaded key
$ chmod 400 key-pair-name.pem

  • Step 16: Login to your server with the below mentioned commands
$ ssh -i key-pair-name.pem ubuntu@public-ip

  • Step 17: To get the list of the latest packages of ubuntu server we need to update the server with the following command
$ sudo apt update

  • Step 18: Now we need to upgrade the server to install the latest packages so we need to upgrade the server
$ sudo apt upgrade -y

  • Step 19: Lets Install ClamAV in the server
$ sudo apt-get install clamav clamav-daemon -y

  • Step 20: Check the version to verify installation is done correctly
$ clamscan -v

Clamscan CLI Options and Example Usage

  • From the man pages, the clamscan command syntax is:
$ clamscan [options] [file/directory/-]
  • Some of the clamscan command options and their example usage is illustrated below;
  • -h, –help
    • Print help information and exit.
$ clamscan -h
  • -V, –version
    • Print version number and exit.
$ clamscan -V
  • -i, –infected
    • Only print infected files.
$ clamscan -i /home
  • -o, –suppress-ok-results
    • Skip printing OK files
    • –bell
    • Sound bell on virus detection.
$ clamscan -r --bell -i /home
  • -d FILE/DIR, –database=FILE/DIR
    • Load virus database from FILE or load all virus database files from DIR.
$ clamscan -d /tmp/newclamdb -r /tmp
  • -l FILE, –log=FILE
    • Save scan report to FILE.
  • -r, –recursive
    • Scan directories recursively. All the subdirectories in the given directory will be scanned.
$ clamscan -r --remove /
  • -f FILE, –file-list=FILE
    • Scan files listed line by line in FILE.
  • –remove[=yes/no(*)]
    • Remove infected files. Be careful as this removes the file completely.
$ clamscan -r --remove /home/USER
  • –move=DIRECTORY
    • SMove infected files into DIRECTORY. Directory must be writable for the user or unprivileged user running clamscan.
$ clamscan -r --move=/home/USER/VIRUS /home/
  • –copy=DIRECTORY
    • Copy infected files into DIRECTORY. Directory must be writable for the user or unprivileged user running clamscan.
$ clamscan -r --copy=/home/USER/VIRUS /home/

Talk to AWS Certified Consultant

    Want to start a project?

    It’s simple.

    Contact us