アンチウイルスソフトのインストール
AlmaLinuxへアンチウイルスソフト(Clam AntiVirus)をインストールします。
以下のコマンドを実行してインストールします。
dnf install -y epel-release
dnf --enablerepo=epel -y install clamav clamav-update clamav-scanner-systemd
以下のコマンドを実行しウイルス定義ファイルを最新化します。
freshclam
以下のコマンドを実行し設定ファイルを編集します。
vi /etc/clamd.d/scan.conf
iを押下し編集モードにします。
root権限で動作するように変更にします。
# Run as another user (clamd must be started by root for this option to work)
# Default: don't drop privileges
#User clamscan ←コメントアウト
# Path to a local socket file the daemon will listen on.
# Default: disabled (must be specified by a user)
LocalSocket /run/clamd.scan/clamd.sock ←コメントアウトを削除
ESCキーを押下し:wqで上書き保存します。
以下のコマンドを実行し実行ファイルを編集します。
vi /lib/systemd/system/clamd@.service
iを押下し編集モードにします。
TimeoutStartSecを600に設定します(起動エラー対策)
TimeoutStartSec=600
ESCキーを押下し:wqで上書き保存します。
以下のコマンドを実行し、設定を反映させます。
systemctl daemon-reload
以下のコマンドを実行し開始します。
systemctl start clamd@scan
systemctl start clamav-freshclam
以下のコマンドを実行しサービスを有効化させます。
systemctl enable clamd@scan
systemctl enable clamav-freshclam
ウイルススキャンを実行します。
clamdscan -c /etc/clamd.d/scan.conf --remove