468x60 Ads

Thursday, September 27, 2012

Pin It

Widgets

Installing Cacti on Solaris 10 (PART-1)


Installing Cacti on Solaris 10

Install Solaris 10 sparc in sun server:

­
Software Requirements:

Required packages for solaris 10 sparc x64(according to your system) can freely download from http://unixpackages.com/ or http://sunfreeware.com/ . (it’s better download new versions.)


libiconv


freetds


libintl


libssh2


libidn


gd

openssl


jpeg


curl


openldap


expat


mysql


fontconfig


libpng


zlib


xpm


freetype


sasl    


db


libxml2


openldap


flex


autoconf


gcc


automake


libtool


bash-3

make

bison


sed


Perl


libgcc

RRDtool


libsigsegv

libxml2


m4

NET-SNMP


re2c

ncuser     


xrender  


MySQL


pango    


libart_lgpl 


PHP


cairo  


Apache 2


libart_lgpl





Installing packages:

bash-3.2#gunzip gcc-3.4.6-sol10-x86-local.tar.gz
bash-3.2#pkgadd –d gcc-3.4.6-sol10-x86-local
The following packages are available:
  1  SMCgcc     gcc
                (sparc) 3.4.6

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]:all

gunzip –d  ;-d means default installation
Default installation directry is : /usr/local/



 Preparing the system—basic prerequisites

In order to install and run Cacti, we need to make sure that all Cacti system requirements are met. Here I’ll describe main requirement that want to have in OS to run Cacti.

Web server

Cacti is built as a web interface, a web server is needed. This can be Apache httpd or Microsoft's Internet Information Server (IIS) if installing on Windows, but in fact, any PHP-capable web server can be used to run the web interface. For the Solaris I prefer Apache as a web server.

Configure apache 2:

# ServerRoot: The top of the directory tree under which the server's
# configuration, error, and log files are kept.
ServerRoot "/usr/local/apache2"

#
# If you wish httpd to run as a different user or group, you must run
#
User daemon
Group daemon
#
# ServerAdmin: Your address, where problems with the server should be
# e-mailed.  This address appears on some server-generated pages, such
# as error documents.  e.g. admin@your-domain.com
#
ServerAdmin you@example.com
#
# ServerName gives the name and port that the server uses to identify itself.
# This can often be determined automatically, but we recommend you specify
# it explicitly to prevent problems during startup.
#
# If your host doesn't have a registered DNS name, enter its IP address here.
#
ServerName 172.16.26.160:80
#
#
# DocumentRoot: The directory out of which you will serve your
# documents. By default, all requests are taken from this directory, but
# symbolic links and aliases may be used to point to other locations.
#
DocumentRoot "/var/apache2/htdocs"
Use your normal procedure for starting the Apache server, e.g.:
or

NET-SNMP package

The NET-SNMP package provides the SNMP binaries used by Cacti and supports SNMPv1, SNMPv2c, and SNMPv3.
The NET-SNMP package also provides the SNMP daemon for UNIX.

*Note: The snmpd.conf file for Sun's agent is in the /etc/sma/snmp/ directory. This is the one you will want to edit to suit your needs.

   --- Make sure Sun's Agent is enabled ---

bash-3.00# svcadm enable dmi
bash-3.00# svcadm enable sma

Checking snmp is working properly:


Change the content of the snmpd.conf file


MySQL database

Cacti use the freely available MySQL database engine as its database server and it is also available on Solaris. For best performance, MySQL version 5 should be used.

Installation
 Removing older versions of MySQL on Solaris
#/usr/local/mysql/bin/mysql_install_db --user=mysql
Installing MySQL system tables...
090211 14:30:35 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
090211 14:30:35 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
OK
Filling help tables...
090211 14:30:35 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
090211 14:30:35 [Warning] option 'max_join_size': unsigned value 18446744073709551615 adjusted to 4294967295
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system /etc/init.d/

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !

To do so, start the server, then issue the following commands:

/usr/local/mysql/bin/mysqladmin -u root password 'new-password'
/usr/local/mysql/bin/mysqladmin -u root -h vmsol01 password 'new-password'
Alternatively you can run:

/usr/local/mysql/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/local/mysql ; /usr/local/mysql/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl

cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/local/mysql/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com

Support MySQL by buying support/licenses at
http://shop.mysql.com/


Check for MySQL packages installed and remove them.

# pkginfo | grepmysql

The following packages SUNWmysqlr, SUNWmysqlt, SUNWmysqlu were found and removed. 

# pkgrm SUNWmysqlr # pkgrm SUNWmysqlt # pkgrm SUNWmysqlu

1. Create mysql user and group

#groupadd mysql
#useradd -g mysqlmysql

2. Extract and install the package

#gunzip -d mysql-x.x.x-solaris10-sparc-64bit.pkg.gz
#pkgadd -dmysql-5 x.x.x -solaris10-sparc-64bit.pkg

You will be asked to create installation directory. Answer with yes to continue installation. The installation process will put the files on /opt/my   sql/mysql or /usr/local/mysql/.

3. You will need to do these commands to change file/folders permission

#chown -R mysql:mysql /usr/local/mysql/
#chmod -R 550 /usr/local/mysql/
Or:
#chown -R mysql:mysql /opt/mysql/mysql
#chown -R mysql:mysql /var/lib/mysql
#chmod -R 550 /opt/mysql/mysql

4. Coppy configuration file into required location

 bash-3.2# pwd
/usr/local/mysql/share/mysql/
bash-3.2# cp my-medium.cnf /etc/my.cnf
bash-3.2#vi /etc/my.cnf

And edit required configurations...

5. Binary files will be located in /opt/mysql/mysql/bin after installation. Install mysql database with this command

#/opt/mysql/mysql/bin/mysql_install_db
or:
##/usr/local/mysql/bin/mysql_install_db


6.  Usually, we start the server with this command

#/opt/mysql/mysql/bin/mysqld_safe –user=mysql &

or
#/usr/local/mysql/bin/mysqld_safe –user=mysql &

or try
#/usr/local/mysql/bin/mysql –user=mysql &
or
#/usr/local/mysql/bin/mysqld –user=mysql&

But, MySQL 5.1.33 has a bug on this. Here the bug is: Installation process put data files on /var/lib/mysql, while default mysqld_safe command will look forward to /opt/mysql/mysql/data/. We can fix this by adding –datadir option. To start the server, the complete command will be like this

#/opt/mysql/mysql/bin/mysqld_safe –user=mysql –datadir=/var/lib/mysql &
Or
#/usr/local/mysql/bin/mysqld_safe–user=mysql –datadir=/var/lib/mysql &


7. Don’t forget to create mysql root password

#/opt/mysql/mysql/bin/mysqladmin -u root password ‘your new password’


Or

#usr/local/mysql/bin/mysqladmin-u root password ‘your new password’

#mysqladmin -u root -h 'hostname' password 'new-password'


Next command is optional



PHP

Cacti is built with the PHP programming language and therefore needs PHP to be installed on the system. Most UNIX distributions already have a base PHP environment installed, but we  might need additional packages for Cacti to function properly. (LDAP, SNMP, and MySQL extensions should be installed)

1. Stop apache server:


2. Setup your php.ini

bash-3.2#cp /usr/local/php/doc/php/php.ini-development /usr/local/lib/php.ini
You may edit your .ini file to set PHP options. If you prefer having php.ini in another location, use --with-config-file-path=/some/path in step

3. Edit your httpd.conf to load the PHP module. (Mention only edited points)

# LoadModule foo_module modules/mod_foo.so
#
LoadModule php5_module  modules/libphp5.so
#
# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
#
    DirectoryIndex index.html index.php


    #
    # TypesConfig points to the file containing the list of mappings from
    # filename extension to MIME-type.
    #
    TypesConfig conf/mime.types

    #
    # AddType allows you to add to or override the MIME configuration
    # file specified in TypesConfig for specific file types.
    #
    #AddType application/x-gzip .tgz
    #
    # AddEncoding allows you to have certain browsers uncompress
    # information on the fly. Note: Not all browsers support this.
    #
    #AddEncoding x-compress .Z
    #AddEncoding x-gzip .gz .tgz
    #
    # If the AddEncoding directives above are commented-out, then you
    # probably should define those extensions to indicate media types:
    #
    AddType application/x-compress .Z
    AddType application/x-gzip .gz .tgz

    #
    # AddHandler allows you to map certain file extensions to "handlers":
    # actions unrelated to filetype. These can be either built into the server
    # or added with the Action directive (see below)
    #
    # To use CGI scripts outside of ScriptAliased directories:
    # (You will also need to add "ExecCGI" to the "Options" directive.)
    #
    #AddHandler cgi-script .cgi
    AddHandler php5-script   .php
    # For type maps (negotiated resources):
    #AddHandler type-map var

    #
    # Filters allow you to process content before it is sent to the client.
    #
    # To parse .shtml files for server-side includes (SSI):
    # (You will also need to add "Includes" to the "Options" directive.)
    #
    #AddType text/html .shtml
    AddType text/html   .php
    #AddOutputFilter INCLUDES .shtml


4. Start apache server:


5. Checking php is working properly.

Copy index.php into htdocs folder with proper access permissions and open your browse http://172.16.26.15/index.php

index.php…



 <html> 

<head> 
        <title>PHP Test</title> 
        <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"
</head> 
<body> 
        <h1>PHP Test</h1> 
        <p> 
        <b>An Example of PHP in Action</b><br />
                <?php echo "The Current Date and Time is: <br>"
                        echo date("g:i A l, F j Y.");?> 
        </p> 
        <h2>PHP Information</h2> 
        <p> 
                <?php phpinfo(); ?> 
        </p> 
</body> 
</html> 



Installing Cacti on Solaris 10 (PART-1)



0 comments:

Post a Comment