[HOWTO] Solaris install doc

If you figure out how to do something interesting/cool in Cacti and want to share it with the community, please post your experience here.

Moderators: Developers, Moderators

Post Reply
zanaguara
Cacti User
Posts: 60
Joined: Tue Nov 16, 2004 10:33 am
Location: Spain

[HOWTO] Solaris install doc

Post by zanaguara »

I have written a document explaining how to install all the required components by
Cacti on a Solaris host, and attached it just if anyone is interested.

I am not native English speaker, so feel free to send corrections and comments.

Regards,

Javier Vidal Postigo (a.k.a. zanaguara)


Code: Select all


Installing Cacti on Solaris HOWTO
=================================
 
Javier Vidal Postigo, zanaguara at yahoo dot es
 
V0.1, 2004-DEC-09
 
This document explains how to install all the required components by
Cacti on a Solaris host.
 
 
1. INTRODUCTION
 
1.1 Disclaimer
 
Use the information in this document at your own risk. I disavow any
potential liability for the contents of this document. Use of the
concepts, examples, and/or other content of this document is
entirely at your own risk.
                                                                                
All copyrights are owned by their owners, unless specifically noted
otherwise. Use of a term in this document should not be regarded as
affecting the validity of any trademark or service mark.
                                                                                
Naming of particular products or brands should not be seen as
endorsements.
                                                                                
You are strongly recommended to take a backup of your system before
major installation and backups at regular intervals.
 
1.2 Software Versions
 
In my case, I have been able to install Cacti on a Solaris host
using the software versions listed below. It does not mean you
should use those versions. Version numbers are provided as a
reference.
 
- Solaris 9 Update 7 for SPARC
- Solaris 9 Recommended Patch Cluster (2004-NOV-10)
- Sunfreeware.com packages:
    autoconf-2.59
    automake-1.9
    bash-3.0
    bison-1.875d
    flex-2.5.31
    gcc-3.4.2
    libiconv-1.8
    libtool-1.5
    make-3.80
    sed-4.1.1
- Perl 5.8.5
- RRDtool 1.0.49
- Apache 2.0.52
- MySQL 4.1.7
- libxml2 2.6.16
- zlib 1.2.1
- PHP 5.0.2
- NET-SNMP 5.1.2
- Cacti 0.8.6b
 
 
2. INSTALL SOLARIS
 
- Install Solaris following the instructions in http://docs.sun.com/
- Install the lastest recommended patch cluster from
  http://sunsolve.sun.com/
 
Notes:
 
- Install at least Solaris 8, because Solaris 7 end of support date
  is approaching (2005-AUG-15). Check:
 
  http://sunsolve.sun.com/search/document.do?assetkey=1-9-10012-1
 
- I suppose Cacti should work fine on Solaris x86 as well.
  
- I have installed the "Developer System Support" configuration
  (64-bit)
 
 
3. INSTALL SUNFREEWARE PACKAGES
 
Solaris does not provide a C compiler, so it is necessary to install
some development tools. I recommend to install at least the
following packages from http://www.sunfreeware.com/. Be sure to pick
the packages that have been compiled for your OS version and
architecture.
 
    autoconf-2.59
    automake-1.9
    bash-3.0
    bison-1.875d
    flex-2.5.31
    gcc-3.4.2
    libiconv-1.8
    libtool-1.5
    make-3.80
    sed-4.1.1
 
 
4. CACTI USER ACCOUNT
 
It is highly recommended to run any application with a non-root
user, so create a specific group and user for Cacti. For example:
 
  # mkdir /export/home
  # groupadd -g 100 cacti
  # useradd -u 100 -g cacti -s /usr/bin/bash \
  > -d /export/home/cacti -m cacti
  # passwd cacti
 
From here, a command entered by root will have the "#" prompt, and
if the user is cacti, the shell prompt will be "$".
  
Before start compiling, it is extremely important to have both PATH
and LD_LIBRARY_PATH environment variables properly set. This is my
.bash_profile:
 
PATH=/opt/perl/bin:/usr/local/bin:/usr/bin:/usr/sbin:/usr/ccs/bin
PATH=$PATH:/opt/php/bin:/opt/mysql/bin:/opt/rrdtool/bin
PATH=$PATH:/opt/net-snmp/bin
 
LD_LIBRARY_PATH=/opt/libxml2/lib:/usr/lib:/etc/lib:/opt/zlib/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/sparcv9
 
MANPATH=/usr/man:/usr/local/man:/opt/rrdtool/man:/opt/net-snmp/man
 
PS1="`/usr/ucb/whoami`@"`hostname`"$ "
PS2="`/usr/ucb/whoami`@"`hostname`"> "
  
export PATH LD_LIBRARY_PATH MANPATH
export PS1 PS2
 
 
5. INSTALL PERL (5.8.5)
 
Solaris provides a version of Perl (/usr/bin/perl), but I prefer to
install mine. In my case, I have compiled 5.8.5 from
http://perl.org/ and installed it on /opt/perl:
 
  $ rm -f config.sh Policy.sh
  $ sh Configure -Dprefix=/opt/perl -des
  $ make
  $ make test
  # make install
 
 
6. INSTALL RRDTOOL (1.0.49)
 
Download RRDtool from
http://people.ee.ethz.ch/~oetiker/webtools/rrdtool/ and:
 
  $ sh configure --prefix=/opt/rrdtool
  $ make
  # make install
 
7. INSTALL APACHE (2.0.52)
 
Download Apache from http://www.apache.org/ and:
 
  $ configure --prefix=/opt/apache --enable-so
  $ make
  # make install
 
(Optional) I have edited my /opt/apache/conf/httpd.conf so:
 
  User cacti
  Group cacti
 
  ServerName 'hostname'
 
  ServerRoot /opt/cacti/cacti-0.8.6b
 
Notes:
 
- 'hostname' can be the real hostname.
- /opt/cacti/cacti-0.8.6b is the path where Cacti is going to be
  installed.
 
 
8. INSTALL MYSQL (4.1.7)
 
First of all, you need to create a group and a user for MySQL:
  
  # groupadd -g 101 mysql
  # useradd -u 101 -g mysql -s /usr/bin/bash -d \
  > /export/home/mysql -m mysql
  # passwd mysql
 
Download MySQL from http://www.mysql.com/ and:
 
  $ ./configure --prefix=/opt/mysql
  $ make
  # make install
  # cp support-files/my-large.cnf /etc/my.cnf
  # cd /opt/mysql
  # bin/mysql_install_db --user=mysql
  # chown -R root  .
  # chown -R mysql var
  # chgrp -R mysql .
 
Start MySQL:
 
  # bin/mysqld_safe --user=mysql &
 
Set a password for the root user:
 
  $ mysqladmin -u root password 'new-password'
  $ mysqladmin -u root -h 'hostname' password 'new-password'
 
Note:
 
- If you 'make clean', be careful because there is a bug in MySQL.
  'make clean' does not remove the file sql/lex_hash.h and it
  should be removed by hand.
 
 
9. INSTALL LIBXML2 (2.6.16)
 
PHP 5 requires a recent version of libxml2. The version that comes
with Solaris 9 is too old. Download it from http://xmlsoft.org/ and:
 
  $ ./configure --prefix=/opt/libxml2
  $ make
  # make install
 
 
10. INSTALL ZLIB (1.2.1)
 
zlib is also required by PHP 5. Download it from
http://www.gzip.org/zlib/ and:
 
  $ ./configure --prefix=/opt/zlib
  $ make
  # make install
 
 
11. INSTALL PHP (5.0.2)
 
I have not been able to compile PHP 5 with SNMP support, it is in my
'to do' list. If you do not have PHP support activated Cacti will use
NET-SNMP instead.
 
Download PHP from http://www.php.net/ and:
 
  $ ./configure --with-apxs2=/opt/apache/bin/apxs \
  > --with-mysql=/opt/mysql --prefix=/opt/php \
  > --with-libxml-dir=/opt/libxml2 --with-zlib=/opt/zlib
  $ make
  # make install
 
You have to add several lines to your Apache configuration file
(/opt/apache/conf/httpd.conf):
 
  AddType application/x-httpd-php .php
  DirectoryIndex index.html index.html.var index.php
 
Be sure PHP installation have added:
 
  LoadModule php5_module        modules/libphp5.so
 
And add index.php to the DirectoryIndex directive:
 
  DirectoryIndex index.html index.php
 
Now restart Apache:
 
  # ./apachectl stop
  # ./apachectl start
 
In the Apache error_log file you should see a message saying
"PHP/5.0.2 configured".
 
 
12. INSTALL NET-SNMP (5.1.2)
 
Stop Solaris SNMP daemons:
 
  # cd /etc/rc3.d
  # ./S76snmpdx stop
  # ./S77dmi stop
  # mv S76snmpdx _S76snmpdx
  # mv S77dmi _S77dmi
 
Note:
 
- You could have more Solaris SNMP daemons running. Please check
  NET-SNMP documentation.
 
Download NET-SNMP from http://www.net-snmp.org/ and:
 
  $ ./configure --prefix=/opt/net-snmp \
  > --with-default-snmp-version=3 \
  > --with-sys-contact=someone@domain.com \
  > --with-sys-location=somelocation \
  > --with-logfile=/opt/net-snmp/log/snmpd.log \
  > --with-persistent-directory=/opt/net-snmp/var
  $ make
  $ make test
  # make install
  # cd /opt/net-snmp
  # mkdir var
  # mkdir log
  # ./snmpconf -g basic_setup
 
Answer to all question asked. Then start NET-SNMP:
 
  # /opt/net-snmp/sbin/snmpd -c /opt/net-snmp/bin/snmpd.conf
 
And check NET-SNMP agent is working fine:
 
  $ /opt/net-snmp/bin/snmpget -v 1 -c community \
  > localhost sysUpTime.0
 
 
13. INSTALL CACTI (0.8.6b)
 
Once you have installed all the required components you can follow
chapter 2 of Cacti documentation (Installing Under Unix).
 
Note:
 
- If you try to execute 'php poller.php' directly in the crontab is
  not going to work because php can not find all the dynamic
  libraries needed. The simplest solution is to have in the crontab:
 
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /opt/cacti/poller_cron
 
being 'poller_cron' the following script:
 
  . /export/home/cacti/.bash_profile
  /opt/php/bin/php /opt/cacti/cacti-0.8.6b/poller.php
 
Note:
 
- Notice the space between the dot and the .bash_profile path.


Cristina

Re: Solaris install doc

Post by Cristina »

First of all i find your document quite useful.
I have a problem installing Cacti on Solaris.
The message i have got is ...

Warning: mysql_connect(): Access denied for user 'usuario'@'mi_maquina' (using password: YES) in /usr/local/apache2/htdocs/cacti-0.8.6b/lib/adodb/drivers/adodb-mysql.inc.php on line 324

Cannot connect to MySQL server on 'dir_ip_mi_maquina'. Please make sure you have specified a valid MySQL database name in 'include/config.php'.


Could you tell me some advise to solve it? It seems like if i haven't imported the database or something similar. I have also check the information of config.php file
$database_type = "mysql";
$database_default = "cactidb";
$database_hostname = "dir_ip_mi_maquina";
$database_username = "usuario";
$database_password = "contraseña";

Thanks for all,
zanaguara
Cacti User
Posts: 60
Joined: Tue Nov 16, 2004 10:33 am
Location: Spain

Re: Solaris install doc

Post by zanaguara »

Cristina wrote: $database_default = "cactidb";
Have you imported the database as "cactidb"?
Guest

Re: Solaris install doc

Post by Guest »

I don't know how i have to do that
Could you help me.

Regards,
zanaguara wrote:
Cristina wrote: $database_default = "cactidb";
Have you imported the database as "cactidb"?
Cristina

Re: Solaris install doc

Post by Cristina »

I have done this ...

mysql> --user=usuario --password=contraseña cactidb < /usr/local/apache2/htdocs/cacti-0.8.6b/cacti.sql;
mysql> flush privileges;


Is it enough? I have also the same problem.
zanaguara
Cacti User
Posts: 60
Joined: Tue Nov 16, 2004 10:33 am
Location: Spain

grant all

Post by zanaguara »

after importing the database I think you skipped this step:

code]
mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY 'somepassword';[
[/code]
Cristina

Re: grant all

Post by Cristina »

It is possible i had forgotten some steps.
After repeting again all the steps, the problem message has change.

Warning: mysql_connect(): Client does not support authentication protocol requested by server; consider upgrading MySQL client in /usr/local/apache2/htdocs/cacti-0.8.6b/lib/adodb/drivers/adodb-mysql.inc.php on line 324

Cannot connect to MySQL server on 'urbasa'. Please make sure you have specified a valid MySQL database name in 'include/config.php'.

Followed Steps :

bash-2.05# userdel cactiuser
bash-2.05# groupdel cacti
bash-2.05# groupadd cacti
bash-2.05# useradd -g cacti cactiuser
bash-2.05# passwd cactiuser
New Password:
Re-enter new Password:
passwd: password successfully changed for cactiuser
bash-2.05# ./mysql -u root -h localhost -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 10 to server version: 4.1.7-standard

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

mysql> GRANT ALL ON cactidb.* TO cactiuser@localhost IDENTIFIED BY 'contraseña';
Query OK, 0 rows affected (0.04 sec)
mysql> --user=cactiuser --password=contraseña cactidb < /usr/local/apache2/htdocs/cacti-0.8.6b/cacti.sql;
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)

mysql> quit;
Bye


Thank you,
zanaguara
Cacti User
Posts: 60
Joined: Tue Nov 16, 2004 10:33 am
Location: Spain

Re: grant all

Post by zanaguara »

Cristina wrote: mysql> GRANT ALL ON cactidb.* TO cactiuser@localhost IDENTIFIED BY 'contraseña';
Query OK, 0 rows affected (0.04 sec)
mysql> --user=cactiuser --password=contraseña cactidb < /usr/local/apache2/htdocs/cacti-0.8.6b/cacti.sql;
mysql> flush privileges;
Query OK, 0 rows affected (0.02 sec)

mysql> quit;
I think you are not importing the database. Just follow the steps in
http://www.cacti.net/downloads/docs/htm ... _unix.html

Notice that to import the database you have to execute "mysql cacti < cacti.sql" from the shell, not inside mysql.

And the "grant all" statement must be executed just after the import.

Hope this help.
Cristina

Re: grant all

Post by Cristina »

:(
If i try to import the database

bash-2.05# mysql -u cacuser -p cactidb < /usr/local/apache2/htdocs/cacti-0.8.6b/cacti.sql
bash: mysql: command not found

So i can't follow the recommended steps ??

Gracias Javier,

(*)About the previus problem: MySQL 4.x use a newer, more secure authentication method with longer passwords. Since PHP does not yet understand this method a connect will always fail with that error message.
See http://dev.mysql.com/doc/mysql/en/Old_client.html
Cristina

Re: grant all

Post by Cristina »

I have just achieved it :D

I have used the following sentence to import the database...

bash-2.05# /usr/local/mysql/bin/mysql -u root -h localhost -p cacti < cacti.sql
Enter password:


Regards,

Cristina
Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest