CentOS6 cactiのセットアップ

インストールしたからにはセットアップですよね。

mysqlを使うのでmysqlの準備ができたら開始です。

mysqlが立ち上がっていないと

FATAL: Connection to Cacti database failed. Please insure the database is running and your credentials in config.php are valid.

と怒られます。

# mysql -u root -p
Enter password: ★mysqlのパスワード
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 9
Server version: 5.7.18 MySQL Community Server (GPL)
Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database cacti;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on cacti.* to cactiuser@localhost identified by 'cacti'; ★cacti用パスワード
mysql> grant select on mysql.time_zone_name to 'cactiuser'@'localhost' identified by 'cacti';
Query OK, 0 rows affected, 1 warning (0.00 sec)
mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)
mysql>\q
★cacti自体のデータベースをインポート
# mysql -u root -p cacti </usr/share/doc/cacti-1.1.2/cacti.sql
                                  バージョンは徐々に変わるので適宜
Enter password: ★mysql用パスワード
★mysqlのtimezoneの設定を行う。
# mysql_tzinfo_to_sql /usr/share/zoneinfo | mysql -u root mysql -p
Enter password: ★mysql用パスワード
Warning: Unable to load '/usr/share/zoneinfo/iso3166.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone.tab' as time zone. Skipping it.
Warning: Unable to load '/usr/share/zoneinfo/zone1970.tab' as time zone. Skipping it.
# vi /etc/cacti/db.php
type     = 'mysql';
$database_default  = 'cacti';
$database_hostname = 'localhost';
$database_username = 'cactiuser';
$database_password = 'cacti';
$database_port     = '3306';
$database_ssl      = false;
# vi /etc/httpd/conf.d/cacti.conf
<Directory /usr/share/cacti/>
        <IfModule mod_authz_core.c>
                # httpd 2.4
                Require host localhost
        </IfModule>
        <IfModule !mod_authz_core.c>
                # httpd 2.2
                Order deny,allow
                Deny from all
                Allow from 192.168.0.0/16
                Allow from localhost
        </IfModule>
</Directory>