RPM でのインストール

パッケージ
  • 主に必要な rpm パッケージ
パッケージ名 今回インストールしたパッケージバージョン
httpd 2.2.3-11.el5.centos
php 5.1.6-15.el5
php-mysql 5.1.6-15.el5
php-snmp 5.1.6-15.el5
mysq 5.0.22-2.2.el5_1.1
mysql-server 5.0.22-2.2.el5_1.1
net-snmp 5.3.1-19.el5_1.3
rrdtool 1.2.23-1.el5.rf
cacti 0.8.7a-1.el5.rf
cacti-cactid(cacti-spine) 0.8.7-1.el5.rf

yum を使ったインストール


# yum install httpd
# yum install php
# yum install php-mysql
# yum install php-snmp
# yum install mysql
# yum install mysql-server
# yum install net-snmp

Cacti インストール

rrdtoolcactiCentOS のパッケージサーバから提供されていないため、rpmforge から直接 rpm ファイルを取得するか、yum にレポジトリを追加するかして取得します。
rpmforge を使うには、rpmforge-release package をインストールする必要があります。

 # wget http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
 # rpm -Uhv rpmforge-release-0.3.6-1.el5.rf.i386.rpm
 http://dag.wieers.com/rpm/FAQ.php#B1
 # yum install rrdtool
  • cacti インストール
 # yum install cacti

rrdtool の際と同様に rpmforge の設定を行っておく必要があります。

  • cactid(spine) インストール
 # yum install cacti-cactid
 もしくは
 # yum install cacti-spine

rrdtool の際と同様に rpmforge の設定を行っておく必要があります。
※不必要なパッケージがインストールされてしまう前に rrdtoolcacti をインストールした後は rpmforge の設定を解除したほうがいいと思われます。

Official Patch

下記のページからパッチをダウンロード
http://www.cacti.net/download_patches.php

 # cd /var/www/cacti
 # wget http://www.cacti.net/downloads/patches/0.8.7a/graph-issue-wrra-specs.patch
 # wget http://www.cacti.net/downloads/patches/0.8.7a/cmd-php-non-unique-hosts.patch
 # patch -p1 -N < graph-issue-wrra-specs.patch
 patching file lib/functions.php
 # patch -p1 -N < cmd-php-non-unique-hosts.patch
 patching file cmd.php

MySQL DB 作成

 # /etc/init.d/mysql start
  • root アカウント設定
 ※ここからは root でも user でも実施可能
 $ mysqladmin --user=root password 
 $ mysqladmin --user=root --password reload
 Enter password:  <--設定したパスワードを入力
 $ mysqladmin -p --user=root create cacti
 Enter password:  <--root のパスワードを入力
 $ cd /var/www/cacti
 $ mysql -p --user=root cacti < cacti.sql
 Enter password: <--root のパスワードを入力
  • cacti 用のユーザ作成


$ mysql --user=root -p mysql
Enter password:
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 50 to server version: 5.0.22

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cacti';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> quit
Bye

  • cacti の設定ファイル編集
 # cd /var/www/cacti/include
 # vi config.php
 $database_type = "mysql";
 $database_default = "cacti";
 $database_hostname = "localhost";
 $database_username = "cactiuser";
 $database_password = "cacti";
  • Spine(cactid) の設定ファイル編集
 # vi /etc/spine.conf
 spine の config も cacti と同様に設定
 DB_Host         localhost
 DB_Database     cacti
 DB_User         cactiuser
 DB_Pass         cacti
 DB_Port         3306

httpd 設定

 # cd /etc/httpd/conf.d
 # vi cacti.conf
 下記の行をコメントアウト
 #       deny from all
 #       allow from 127.0.0.1
 下記の行を追加
        allow from all
 ※ httpd の再起動 or reload を行ってください。
 # /etc/init.d/httpd restart

ブラウザでの動作確認

ここまで設定すれば、ブラウザから閲覧可能です。
ブラウザから対象ノードを開いてみてください。
標準のログインアカウントとパスワードは共に admin です。
※もし閲覧できない場合は httpd の error.log を確認してください。
SELinux を稼動させていると、PHP にてエラーが発生します。