Submitter: Doug Hunley

  1. Download ClamAV*
  2. untar the file
  3. create a group for clamav
  4. create a userid for clamav
  5. configure the program
  6. compile the program
    • make
  7. install the program
    • make install
  8. Configure /etc/clamav.conf
    • ##
      ## config file for Clam AV daemon
      ##
       
      # This option allows you to save the process identifier of the listening
      # daemon (main thread).
      PidFile /var/spool/MIMEDefang/clamd.pid
      
      # Path to a directory containing .db files.
      # Default is the hardcoded directory (mostly /usr/local/share/clamav,
      # it depends on installation options).
      DataDirectory /usr/share/clamav
       
      # The daemon works in local or network mode. Currently the local mode is
      # recommended for security reasons.
      
      # Path to the local socket. The daemon doesn't change the mode of the
      # created file (portability reasons). You may want to create it in a directory
      # which is only accessible for a user running daemon.
      LocalSocket /var/spool/MIMEDefang/clamd.sock
      
      # Maximal number of a threads running at the same time.
      # Default is 5, and it should be sufficient for a typical workstation.
      # You may need to increase threads number for a server machine.
      MaxThreads 200
      
      # Maximal depth the directories are scanned at.
      MaxDirectoryRecursion 15
      
      # Run as selected user (clamd must be started by root).
      # By default it doesn't drop priviledges.
      User mdefang
      
      ##
      ## Archive support
      ##
      
      # Comment this line to disable scanning of the archives.
      ScanArchive
      
      # Options below protect your system against Denial of Service attacks
      # with archive bombs.
      
      # Files in archives larger than this limit won't be scanned.
      # Value of 0 disables the limit.
      # WARNING: Due to the unrarlib implementation, whole files (one by one) in RAR
      #	   archives are decompressed to the memory. That's why never disable
      #	   this limit (but you may increase it of course!)
      ArchiveMaxFileSize 10M
      
      # Archives are scanned recursively - e.g. if Zip archive contains RAR file,
      # the RAR file will be decompressed, too (but only if recursion limit is set
      # at least to 1). With this option you may set the recursion level.
      # Value of 0 disables the limit.
      ArchiveMaxRecursion 5
      
      # Number of files to be scanned within archive.
      # Value of 0 disables the limit.
      ArchiveMaxFiles 1000
      			
  9. Create the signature-updater script
    • cat > clamav_update << "EOF"
    • #!/bin/sh
    • /usr/bin/freshclam --quiet --stdout --datadir /usr/share/clamav --log /var/tmp/clamav_update
    • EOF
  10. make the script executable
    • chmod 700 clamav_update
  11. copy the script to /etc/cron.hourly or create an entry in cron
  12. execute the script to update the software
  13. create a startup script (/etc/rc.d/clamav)
    • #!/bin/sh
      
      FOO_BIN=/usr/sbin/clamd
      test -x $FOO_BIN || exit 5
      
      case "$1" in
          start)
      	echo "Starting `$FOO_BIN -V`"
      	$FOO_BIN
      
      	;;
          stop)
      	echo "Shutting down `$FOO_BIN -V`"
      	killall $FOO_BIN
      
      	;;
          restart)
      	$0 stop
      	$0 start
      
      	;;
          *)
      	echo "Usage: $0 {start|stop|restart}"
      	exit 1
      	;;
      esac
      			
searchSearch Index