首页 > 网络应用 > 在 Ubuntu/Debian 安装 Cacti 1.x

1784

浏览

0

评论

在 Ubuntu/Debian 安装 Cacti 1.x

作者:stephen | 分类:网络应用 | 标签:

安装 LAMP 

apt-get updateapt-get install -y apache2 rrdtool mariadb-server snmp snmpd php7.0 php-mysql php7.0-snmp php7.0-xml php7.0-mbstring php7.0-json php7.0-gd php7.0-gmp php7.0-zip php7.0-ldap php7.0-mc

下载仙人掌软件

安装操作系统软件包后,您将需要下载 Cacti 文件,您可以使用 git 命令执行此操作

git clone -b 1.2.x  https://github.com/Cacti/cacti.gitCloning into 'cacti'...remote: Enumerating objects: 81, done.remote: Counting objects: 100% (81/81), done.remote: Compressing objects: 100% (55/55), done.remote: Total 59936 (delta 40), reused 51 (delta 26), pack-reused 59855&Receiving objects: 100% (59936/59936), 76.33 MiB | 1.81 MiB/s, done.Resolving deltas: 100% (43598/43598), done.

克隆 Cacti 存储库后,将文件移动到 /var/www/html 目录中

mv cacti /var/www/html

数据库创建

接下来我们将创建一个供 cacti 安装使用的数据库

mysql -u root -pCREATE DATABASE cacti DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci ;GRANT ALL PRIVILEGES ON cacti.* TO 'cacti'@'localhost' IDENTIFIED BY 'cacti';GRANT SELECT ON mysql.time_zone_name TO cacti@localhost;ALTER DATABASE cacti CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;FLUSH PRIVILEGES;

您现在需要预先填充 cacti 使用的数据库

mysql -u root cacti < /var/www/html/cacti/cacti.sql

接下来,您需要在 /var/www/html/cacti/include 中创建 config.php 文件

cd /var/www/html/cacti/includecp config.php.dist config.php

现在,编辑 config.php 文件并确保根据需要更改数据库设置以匹配以下条目(尽管为了安全,强烈建议使用自定义的用户名/密码组合)

$database_type     = 'mysql';$database_default  = 'cacti';$database_hostname = 'localhost';$database_username = 'cactiuser';$database_password = 'cactiuser';$database_port     = '3306';$database_retries  = 5;$database_ssl      = false;$database_ssl_key  = '';

创建您的 cron 任务文件或 systemd 单位文件

从 Cacti 1.2.16 开始,您可以选择使用旧的 Crontab 条目或可选的 cactid 单位文件和服务器来运行您的 Cacti 轮询器。

对于 Crontab 使用,请按照以下说明操作:

创建和编辑/etc/cron.d/cacti文件。确保设置正确的 poller.php 路径

   */5 * * * * apache php /var/www/html/cacti/poller.php &>/dev/null

对于 systemd 单元的文件安装,您需要修改包含的单元文件以遵循您的安装位置和所需的用户和组来运行 Cacti 轮询器。要完成任务,请按照以下步骤操作:

   vim /var/www/html/cacti/service/cactid.service (edit the path)
   touch /etc/sysconfig/cactid
   cp -p /var/www/html/cacti/service/cactid.service /etc/systemd/system
   systemctl enable cactid
   systemctl start cactid
   systemctl status cactid

systemd 单元文件使管理高度可用的 Cacti 设置更加方便。

系统现在可以通过浏览到http://serverip/cacti来启动 cacti 初始化向导来完成这些步骤 


本文链接:https://www.stephenwxf.com/post/162.html
原创文章如转载请注明:转载自王显璠的个人博客谢谢!

Copyright Your stephenwxf.com Rights Reserved.