如何在 AlmaLinux 上安装仙人掌 9

Linux命令 Edge插件网 12个月前 (01-05) 235次浏览 已收录 0个评论

Cacti 是一款功能强大的开源基于 Web 的网络监控和绘图工具,设计为开源、行业标准数据记录工具 RRDtool 的前端应用程序。Cacti 利用 RRDtool 的数据存储和图形功能的强大功能,提供快速轮询器、高级图形模板、多种数据采集方法和开箱即用的用户管理功能 。所有这些都包含在一个直观、易于使用的界面中,对于局域网大小的安装以及具有数百个设备的复杂网络都很有意义

如何在 AlmaLinux 上安装仙人掌 9

在 AlmaLinux 上安装 Cacti 9

步骤 1。在安装任何新软件之前,最好先更新系统。使用以下命令更新 AlmaLinux 系统

<span class="pln">sudo dnf clean all
sudo dnf update</span>

第2步。安装 Apache 和 PHP。

首先,我们需要安装 Apache Web 服务器和 PHP。打开终端并键入以下命令:

<span class="pln">sudo dnf install httpd php</span><span class="pun">-</span><span class="pln">mysqlnd php</span><span class="pun">-</span><span class="pln">cli php</span><span class="pun">-</span><span class="pln">gd php</span><span class="pun">-</span><span class="pln">ldap php</span><span class="pun">-</span><span class="pln">odbc php</span><span class="pun">-</span><span class="pln">pdo php</span><span class="pun">-</span><span class="pln">pear php</span><span class="pun">-</span><span class="pln">xml php</span><span class="pun">-</span><span class="pln">xmlrpc php</span><span class="pun">-</span><span class="pln">mbstring php</span><span class="pun">-</span><span class="pln">snmp</span>

安装完成后,使用以下命令启动并启用 Apache 服务:

<span class="pln">sudo systemctl start httpd
sudo systemctl enable httpd</span>

第 3 步。安装 MySQL

接下来,通过执行以下命令安装 MySQL 数据库服务器:

<span class="pln">sudo dnf install mysql</span><span class="pun">-</span><span class="pln">server</span>

使用以下命令启动并启用 MySQL 服务:

<span class="pln">sudo systemctl start mysqld
sudo systemctl enable mysqld</span>

安装 MySQL 后,通过运行以下命令来保护安装:

<span class="pln">sudo mysql_secure_installation</span>

按照提示设置 root 密码并删除任何不安全的默认设置。

然后,为 Cacti 创建一个 MySQL 数据库和用户:

<span class="pln">sudo mysql </span><span class="pun">-</span><span class="pln">u root </span><span class="pun">-</span><span class="pln">p</span>

输入以下命令以创建数据库、用户并授予必要的权限:

<span class="pln">CREATE DATABASE cacti</span><span class="pun">;</span><span class="pln">
CREATE USER </span><span class="str">'cactiuser'</span><span class="pun">@</span><span class="str">'localhost'</span><span class="pln"> IDENTIFIED BY </span><span class="str">'your_password'</span><span class="pun">;</span><span class="pln">
GRANT ALL PRIVILEGES ON cacti</span><span class="pun">.*</span><span class="pln"> TO </span><span class="str">'cactiuser'</span><span class="pun">@</span><span class="str">'localhost'</span><span class="pun">;</span><span class="pln">
FLUSH PRIVILEGES</span><span class="pun">;</span><span class="pln">
EXIT</span><span class="pun">;</span>

your_password替换为强而唯一的密码。

第 4 步。在 AlmaLinux 上安装 Cacti 8.

现在,让我们从官方网站下载最新版本的仙人掌:

<span class="pln">cd </span><span class="pun">/</span><span class="pln">tmp
wget https</span><span class="pun">:</span><span class="com">//www.cacti.net/downloads/cacti-latest.tar.gz</span>

将下载的 tarball 解压到 Apache Web 服务器的文档根目录:

<span class="pln">sudo tar xzf cacti</span><span class="pun">-</span><span class="pln">latest</span><span class="pun">.</span><span class="pln">tar</span><span class="pun">.</span><span class="pln">gz </span><span class="pun">-</span><span class="pln">C </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">
sudo mv </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">cacti</span><span class="pun">-*</span> <span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">cacti</span>

第 5 步。配置 Cacti。

通过导入仙人掌来配置 Cacti 数据库SQL格式 文件:

<span class="pln">sudo mysql </span><span class="pun">-</span><span class="pln">u cactiuser </span><span class="pun">-</span><span class="pln">p cacti </span><span class="pun"><</span> <span class="str">/var/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">cacti</span><span class="pun">/</span><span class="pln">cacti</span><span class="pun">.</span><span class="pln">sql</span>

编辑 Cacti 配置文件以指定数据库凭据:

<span class="pln">sudo nano </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">cacti</span><span class="pun">/</span><span class="pln">include</span><span class="pun">/</span><span class="pln">config</span><span class="pun">.</span><span class="pln">php</span>

使用适当的值更新 $database_* 变量:

<span class="pln">$database_type </span><span class="pun">=</span> <span class="str">'mysql'</span><span class="pun">;</span><span class="pln">
$database_default </span><span class="pun">=</span> <span class="str">'cacti'</span><span class="pun">;</span><span class="pln">
$database_hostname </span><span class="pun">=</span> <span class="str">'localhost'</span><span class="pun">;</span><span class="pln">
$database_username </span><span class="pun">=</span> <span class="str">'cactiuser'</span><span class="pun">;</span><span class="pln">
$database_password </span><span class="pun">=</span> <span class="str">'your_password'</span><span class="pun">;</span><span class="pln">
$database_port </span><span class="pun">=</span> <span class="str">'3306'</span><span class="pun">;</span><span class="pln">
$database_ssl </span><span class="pun">=</span> <span class="kwd">false</span><span class="pun">;</span>

在 Cacti 的目录上设置适当的权限:

<span class="pln">sudo chown </span><span class="pun">-</span><span class="pln">R apache</span><span class="pun">:</span><span class="pln">apache </span><span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">cacti
sudo chmod </span><span class="pun">-</span><span class="pln">R </span><span class="lit">755</span> <span class="pun">/</span><span class="kwd">var</span><span class="pun">/</span><span class="pln">www</span><span class="pun">/</span><span class="pln">html</span><span class="pun">/</span><span class="pln">cacti</span>

在 /etc/crontab 文件中添加一行 以调度 Cacti 的轮询过程:

<span class="pln">echo </span><span class="str">"*/5 * * * * apache /usr/bin/php /var/www/html/cacti/poller.php > /dev/null 2>&1"</span> <span class="pun">|</span><span class="pln"> sudo tee </span><span class="pun">-</span><span class="pln">a </span><span class="pun">/</span><span class="pln">etc</span><span class="pun">/</span><span class="pln">crontab</span>

第 6 步。通过 Web UI 完成 Cacti 安装。

最后,通过在 Web 浏览器中导航到 http//your_server_ip/cacti 来访问 Cacti 安装程序 。按照屏幕上的提示完成安装过程,确保所有安装前检查都成功通过。

如何在 AlmaLinux 上安装仙人掌 9

感谢您使用本教程在您的 AlmaLinux 9 系统上安装 Cacti。如需更多帮助或有用信息,我们建议您查看仙人掌官方网站


Edge插件网 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:如何在 AlmaLinux 上安装仙人掌 9
喜欢 (0)
发表我的评论
取消评论
表情 贴图 加粗 删除线 居中 斜体 签到

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址