CentOS-7 安裝cacti 0.8.8g

CentOS7 快速安裝cacti 筆記

安裝需要套件,利用yum來安裝解決相依性問題

yum install httpd mariadb-server php php-mysql php-pear php-gd php-mbstring net-snmp net-snmp-utils rrdtool

yum install epel-release

yum install cacti

此次安裝cacti 版本會是0.8.8g-1.el7

啟動及初始化資料庫(過程中會直接提是設定資料庫root密碼)

指令

systemctl enable mariadb
systemctl start mariadb
mysql_secure_installation

 

建立空白資料庫

[root@localhost ~]# mysql -u root -p -A mysql

Enter password:

Welcome to the MariaDB monitor. Commands end with ; or \g.

Your MariaDB connection id is 12

Server version: 5.5.47-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.

MariaDB [mysql]> create database cacti;

Query OK, 1 row affected (0.00 sec)

MariaDB [mysql]> grant all privileges on cacti.* to cacti@localhost identified by ‘password’;

Query OK, 0 rows affected (0.00 sec)

MariaDB [mysql]> flush privileges;

Query OK, 0 rows affected (0.01 sec)

MariaDB [mysql]> exit

上述藍色字體部分是設定可以存取資料庫的帳號及密碼(後面步驟會輸入)

clip_image002

匯入cacti 資料表

指令 : cacti-0.8.8g]# mysql -u root -p -A cacti < /usr/share/doc/cacti-0.8.8g/cacti.sql

clip_image004

設定httpd服務

vi /etc/httpd/conf.d/cacti.conf

<Directory /usr/share/cacti/>

<IfModule mod_authz_core.c>

# httpd 2.4

Require host localhost

Require ip 192.168.3.0/24 (設定允許連線管理介面的IP)

</IfModule>

<IfModule !mod_authz_core.c>

# httpd 2.2

Order deny,allow

Deny from all

Allow from localhost

</IfModule>

</Directory>

clip_image006

設定連線資料庫資訊(修改帳號密碼)

vi /etc/cacti/db.php

$database_type = “mysql”;

$database_default = “cacti”;

$database_hostname = “localhost”;

$database_username = “cacti”;

$database_password = “password”;

$database_port = “3306”;

$database_ssl = false;

clip_image007

修改php.ini

vi /etc/php.ini

要記得將前面分號去掉

date.timezone = Asia/Taipei

clip_image008

設定apache 及啟動

指令

systemctl enable httpd  => 開啟自動啟動
systemctl start httpd   => 啟動apache

修改排程

vi /etc/cron.d/cacti

取消註解#

clip_image009

啟動snmp

systemctl enable snmpd
systemctl start snmpd

第一次登入設定

http://cacti.ip.address/cacti/install/

clip_image010

clip_image011

clip_image013

預設帳號密碼 admin/admin

clip_image014

登入後會強迫修改密碼

clip_image015



本篇瀏覽人數: 12949
分類: Cacti, Cent OS篇。這篇內容的永久連結

在〈CentOS-7 安裝cacti 0.8.8g〉中有 12 則留言

  1. 汪匹稀表示:

    請問榮哥
    vi /etc/snmp/snmpd.conf

    有需要編輯以下嗎? 謝謝

    com2sec notConfigUser x.x.x.x public
    access notConfigGroup “” any noauth exact all none none
    view all included .1 80

  2. 阿爽表示:

    榮哥 你好
    想問你 syslog的事情
    我本身cacti已經裝好syslog 也有一台cisco2960 下log指令
    也有收到本機的log
    但是我沒有收到cisco2960的log
    是不是cisco2960要下sump指令 然後cacti本身也要加 cisco2960 sump
    才有辦法收到 cisco2960的log
    如果可以幫我找出解答 我會很感激你

    • 榮哥表示:

      您好

      可以先確定一下cacti 主機防火牆有確定tcp upd 514 port 有沒有確定可以讓其他主機連線
      然後確定cisco 2960 有下指令 loggin x.x.x.x (cacti 主機位置)

      有時會比較慢在cacti 主機上看到log
      以上您參考看ˇ看

  3. 大衛蘇表示:

    請問版大榮哥,我安裝設定完後一直無法用web登入,只有下列顯示

    Index of /

    Name Last modified Size Description

  4. Songyy表示:

    榮哥:
    請問一下,正常/var/www/html應該要有cacti的檔案?我index.php可以正常開,但輸入localhost/cacti會出現FATAL: Cannot connect to MySQL server on ‘localhost’. Please make sure you have specified a valid MySQL database name in ‘include/config.php’

  5. albert表示:

    榮哥:
    請問,我執行cacti的網頁時,出現一個mysql的錯誤,如下

    Pre-installation Checks

    MySQL TimeZone Support

    ERROR: Your Cacti database login account does not have access to the MySQL TimeZone database. Please provide the Cacti database account “select” access to the “time_zone_name” table in the “mysql” database, and populate MySQL’s TimeZone information before proceeding.

    看起來是mysql timezone的問題,小弟對mysql不熟,請問具體該執行什麼樣的指令來處理

發佈回覆給「榮哥」的留言 取消回覆

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *