Tuesday, August 8, 2017

.::: How To Upgrade Cacti on Linux :::.

note: this cace, upgrade cacti 0.8.8.b to 0.8.8.h
1. Backup the old Cacti database
mysqldump -l --add-drop-table <db_name> -u <user> -p  > mysql.cacti
[root@TeguhLab data]# mysqldump -l --add-drop-table cacti -u root -p > mysql.cacti
Enter password:
[root@TeguhLab data]# ls
mysql.cacti  rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
[root@TeguhLab data]# ls -lh
total 156K
-rw-r--r-- 1 root root 138K Aug  3 14:45 mysql.cacti
-rw-r--r-- 1 root root  13K Mar 20  2013 rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm
[root@TeguhLab data]#


2. Backup the old Cacti directory
mv cacti cacti_old
[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
    AddType application/x-httpd-php .php
    php_flag magic_quotes_gpc on
    php_flag track_vars on
</Directory>
[root@TeguhLab data]# cd /var/www/
[root@TeguhLab www]# ls
cacti  cgi-bin  error  html  icons
[root@TeguhLab www]# mv cacti cacti_old/
[root@TeguhLab www]# ls
cacti_old  cgi-bin  error  html  icons
[root@TeguhLab www]#


3. Download & Extract the distribution tarball.
wget https://www.cacti.net/downloads/cacti-0.8.8h.tar.gz

[root@TeguhLab www]# ls
cacti_old  cgi-bin  error  html  icons
[root@TeguhLab www]# wget https://www.cacti.net/downloads/cacti-0.8.8h.tar.gz
--2017-08-03 14:55:29--  https://www.cacti.net/downloads/cacti-0.8.8h.tar.gz
Resolving www.cacti.net... 104.28.9.127, 104.28.8.127, 2400:cb00:2048:1::681c:87f, ...
Connecting to www.cacti.net|104.28.9.127|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2585226 (2.5M) [application/x-gzip]
Saving to: “cacti-0.8.8h.tar.gz”

100%[========================================================================================>] 2,585,226    603K/s   in 4.5s   

2017-08-03 14:55:35 (561 KB/s) - “cacti-0.8.8h.tar.gz” saved [2585226/2585226]

[root@TeguhLab www]# ls
cacti-0.8.8h.tar.gz  cacti_old  cgi-bin  error  html  icons
[root@TeguhLab www]# tar -xvf cacti-0.8.8h.tar.gz
cacti-0.8.8h/
............
[root@TeguhLab www]# ls
cacti-0.8.8h  cacti-0.8.8h.tar.gz  cacti_old  cgi-bin  error  html  icons
[root@TeguhLab www]#


4. Rename the new Cacti directory to match the old one.
mv cacti-version cacti
[root@TeguhLab www]# ls
cacti-0.8.8h  cacti-0.8.8h.tar.gz  cacti_old  cgi-bin  error  html  icons
[root@TeguhLab www]# mv cacti-0.8.8h cacti
[root@TeguhLab www]# ls
cacti  cacti-0.8.8h.tar.gz  cacti_old  cgi-bin  error  html  icons
[root@TeguhLab www]#

5.  Edit include/config.php and specify the MySQL user, password and database for your Cacti configuration.
[root@TeguhLab www]# more cacti/include/config.php
<?php
/*
 +-------------------------------------------------------------------------+
 | Copyright (C) 2004-2016 The Cacti Group                                 |
 |                                                                         |
 | This program is free software; you can redistribute it and/or           |
 | modify it under the terms of the GNU General Public License             |
 | as published by the Free Software Foundation; either version 2          |
 | of the License, or (at your option) any later version.                  |
 |                                                                         |
 | This program is distributed in the hope that it will be useful,         |
 | but WITHOUT ANY WARRANTY; without even the implied warranty of          |
 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the           |
 | GNU General Public License for more details.                            |
 +-------------------------------------------------------------------------+
 | Cacti: The Complete RRDTool-based Graphing Solution                     |
 +-------------------------------------------------------------------------+
 | This code is designed, written, and maintained by the Cacti Group. See  |
 | about.php and/or the AUTHORS file for specific developer information.   |
 +-------------------------------------------------------------------------+
 | http://www.cacti.net/                                                   |
 +-------------------------------------------------------------------------+
*/

/* 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;

/*
   Edit this to point to the default URL of your Cacti install
   ex: if your cacti install as at http://serverip/cacti/ this
   would be set to /cacti/
*/
//$url_path = "/cacti/";

/* Default session name - Session name must contain alpha characters */
//$cacti_session_name = "Cacti";

?>
[root@TeguhLab www]#

6. Copy the *.rrd files from the old Cacti directory.
 cp cacti_old/rra/* cacti/rra/
 [root@TeguhLab www]# cp cacti_old/rra/* cacti/rra
[root@TeguhLab www]#

7.  cp cacti_old/rra/* cacti/rra/
Copy any relevant custom scripts from the old Cacti directory. Some script are updated between versions. Therefore, make sure you only over write if the scripts either don't exist or are newer than the distribution's.
cp -u cacti_old/scripts/* cacti/scripts/
[root@TeguhLab www]# cp -u cacti_old/script/* cacti/script/
cp: cannot stat `cacti_old/script/*': No such file or directory
[root@TeguhLab www]#

8.  Copy any relevant custom resource XML files from the old Cacti directory. Some resource XML files are updated between versions. Therefore, make sure you only over write if the XML files either don't exist or are newer than the distribution's.

shell> cp -u -R cacti_old/resource/* cacti/resource/
[root@TeguhLab www]# cp -u -Rf cacti_old/resource/* cacti/resource/
cp: overwrite `cacti/resource/script_queries/unix_disk.xml'? y
cp: overwrite `cacti/resource/script_queries/host_cpu.xml'? y
cp: overwrite `cacti/resource/script_server/host_disk.xml'? y
cp: overwrite `cacti/resource/script_server/host_cpu.xml'? y
cp: overwrite `cacti/resource/snmp_queries/netware_disk.xml'? y
cp: overwrite `cacti/resource/snmp_queries/net-snmp_disk.xml'? y
cp: overwrite `cacti/resource/snmp_queries/netware_cpu.xml'? y
cp: overwrite `cacti/resource/snmp_queries/kbridge.xml'? y
cp: overwrite `cacti/resource/snmp_queries/interface.xml'? y
cp: overwrite `cacti/resource/snmp_queries/host_disk.xml'? y
[root@TeguhLab www]#

9.  Set the appropriate permissions on Cacti's directories for graph/log generation. You should execute these commands from inside Cacti's directory to change the permissions.

shell> chown -R cactiuser rra/ log
[root@TeguhLab www]# chmod -R 777 cacti/rra cacti/log
[root@TeguhLab www]#

10.  Point your web browser to: & select upgrade

    http://your-server/cacti/  or http://your-server/cacti/install/
http://10.10.10.10/cacti/  or http://10.10.10.10/cacti/install/ and next next

11.then login

    12. Cacti version upgrade

No comments:

Post a Comment

Popular Posts