Note : using mysql 5.1.73 & cacti 0.8.8.b
1. Disable SE Linux
[root@TeguhLab ~]# cat /etc/selinux/config
# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing - SELinux security policy is enforced.
# permissive - SELinux prints warnings instead of enforcing.
# disabled - No SELinux policy is loaded.
SELINUX=disabled
# SELINUXTYPE= can take one of these two values:
# targeted - Targeted processes are protected,
# mls - Multi Level Security protection.
SELINUXTYPE=targeted
[root@TeguhLab ~]#
2. Disable firewall
[root@TeguhLab /]# service iptables stop
iptables: Setting chains to policy ACCEPT: filter [ OK ]
iptables: Flushing firewall rules: [ OK ]
iptables: Unloading modules: [ OK ]
[root@TeguhLab /]# chkconfig iptables off
[root@TeguhLab ~]# service iptables status
iptables: Firewall is not running.
[root@TeguhLab ~]#
3. Configure hosts
[root@TeguhLab /]# cat /etc/hosts
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
10.10.10.10 TeguhLab
[root@TeguhLab /]#
4. Install Package patch & wget
[root@TeguhLab data]# rpm -q a wget
wget-1.12-10.el6.x86_64
[root@TeguhLab data]# rpm -q patch
patch-2.6-6.el6.x86_64
[root@TeguhLab data]#
5. Install package cacti & snmp
yum -y install mysql-server mysql php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp php-pear-Net-SMTP php-mysql httpd
yum -y install net-snmp-utils php-snmp net-snmp-libs
rpm -q mysql-server mysql php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp php-pear-Net-SMTP php-mysql httpd
rpm -q install net-snmp-utils php-snmp net-snmp-libs
[root@TeguhLab data]# rpm -q mysql-server mysql php-mysql php-pear php-common php-gd php-devel php php-mbstring php-cli php-snmp php-pear-Net-SMTP php-mysql httpd
mysql-server-5.1.73-8.el6_8.x86_64
mysql-5.1.73-8.el6_8.x86_64
php-mysql-5.3.3-49.el6.x86_64
php-pear-1.9.4-5.el6.noarch
php-common-5.3.3-49.el6.x86_64
php-gd-5.3.3-49.el6.x86_64
php-devel-5.3.3-49.el6.x86_64
php-5.3.3-49.el6.x86_64
php-mbstring-5.3.3-49.el6.x86_64
php-cli-5.3.3-49.el6.x86_64
php-snmp-5.3.3-49.el6.x86_64
package php-pear-Net-SMTP is not installed
php-mysql-5.3.3-49.el6.x86_64
httpd-2.2.15-60.el6.centos.4.x86_64
[root@TeguhLab data]# rpm -q install net-snmp-utils php-snmp net-snmp-libs
package install is not installed
net-snmp-utils-5.5-60.el6.x86_64
php-snmp-5.3.3-49.el6.x86_64
net-snmp-libs-5.5-60.el6.x86_64
[root@TeguhLab data]#
6. Download rpm cacti
https://centos.pkgs.org/6/repoforge-x86_64/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm.html
wget http://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
[root@TeguhLab data]# ls
[root@TeguhLab data]# wget http://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
--2017-08-01 15:30:23-- http://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el6/en/x86_64/rpmforge/RPMS/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
Resolving ftp.tu-chemnitz.de... 134.109.228.1, 2001:638:911:b0e:134:109:228:1
Connecting to ftp.tu-chemnitz.de|134.109.228.1|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 12640 (12K) [application/octet-stream]
Saving to: “rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm”
100%[========================================================================================>] 12,640 2.86K/s in 4.3s
2017-08-01 15:30:31 (2.86 KB/s) - “rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm” saved [12640/12640]
[root@TeguhLab data]# ls
rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
[root@TeguhLab data]#
7. Install cacti
rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
yum -y install cacti
rpm -ql cacti | grep cacti.sql
[root@TeguhLab data]# rpm -ivh rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
[root@TeguhLab data]# yum -y install cacti
cacti-0.8.8b-1.el6.rf.noarch
[root@TeguhLab data]# rpm -ql cacti | grep cacti.sql
[root@TeguhLab data]#
8. Konfigurasi MySQL server
[root@TeguhLab data]# chkconfig mysqld on
[root@TeguhLab data]# service mysqld status
mysqld is stopped
[root@TeguhLab data]# service mysqld start
Initializing MySQL database: Installing MySQL system tables...
OK
Filling help tables...
OK
To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system
PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h TeguhLab password 'new-password'
Alternatively you can run:
/usr/bin/mysql_secure_installation
which will also give you the option of removing the test
databases and anonymous user created by default. This is
strongly recommended for production servers.
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &
You can test the MySQL daemon with mysql-test-run.pl
cd /usr/mysql-test ; perl mysql-test-run.pl
Please report any problems with the /usr/bin/mysqlbug script!
[ OK ]
Starting mysqld: [ OK ]
[root@TeguhLab data]#
mysqladmin -u root password 'root'
[root@TeguhLab data]# mysqladmin -u root password 'root'
[root@TeguhLab data]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, 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>
9. Create user database for cacti
create user 'cactiuser' identified by 'cactipwd';
create database cacti;
grant all privileges on cacti.* to 'cactiuser'@'%' identified by 'cactipwd' with grant option;
FLUSH PRIVILEGES;
create user 'cactiuser' identified by 'cactipwd';
create database cacti;
GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipwd';
FLUSH PRIVILEGES;
[root@TeguhLab data]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.73 Source distribution
Copyright (c) 2000, 2013, 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 user 'cactiuser' identified by 'cactipwd';
Query OK, 0 rows affected (0.01 sec)
mysql> create database cacti;
Query OK, 1 row affected (0.00 sec)
mysql> grant all privileges on cacti.* to 'cactiuser'@'%' identified by 'cactipwd' with grant option;
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> create user 'cactiuser' identified by 'cactipwd';
ERROR 1396 (HY000): Operation CREATE USER failed for 'cactiuser'@'%'
mysql> create database cacti;
ERROR 1007 (HY000): Can't create database 'cacti'; database exists
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'cactipwd';
Query OK, 0 rows affected (0.00 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.00 sec)
mysql> exit
Bye
[root@TeguhLab data]#
10. Konfigurasi snmpd
[root@TeguhLab data]# chkconfig snmpd on
[root@TeguhLab data]# vi /etc/snmp/snmpd.conf
[root@TeguhLab data]# cat /etc/snmp/snmpd.conf | grep systemview
view systemview included .1.3.6.1.2.1.1
view systemview included .1.3.6.1.2.1.25.1.1
view systemview included .1
# Finally, grant the group read-only access to the systemview view.
access notConfigGroup "" any noauth exact systemview none none
# Finally, grant the group read-only access to the systemview view.
[root@TeguhLab data]# service snmpd restart
Stopping snmpd: [FAILED]
Starting snmpd: [ OK ]
[root@TeguhLab data]#
11. Konfigurasi database Cacti
[root@TeguhLab data]# rpm -ql cacti | grep cacti.sql
/var/www/cacti/cacti.sql
[root@TeguhLab data]# mysql -u cactiuser -p cacti < /var/www/cacti/cacti.sql
Enter password:
[root@TeguhLab data]#
12. Konfigurasi Cacti
[root@TeguhLab data]# vi /var/www/cacti/include/config.php
[root@TeguhLab data]#
[root@TeguhLab data]# cat /var/www/cacti/include/config.php | grep database
/* make sure these values refect your actual database/host/user/password */
$database_type = "mysql";
$database_default = "cacti";
$database_hostname = "localhost";
$database_username = "cactiuser";
$database_password = "cactipwd";
$database_port = "3306";
$database_ssl = false;
[root@TeguhLab data]#
13. Konfigurasi httpd
[root@TeguhLab data]# vi /etc/httpd/conf.d/cacti.conf
[root@TeguhLab data]# cat /etc/httpd/conf.d/cacti.conf
Alias /cacti/ /var/www/cacti/
<Directory /var/www/cacti/>
DirectoryIndex index.php
Options -Indexes
AllowOverride all
order deny,allow
deny from all
allow from 10.0.0.0/8
allow from all
AddType application/x-httpd-php .php
php_flag magic_quotes_gpc on
php_flag track_vars on
</Directory>
if you not sertting, will error as
Forbidden
You don't have permission to access /cacti/ on this server.
Apache/2.2.15 (CentOS) Server at 10.10.10.10 Port 80
[root@TeguhLab data]#
[root@TeguhLab data]# vi /etc/httpd/conf/httpd.conf
[root@TeguhLab data]# cat /etc/httpd/conf/httpd.conf | grep ServerName
# ServerName gives the name and port that the server uses to identify itself.
#ServerName www.example.com:80
ServerName 127.0.0.1:80
# ServerName directive.
# ServerName dummy-host.example.com
[root@TeguhLab data]#
if you not setting, will show error
[root@TeguhLab ~]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 10.10.10.10 for ServerName
[ OK ]
[root@TeguhLab ~]#
14 . Start httpd
[root@TeguhLab data]#
[root@TeguhLab data]# chkconfig httpd on
[root@TeguhLab data]# service httpd status
httpd is stopped
[root@TeguhLab data]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@TeguhLab data]# service httpd status
httpd (pid 7584) is running...
[root@TeguhLab data]#
15 . Konfigurasi cronjob untuk Cacti
[root@TeguhLab data]# vi /etc/cron.d/cacti
[root@TeguhLab data]# cat /etc/cron.d/cacti
#*/5 * * * * cacti php /var/www/cacti/poller.php &>/dev/null
*/5 * * * * cacti /usr/bin/php /var/www/cacti/poller.php > /dev/null 2>&1
[root@TeguhLab data]#
18. Running cacti.
Open browser and type using url
http://IP_cacti/cacti/
example
http://10.10.10.10/cacti/
if you fresh install or upgrade. firts run as below then next next, choose fresh install or upgrade
http://IP_cacti/cacti/install/
example
http://10.10.10.10/cacti/install/
No comments:
Post a Comment