[an error occurred while processing this directive]
| ・ | Clam AntiVirus | : | clamav-0.93.1.tar.gz |
# groupadd -g clamav # useradd -g clamav -s /sbin/nologin -d /dev/null -M clamav/usr/local/srcディレクトリでアーカイブを展開しインストールします。
# cd /usr/local/src # tar xzvf ダウンロード先/clamav-0.93.1.tar.gz # cd clamav-0.93.1 # ./configure # make # make install
# vi /usr/local/etc/clamav.conf : # Comment or remove the line below. #Example コメントアウトします : #LogFile /tmp/clamd.log LogFile /var/log/clamd/clamd.log ログを出力します : #LogFileMaxSize 2M LogFileMaxSize 0 logrotateでログの容量管理を行います : #LogTime yes LogTime yes ログに日付と時間を入れます : #LogVerbose yes LogVerbose yes 詳細にログを出力します : #PidFile /var/run/clamd.pid PidFile /var/run/clamav/clamd.pid Pidファイルを作成します : #User clamav User clamav ユーザー権限を clamav に移行します : #AllowSupplementaryGroups no AllowSupplementaryGroups yes グループ権限も移行させます : #ScanPDF yes ScanPDF yes PDFファイルをスキャンの対象にします :pidファイル用のディレクトリを作成します。
# mkdir /var/run/clamav # chmod 775 /var/run/clamav # chown clamav.clamav /var/run/clamavログファイル用のディレクトリを作成します。
# mkdir /var/log/clamd # chmod 750 /var/log/clamd # chown clamav.clamav /var/log/clamd
# vi /usr/local/etc/freshclam.conf : # Comment or remove the line below. Example #Example コメントアウトします : #UpdateLogFile /var/log/freshclam.log UpdateLogFile /var/log/clamd/freshclam.log ログを出力します : #LogFileMaxSize 2M LogFileMaxSize 0 logrotateでログの容量管理を行います : #LogVerbose yes LogVerbose yes 詳細にログを出力します : #PidFile /var/run/freshclam.pid PidFile /var/run/clamav/freshclam.pid Pidファイルを作成します : #AllowSupplementaryGroups yes AllowSupplementaryGroups yes グループ権限も移行させます : #DatabaseMirror db.XY.clamav.net DatabaseMirror db.jp.clamav.net 国内のデータベースミラーサーバを指定します :パターンデータベースの自動更新を行うため、自動起動ファイルを作成します。
vi /etc/rc.d/init.d/freshclam #! /bin/bash # # freshclam Start/Stop the freshclam daemon. # # chkconfig: - 71 40 # description: freshclam is an update daemon for Clam AV database. # # processname: freshclam # config: /etc/local/etc/freshclam.conf # pidfile: /var/run/clamav/freshclam.pid # Source function library . /etc/init.d/functions # Get network config . /etc/sysconfig/network RETVAL=0 # See how we were called. prog="freshclam" progdir="/usr/local/bin" start() { echo -n $"Starting $prog: " daemon $progdir/$prog -d RETVAL=$? echo [ $RETVAL -eq 0 ] && touch /var/lock/subsys/freshclam return $RETVAL } stop() { echo -n $"Stopping $prog: " killproc $prog RETVAL=$? echo [ $RETVAL -eq 0 ] && rm -f /var/run/clamav/freshclam.pid /var/lock/subsys/freshclam return $RETVAL } restart() { stop start } reload() { echo -n $"Reloading DB: " killproc freshclam -ALRM RETVAL=$? echo return $RETVAL } case "$1" in start) start ;; stop) stop ;; status) status freshclam ;; restart) restart ;; condrestart) [ -f /var/lock/subsys/freshclam ] && restart || : ;; reload) reload ;; *) echo $"Usage: $0 {start|stop|status|restart|condrestart|reload}" exit 1 esac exit $?パターンデータベースの自動更新設定を行います。
# chmod 755 /etc/rc.d/init.d/freshclam # chkconfig freshclam on # service freshclam start
# cp /usr/local/src/clamav-0.93.1/contrib/init/RedHat/clamd /etc/rc.d/init.d/ # chmod 755 /etc/rc.d/init.d/clamd # chkconfig clamd on # service clamd start
vi /etc/logrotate.d/clamd /var/log/clamd/clamd.log { missingok postrotate /etc/rc.d/init.d/clamd restart > /dev/null || : endscript } /var/log/clamd/freshclam.log { missingok postrotate /etc/rc.d/init.d/freshclam restart > /dev/null || : endscript }
# vi /etc/log.d/conf/logfiles/clam-update.conf : LogFile = clam-update LogFile = clamd/clamd.log /var/log/からの相対位置にします LogFile = freshclam.log LogFile = clamd/freshclam.log : Archive = clam-update.* Archive = clamd/clamd.log.* Archive = freshclam.log.* Archive = clamd/freshclam.log.* Archive = clamav/freshclam.log.* Archive = archiv/clam-update.* Archive = archiv/clamd.log.* :[an error occurred while processing this directive]