diff --git a/translated/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md b/published/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md similarity index 52% rename from translated/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md rename to published/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md index 7596a615dc..e57a711a68 100644 --- a/translated/tech/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md +++ b/published/20191027 How to Install and Configure Nagios Core on CentOS 8 - RHEL 8.md @@ -1,67 +1,64 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11572-1.html) [#]: subject: (How to Install and Configure Nagios Core on CentOS 8 / RHEL 8) [#]: via: (https://www.linuxtechi.com/install-nagios-core-rhel-8-centos-8/) [#]: author: (James Kiarie https://www.linuxtechi.com/author/james/) -如何在 CentOS 8 / RHEL 8 上安装和配置 Nagios Core +如何在 CentOS 8/RHEL 8 上安装和配置 Nagios Core ====== -**Nagios** 是一个免费开源网络和警报引擎,它用于监视各种设备,例如网络设备和网络中的服务器。它支持 **Linux** 和 **Windows**,并提供直观的 Web 界面,可让你轻松监控网络资源。经过专业配置后,它可以在服务器或网络设备下线或者故障时向你发出邮件警报。在本文中,我们说明了如何在 **RHEL 8** / **CentOS 8** 上安装和配置 Nagios Core。 +Nagios 是一个自由开源的网络和警报引擎,它用于监控各种设备,例如网络设备和网络中的服务器。它支持 Linux 和 Windows,并提供了直观的 Web 界面,可让你轻松监控网络资源。经过专业配置后,它可以在服务器或网络设备下线或者故障时向你发出邮件警报。在本文中,我们说明了如何在 RHEL 8/CentOS 8 上安装和配置 Nagios Core。 -[![Install-Nagios-Core-RHEL8-CentOS8][1]][2] +![Install-Nagios-Core-RHEL8-CentOS8][2] ### Nagios Core 的先决条件 在开始之前,请先检查并确保有以下各项: - - * RHEL 8 / CentOS 8 的实例 - * 能通过 SSH 访问实例 + * RHEL 8/CentOS 8 环境 + * 能通过 SSH 访问该环境 * 快速稳定的互联网连接 - - 满足上述要求后,我们开始吧! ### 步骤 1:安装 LAMP -为了使 Nagios 能够按预期工作,你需要安装 LAMP 或其他网络托管软件,因为它们将在浏览器上运行。 为此,请执行以下命令: +为了使 Nagios 能够按预期工作,你需要安装 LAMP 或其他 Web 软件,因为它们将在浏览器上运行。为此,请执行以下命令: ``` # dnf install httpd mariadb-server php-mysqlnd php-fpm ``` -![Install-LAMP-stack-CentOS8][1] +![Install-LAMP-stack-CentOS8][3] -你需要确保 Apache Web 服务器已启动并正在运行。 为此,请使用以下命令启用并启动 Apache 服务器: +你需要确保 Apache Web 服务器已启动并正在运行。为此,请使用以下命令启用并启动 Apache 服务器: ``` # systemctl start httpd # systemctl enable httpd ``` -![Start-enable-httpd-centos8][1] +![Start-enable-httpd-centos8][4] -检查 Apache 服务器运行状态 +检查 Apache 服务器运行状态: ``` # systemctl status httpd ``` -![Check-status-httpd-centos8][1] +![Check-status-httpd-centos8][5] -接下来,我们需要启用并启动 MariaDB 服务器,运行以下命令 +接下来,我们需要启用并启动 MariaDB 服务器,运行以下命令: ``` # systemctl start mariadb # systemctl enable mariadb ``` -![Start-enable-MariaDB-CentOS8][1] +![Start-enable-MariaDB-CentOS8][6] 要检查 MariaDB 状态,请运行: @@ -69,7 +66,7 @@ # systemctl status mariadb ``` -![Check-MariaDB-status-CentOS8][1] +![Check-MariaDB-status-CentOS8][7] 另外,你可能会考虑加强或保护服务器,使其不容易受到未经授权的访问。要保护服务器,请运行以下命令: @@ -77,9 +74,9 @@ # mysql_secure_installation ``` -确保为你的 MySQL 实例设置一个强密码。对于后续提示,请输入 **Yes** 并按**回车** +确保为你的 MySQL 实例设置一个强密码。对于后续提示,请输入 “Y” 并按回车。 -![Secure-MySQL-server-CentOS8][1] +![Secure-MySQL-server-CentOS8][8] ### 步骤 2:安装必需的软件包 @@ -89,7 +86,7 @@ # dnf install gcc glibc glibc-common wget gd gd-devel perl postfix ``` -![Install-requisite-packages-CentOS8][1] +![Install-requisite-packages-CentOS8][9] ### 步骤 3:创建 Nagios 用户帐户 @@ -100,7 +97,7 @@ # passwd nagios ``` -![Create-new-user-for-Nagios][1] +![Create-new-user-for-Nagios][10] 现在,我们需要为 Nagios 创建一个组,并将 Nagios 用户添加到该组中。 @@ -108,37 +105,37 @@ # groupadd nagiosxi ``` -现在添加 Nagios 用户到组中 +现在添加 Nagios 用户到组中: ``` # usermod -aG nagiosxi nagios ``` -另外,将 Apache 用户添加到 Nagios 组 +另外,将 Apache 用户添加到 Nagios 组: ``` # usermod -aG nagiosxi apache ``` -![Add-Nagios-group-user][1] +![Add-Nagios-group-user][11] ### 步骤 4:下载并安装 Nagios Core 现在,我们可以继续安装 Nagios Core。Nagios 4.4.5 的最新稳定版本于 2019 年 8 月 19 日发布。但首先,请从它的官方网站下载 Nagios tarball 文件。 -要下载 Nagios Core,请首进入 tmp 目录 +要下载 Nagios Core,请首进入 `/tmp` 目录: ``` # cd /tmp ``` -接下来下载 tarball 文件 +接下来下载 tarball 文件: ``` # wget https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz ``` -![Download-Nagios-CentOS8][1] +![Download-Nagios-CentOS8][12] 下载完 tarball 文件后,使用以下命令将其解压缩: @@ -146,13 +143,13 @@ # tar -xvf nagios-4.4.5.tar.gz ``` -接下来,进入未压缩的文件夹 +接下来,进入未压缩的文件夹: ``` # cd nagios-4.4.5 ``` -按此顺序运行以下命令 +按此顺序运行以下命令: ``` # ./configure --with-command-group=nagcmd @@ -173,7 +170,7 @@ ### 步骤 5:配置 Apache Web 服务器身份验证 -接下来,我们将为用户 **nagiosadmin** 设置身份验证。请注意不要更改用户名,否则,可能会要求你进一步的配置,这可能很繁琐。 +接下来,我们将为用户 `nagiosadmin` 设置身份验证。请注意不要更改该用户名,否则,可能会要求你进一步的配置,这可能很繁琐。 要设置身份验证,请运行以下命令: @@ -181,11 +178,11 @@ # htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin ``` -![Configure-Apache-webserver-authentication-CentOS8][1] +![Configure-Apache-webserver-authentication-CentOS8][13] -系统将提示你输入 nagiosadmin 用户的密码。输入并按要求确认密码。在本教程结束时,你将使用该用户登录 Nagios。 +系统将提示你输入 `nagiosadmin` 用户的密码。输入并按要求确认密码。在本教程结束时,你将使用该用户登录 Nagios。 -为使更改生效,请重新启动 Web 服务器。 +为使更改生效,请重新启动 Web 服务器: ``` # systemctl restart httpd @@ -193,20 +190,20 @@ ### 步骤 6:下载并安装 Nagios 插件 -插件将扩展 Nagios 服务器的功能。它们将帮助你监控各种服务、网络设备和应用。要下载插件 tarball 文件,请运行以下命令: +插件可以扩展 Nagios 服务器的功能。它们将帮助你监控各种服务、网络设备和应用。要下载插件的 tarball 文件,请运行以下命令: ``` # wget https://nagios-plugins.org/download/nagios-plugins-2.2.1.tar.gz ``` -接下来,解压 tarball 文件并进入到未压缩的插件文件夹 +接下来,解压 tarball 文件并进入到未压缩的插件文件夹: ``` # tar -xvf nagios-plugins-2.2.1.tar.gz # cd nagios-plugins-2.2.1 ``` -要安装插件,请编译源代码,如下所示 +要安装插件,请编译源代码,如下所示: ``` # ./configure --with-nagios-user=nagios --with-nagios-group=nagiosxi @@ -222,18 +219,18 @@ # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg ``` -![Verify-Nagios-settings-CentOS8][1] +![Verify-Nagios-settings-CentOS8][14] -接下来,启动 Nagios 并验证其状态 +接下来,启动 Nagios 并验证其状态: ``` # systemctl start nagios # systemctl status nagios ``` -![Start-check-status-Nagios-CentOS8][1] +![Start-check-status-Nagios-CentOS8][15] -如果系统中有防火墙,那么使用以下命令允许 ”80“ 端口 +如果系统中有防火墙,那么使用以下命令允许 ”80“ 端口: ``` # firewall-cmd --permanent --add-port=80/tcp# firewall-cmd --reload @@ -241,17 +238,15 @@ ### 步骤 8:通过 Web 浏览器访问 Nagios 面板 -要访问 Nagios,请打开服务器的 IP 地址,如下所示 +要访问 Nagios,请打开服务器的 IP 地址,如下所示: 。 - +这将出现一个弹出窗口,提示输入我们在步骤 5 创建的用户名和密码。输入凭据并点击“Sign In”。 -这将出现一个弹出窗口,提示输入我们在步骤 5 创建的用户名和密码。输入凭据并点击”**登录**“ +![Access-Nagios-via-web-browser-CentOS8][16] -![Access-Nagios-via-web-browser-CentOS8][1] +这将引导你到 Nagios 面板,如下所示: -这将引导你到 Nagios 面板,如下所示 - -![Nagios-dashboard-CentOS8][1] +![Nagios-dashboard-CentOS8][17] 我们终于成功地在 CentOS 8 / RHEL 8 上安装和配置了 Nagios Core。欢迎你的反馈。 @@ -262,11 +257,26 @@ via: https://www.linuxtechi.com/install-nagios-core-rhel-8-centos-8/ 作者:[James Kiarie][a] 选题:[lujun9972][b] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]: https://www.linuxtechi.com/author/james/ [b]: https://github.com/lujun9972 -[1]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 [2]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Install-Nagios-Core-RHEL8-CentOS8.jpg +[3]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Install-LAMP-stack-CentOS8.jpg +[4]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Start-enable-httpd-centos8.jpg +[5]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Check-status-httpd-centos8.jpg +[6]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Start-enable-MariaDB-CentOS8.jpg +[7]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Check-MariaDB-status-CentOS8.jpg +[8]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Secure-MySQL-server-CentOS8.jpg +[9]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Install-requisite-packages-CentOS8.jpg +[10]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Create-new-user-for-Nagios.jpg +[11]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Add-Nagios-group-user.jpg +[12]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Download-Nagios-CentOS8.jpg +[13]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Configure-Apache-webserver-authentication-CentOS8.jpg +[14]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Verify-Nagios-settings-CentOS8.jpg +[15]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Start-check-status-Nagios-CentOS8.jpg +[16]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Access-Nagios-via-web-browser-CentOS8.jpg +[17]: https://www.linuxtechi.com/wp-content/uploads/2019/10/Nagios-dashboard-CentOS8.jpg + diff --git a/translated/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md b/published/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md similarity index 83% rename from translated/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md rename to published/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md index a11cc0ea4c..6d380030f0 100644 --- a/translated/tech/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md +++ b/published/20191106 How to Schedule and Automate tasks in Linux using Cron Jobs.md @@ -1,8 +1,8 @@ [#]: collector: (lujun9972) [#]: translator: (wxy) -[#]: reviewer: ( ) -[#]: publisher: ( ) -[#]: url: ( ) +[#]: reviewer: (wxy) +[#]: publisher: (wxy) +[#]: url: (https://linux.cn/article-11571-1.html) [#]: subject: (How to Schedule and Automate tasks in Linux using Cron Jobs) [#]: via: (https://www.linuxtechi.com/schedule-automate-tasks-linux-cron-jobs/) [#]: author: (Pradeep Kumar https://www.linuxtechi.com/author/pradeep/) @@ -10,17 +10,17 @@ 如何使用 cron 任务在 Linux 中计划和自动化任务 ====== -有时,你可能需要定期执行任务或以预定的时间间隔执行任务。这些任务包括备份数据库、更新系统、执行定期重新引导等。这些任务称为 “cron 任务”。cron 任务用于“自动执行的任务”,它有助于简化重复的、有时是乏味的任务的执行。cron 是一个守护进程,可让你调度这些任务,然后按指定的时间间隔执行这些任务。在本教程中,你将学习如何使用 cron 来调度任务。 +有时,你可能需要定期或以预定的时间间隔执行任务。这些任务包括备份数据库、更新系统、执行定期重新引导等。这些任务称为 “cron 任务”。cron 任务用于“自动执行的任务”,它有助于简化重复的、有时是乏味的任务的执行。cron 是一个守护进程,可让你安排这些任务,然后按指定的时间间隔执行这些任务。在本教程中,你将学习如何使用 cron 来安排任务。 ![Schedule -tasks-in-Linux-using cron][2] ### crontab 文件 -crontab 即 “cron table”,是一个简单的文本文件,其中包含指定任务执行时间间隔的规则或命令。 crontab 文件分为两类: +crontab 即 “cron table”,是一个简单的文本文件,其中包含指定任务执行时间间隔的规则和命令。 crontab 文件分为两类: 1)系统范围的 crontab 文件 -这些通常由需要 root 特权的 Linux 服务及关键应用程序使用。系统 crontab 文件位于 `/etc/crontab` 中,并且只能由 root 用户访问和编辑。通常用于配置系统范围的守护程序。`crontab` 文件的看起来类似如下所示: +这些通常由需要 root 特权的 Linux 服务及关键应用程序使用。系统 crontab 文件位于 `/etc/crontab` 中,并且只能由 root 用户访问和编辑。通常用于配置系统范围的守护进程。`crontab` 文件的看起来类似如下所示: ![etc-crontab-linux][3] @@ -61,7 +61,7 @@ m h d moy dow /path/to/script * `d`:代表一个月中的某天,范围是 1 到 31 * `moy`:这是一年中的月份。范围是 1 到 12 * `doy`:这是星期几。范围是 0 到 6,其中 0 代表星期日 -* `Command`:这是要执行的命令,例如备份命令、重新启动和复制命令等 +* `command`:这是要执行的命令,例如备份命令、重新启动和复制命令等 ### 管理 cron 任务 @@ -87,7 +87,7 @@ m h d moy dow /path/to/script # crontab -u Pradeep -e ``` -如果该 crontab 文件尚不存在,那么你将打开一个空白文本文档。如果该 crontab 文件已经存在,则 `-e` 选项会让你编辑该文件, +如果该 crontab 文件尚不存在,那么你将打开一个空白文本文件。如果该 crontab 文件已经存在,则 `-e` 选项会让你编辑该文件, #### 列出 crontab 文件 @@ -109,9 +109,9 @@ m h d moy dow /path/to/script 然后,让我们看一下安排任务的不同方式。 -### crontab 安排任务示例 +### 使用 crontab 安排任务示例 -如图所示,所有 cron 任务文件都带有释伴标头。 +如图所示,所有 cron 任务文件都带有释伴shebang标头。 ``` #!/bin/bash @@ -121,7 +121,7 @@ m h d moy dow /path/to/script 接下来,使用我们之前指定的 cron 任务条目指定要安排任务的时间间隔。 -要每天下午 12:30 重新引导系统,请使用以下语法: +要每天下午 12:30 重启系统,请使用以下语法: ``` 30  12 *  *  * /sbin/reboot @@ -199,7 +199,7 @@ m h d moy dow /path/to/script 3)`@weekly` 时间戳等效于 `0 0 1 * mon` -它在每周的第一分钟执行 cron 任务,一周是从星期一开始的。 +它在每周的第一分钟执行 cron 任务,一周第一天是从星期一开始的。 ``` @weekly /path/to/script @@ -215,7 +215,7 @@ m h d moy dow /path/to/script 4)`@yearly` 时间戳等效于 `0 0 1 1 *` -它在每年的第一分钟执行任务,并且对发送新年问候很有用。 +它在每年的第一分钟执行任务,可以用于发送新年问候。 ``` @yearly /path/to/script @@ -223,7 +223,7 @@ m h d moy dow /path/to/script ### 限制 crontab -作为 Linux 用户,你可以控制谁有权使用 `crontab` 命令。可以使用 `/etc/cron.deny` 和 `/etc/cron.allow` 文件来控制。默认情况下,只有一个 `/etc/cron.deny` 文件,并且不包含任何条目。要限制用户使用 `crontab` 实用程序,只需将用户的用户名添加到文件中即可。当用户添加到该文件中,并且该用户尝试运行 `crontab` 命令时,他/她将遇到以下错误。 +作为 Linux 用户,你可以控制谁有权使用 `crontab` 命令。可以使用 `/etc/cron.deny` 和 `/etc/cron.allow` 文件来控制。默认情况下,只有一个 `/etc/cron.deny` 文件,并且不包含任何条目。要限制用户使用 `crontab` 实用程序,只需将用户的用户名添加到该文件中即可。当用户添加到该文件中,并且该用户尝试运行 `crontab` 命令时,他/她将遇到以下错误。 ![restricted-cron-user][4] @@ -235,7 +235,7 @@ m h d moy dow /path/to/script ### 备份 crontab 条目 -始终建议你备份 crontab 条目。为此,请使用语法 +始终建议你备份 crontab 条目。为此,请使用语法: ``` # crontab -l > /path/to/file.txt @@ -276,7 +276,7 @@ via: https://www.linuxtechi.com/schedule-automate-tasks-linux-cron-jobs/ 作者:[Pradeep Kumar][a] 选题:[lujun9972][b] 译者:[wxy](https://github.com/wxy) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出