ClamAV - instalacja

Dodanie użytkownika clamav

# groupadd clamav
# useradd -g clamav -s /bin/false -c "Clam AntiVirus" clamav
 
Instalacja 
# ./configure --sysconfdir=/etc/clamav --datadir=/etc/clamav \ 
--with-dbdir=/etc/clamav 
 
# make && make install 
 
  
Przygotowanie katalogów
 

# chown -R clamav:clamav /etc/clamav
# mkdir /var/run/clamav; chown -R clamav:clamav /var/run/clamav
# mkdir /var/log/clamav; chown -R clamav:clamav /var/log/clamav
 
Konfiguracja clamav
 
/etc/clamav/clamd.conf  zakomentowanie słowa Example na początku pliku i ustawiamy parametry:


#Example
LogFile /var/log/clamav/clamd.log 
LogTime yes 
LogSyslog yes 
LogVerbose yes

PidFile /var/run/clamav/clamd.pid 
LocalSocket /var/run/clamav/clamd.socket 
FixStaleSocket yes 
TCPSocket 3310 
TCPAddr 127.0.0.1


ScanPDF yes 

 

 Konfiguracja freshclam.conf



#Example

UpdateLogFile /var/log/clamav/freshclam.log
LogVerbose yes
LogSyslog yes
PidFile /var/run/clamav/freshclam.pid
NotifyClamd /etc/clamav/clamd.conf
 
W przypadku problemów z uruchomieniem:
#ldconfig
#freshclam
#clamd start 

Skrypt daemona

#/etc/rc.d/init.d/clamd
#!/bin/sh
#
# Start clamd:
clamd_start() {
  if [ -x /usr/local/sbin/clamd ]; then
    echo "Starting clamd:  /usr/local/sbin/clamd"
    /usr/local/sbin/clamd
    echo "done."
  fi
  if [ -x /usr/local/bin/freshclam ]; then
    echo "Starting freshclam:  /usr/local/bin/freshclam"
    /usr/local/bin/freshclam -d
    echo "done."
  fi
}
 
# Stop clamd:
clamd_stop() {
  killall freshclam
  rm -rf /var/run/clamav/freshclam.pid
  killall clamd
  rm -rf /var/run/clamav/clamd.pid
  rm -rf /var/run/clamav/clamd.sock
}
 
# Restart clamd:
clamd_restart() {
  clamd_stop
  sleep 1
  clamd_start
}
 
case "$1" in
'start')
  clamd_start
  ;;
'stop')
  clamd_stop
  ;;
'restart')
  clamd_restart
  ;;
*)
  echo "usage $0 start|stop|restart"
esac

Nadajemy prawo wykonywalności:
# chmod a+x /etc/init.d/clamd


Dodajemy do rc.local:
/etc/rc.d/init.d/clamd start

Brak komentarzy:

Prześlij komentarz