centos 8 开源

    科技2022-08-02  105

    centos 8 开源

    Introduction Linux operating systems are considered to be more stable and secure than other operating systems. However, viruses and threats can live anywhere and Linux may not be completely immune to threats. Viruses can harm systems regardless the operating system used. Installing an antivirus to a Linux server can protect it from malware, viruses or any malicious attacks.

    简介 Linux操作系统被认为比其他操作系统更稳定和安全。 但是,病毒和威胁可能存在于任何地方,Linux可能无法完全抵抗威胁。 无论使用哪种操作系统,病毒都可能损害系统。 在Linux服务器上安装防病毒软件可以保护其免受恶意软件,病毒或任何恶意攻击的侵害。

    There are plenty of antivirus options out there for Linux servers but in this tutorial, we are going to use ClamAV, an open-source antivirus solution against security threats to install on CentOS distribution. It is used for detecting Trojans, viruses, malware and other malicious threats. It’s a standard for mail gateway scanning software and supports almost all mail file formats. It can scan within archives and compressed files (also protects against archive bombs), the built-in support includes Zip, Tar, 7Zip, Rar among others.

    Linux服务器上有很多防病毒选项,但是在本教程中,我们将使用ClamAV (一种针对安全威胁的开源防病毒解决方案)安装在CentOS发行版上。 它用于检测木马,病毒,恶意软件和其他恶意威胁。 它是邮件网关扫描软件的标准,几乎支持所有邮件文件格式。 它可以扫描档案和压缩文件(还可以防止档案炸弹),内置支持包括Zip,Tar,7Zip,Rar等。

    Requirements In this tutorial, you only need a CentOS 7 server and a root or sudo access. ClamAV does not require any dependencies or special hardware for it to work. If you are logged in as non-root user, you can use sudo command.

    要求在本教程中,您仅需要CentOS 7服务器和root或sudo访问权限。 ClamAV不需要任何依赖关系或特殊硬件即可运行。 如果您以非root用户身份登录,则可以使用sudo命令。

    Tutorial

    讲解

    1. Before we install ClamAV, let’s first update the system and packages using the command below:

    1.在安装ClamAV之前,首先使用以下命令更新系统和软件包:

    yum -y update

    yum -y更新

    2. After updating the system, we need to add the EPEL repository in the CentOS by running the following commands below:

    2.更新系统后,我们需要通过运行以下命令在CentOS中添加EPEL存储库:

    yum -y install epel-release

    yum -y安装epel-release

    yum clean all

    百胜清理所有

    3. By default, ClamAV is not available in the default repository of CentOS. Let’s install ClamAV on the server by simply running the following command:

    3.默认情况下,ClamAV在CentOS的默认存储库中不可用。 让我们通过简单地运行以下命令在服务器上安装ClamAV:

    sudo yum -y install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd

    sudo yum -y install clamav-server clamav-data clamav-update clamav-filesystem clamav clamav-scanner-systemd clamav-devel clamav-lib clamav-server-systemd

    4. We now have installed ClamAV but we still need to make several additional configurations before we run it.

    4.现在,我们已经安装了ClamAV,但是在运行它之前,我们仍然需要进行一些其他配置。

    Since we are working on CentOS, it comes with SELinux, a security measure aimed at protecting changes to some files. Thus, SELinux may deny access to files, which will generate errors and warning.

    由于我们正在使用CentOS,因此它带有SELinux,这是一种安全措施,旨在保护对某些文件的更改。 因此,SELinux可能拒绝对文件的访问,这将生成错误和警告。

    What we can do so that ClamAV can access all the files in the server is either:

    为了使ClamAV可以访问服务器中的所有文件,我们可以做的是:

    a. Disable SELinux

    一个。 禁用SELinux

    setenforce 0

    setenforce 0

    or

    要么

    b. Modify SELinux configuration to allow ClamAV

    b。 修改SELinux配置以允许ClamAV

    setsebool -P antivirus_can_scan_system 1

    setsebool -P antivirus_can_scan_system 1

    setsebool -P clamd_use_jit 1

    setsebool -P clamd_use_jit 1

    5. To verify the status of SELinux for ClamAV, run the command below:

    5.要验证SELinux for ClamAV的状态,请运行以下命令:

    sudo getsebool -a | grep antivirus

    sudo getsebool -a | grep杀毒软件

    You should be able to get the following output:

    您应该能够得到以下输出:

    antivirus_can_scan_system — > on

    antivirus_can_scan_system-> 上

    antivirus_use_jit — > off

    antivirus_use_jit —> 关

    6. Now, let’s proceed in configuring ClamAV. We will need to modify the configuration file of ClamAV, which by default, is created at /etc/clamd.d/scan.conf. Before we can configure this, we need to remove or comment out the word ‘Example’ string from the configuration file:

    6.现在,让我们继续配置ClamAV。 我们将需要修改ClamAV的配置文件,默认情况下,该文件在/etc/clamd.d/scan.conf中创建。 在配置它之前,我们需要从配置文件中删除或注释掉单词“ Example”字符串:

    sed -i -e “s/^Example/#Example/” /etc/clamd.d/scan.conf

    sed -i -e“ s / ^ Example /#Example /” /etc/clamd.d/scan.conf

    Or you can just open the file in your editor and remove the text Example from the file.

    或者,您可以仅在编辑器中打开文件,然后从文件中删除文本“示例”。

    7. Open the scanner configuration file in your editor, uncomment the line #LocalSocket /var/run/clamd.scan/clamd.sock to

    7.在编辑器中打开扫描仪配置文件,将#LocalSocket /var/run/clamd.scan/clamd.sock行取消注释为

    LocalSocket /var/run/clamd.scan/clamd.sock

    LocalSocket /var/run/clamd.scan/clamd.sock

    8. We can now run Freshclam using the following command:

    8.现在,我们可以使用以下命令运行Freshclam:

    freshclam

    鲜蛤

    The output should be something like this:

    输出应该是这样的:

    To check if the database is up to date or not, run the same command freshclam again, if any update is available, it will update it or it will show you that everything is up to date.

    要检查数据库是否是最新的,请再次运行相同的命令freshclam,如果有可用的更新,它将对其进行更新,或者将向您显示所有内容都是最新的。

    9. To start the service and enable it to automatically start at boot time, run the following command:

    9.要启动该服务并使它能够在启动时自动启动,请运行以下命令:

    systemctl start freshclam

    systemctl启动FreshClam

    systemctl enable freshclam

    systemctl启用freshclam

    10. You can also check the status of our newly created freshclam service using the command below:

    10.您还可以使用以下命令检查我们新创建的freshclam服务的状态:

    systemctl status freshclam

    systemctl状态新鲜

    The output should be something like this:

    输出应该是这样的:

    11. To start the scanner service of ClamAV, run this command:

    11.要启动ClamAV的扫描仪服务,请运行以下命令:

    systemctl start clamd@scan

    systemctl启动clamd @ scan

    12. To automatically start the service at boot time, run the following command.

    12.要在启动时自动启动服务,请运行以下命令。

    systemctl enable clamd@scan

    systemctl启用clamd @ scan

    13. To check the status of scanner service, run the command: systemctl status clamd@scan

    13.要检查扫描仪服务的状态,请运行以下命令:systemctl status clamd @ scan

    The output should be something like this:

    输出应该是这样的:

    You can also use clamconf utility to check the configuration files. This utility will display the configuration of config file clam.conf and freshclam.conf. It will display information about software settings, database, platform, and build information. To use this utility run the following command.

    您也可以使用clamconf实用程序来检查配置文件。 该实用程序将显示配置文件clam.conf和freshclam.conf的配置。 它将显示有关软件设置,数据库,平台和内部版本信息的信息。 要使用此实用程序,请运行以下命令。

    clamconf

    蛤conf

    The sample output of the command is:

    该命令的示例输出是:

    翻译自: https://medium.com/swlh/how-to-install-an-open-source-antivirus-on-centos-e1c09734096f

    centos 8 开源

    Processed: 0.013, SQL: 8