Installing Logzilla 3.x on OpenSolaris

From Network Management Wiki

Jump to: navigation, search

Contents

About

This guide will walk you through the installation of LogZilla on OpenSolaris 2009-06 starting with the installation of the operating system itself. The guide was written in August 2010 and uses LogZilla 3.0.85.

All of the commands after the successful installation of OpenSolaris (and the first reboot) require running with root privileges. To gain root privileges from unprivileged mode issue

# su -

and enter the password set as your root password during the installation process.

In the following guide, wherever a file change is needed the line marked to be changed (and a line that is changed) is marked with:

unchanged line
-> line to be changed, line changed <-

Also, any time a line in the quoted text is prefixed with # (note, there needs to be a space after the hash mark, or the line is a comment in an edited file) it is a command that you should enter in your shell (again, remember that every installation step is done as root):

# this_is_a_command
#but this is a comment
# a command again
#a comment again


i386 and amd64

The guide expects the server to be an x86 compatible. If your server is an x86_64 platform, there should be no major changes involved. You should replace i386 with amd64 where appropriate.

The one important change when using the x86_64 platform is replacing

# crle -u -l ...
# crle -u -s ...

in the guide with

# crle -64 -u -l ...
# crle -64 -u -s ...


Requirements

The installation requires you to have the installation media for OpenSolaris x86 (downloadable from [1]) and a network connection to perform software installations.

Installing OpenSolaris

Booting from the DVD

To start the installation the server will be booted from the previously downloaded media.


File:Logzilla_3.0_opensolaris_01.jpg


Select OpenSolaris 2009-06 from the menu here, unless you have different requirements.

Select your keyboard layout

We select the keyboard layout to be used in the installation.


File:Logzilla_3.0_opensolaris_02.jpg


Select your language

Next we select the installation language. For the purpose of this guide I have used US English.


File:Logzilla_3.0_opensolaris_03.jpg


Desktop and starting the installation

OpenSolaris has now booted from the DVD. We start the installation by starting "Install OpenSolaris"


File:Logzilla_3.0_opensolaris_04.jpg


Well, let's see ... What do we do here? Ah... let's click on the Next button ;)


File:Logzilla_3.0_opensolaris_05.jpg


Disk partitioning

We will select one single Solaris type partition to use the whole disk - if your needs differ there is no reason not to choose a different partitioning scheme.


File:Logzilla_3.0_opensolaris_06.jpg


Picking your time zone

In the next step we will select the timezone where the server resides in. Also check that your time is displayed correctly (OpenSolaris expects the local clock to be UTC).


File:Logzilla_3.0_opensolaris_07.jpg


Picking your locale

We pick our locale from the dropdown menu. For the purpose of this installation the US was used as the territory and English as the language to be used.


File:Logzilla_3.0_opensolaris_08.jpg


Naming the server, creating a user, setting the root password

Select a root password and enter it in the first two textfields. Also create an account for a non-root user on the system, enter the user's full name, his username and the password and enter it in the appropriate text fields. The last text field will give a name to your new OpenSolaris server. After you are satisfied click on the Next button to reach the last step of the installation process.


File:Logzilla_3.0_opensolaris_09.jpg


Installation summary

Check your settings are correct and when satisfied start the installation process by clicking on the Install button.


File:Logzilla_3.0_opensolaris_10.jpg


Installation

The installation is started - it takes upwards of 15 minutes.


File:Logzilla_3.0_opensolaris_11.jpg


Installation is done

After the installation is finished, we have to remove the DVD media and then reboot the server by clicking on the Reboot button.


File:Logzilla_3.0_opensolaris_13.jpg


First boot

After reaching the logon screen, log on with the username and password you selected during the installation process (the non-root username).


File:Logzilla_3.0_opensolaris_15.jpg


Network configuration

Setting the static IP

As a first step, we will discover both our current IP and the name of the network interface that is in use.

# ifconfig -a


File:Logzilla_3.0_opensolaris_16.jpg


The name of our network interface is pcn0 and our current IP is 172.31.1.181.

By issuing

# pfexec bash

we start a bash shell as the root user. To set a static IP we have to disable the network autoconfiguration. Alternatively you can use a DHCP static IP address allocation and skip the Network Configuration chapter.

# svcadm disable network/physical:nwam
# svcadm enable network/physical:default

For the purpose of this guide the IP of our server will be 172.31.1.41. To set the static IP we have to edit the hostname.network_interface_name (pcn0 in our case) file and enter it's associated static IP in the file. We restart the network/physical:default service to set the new configuration as active.

# echo 172.31.1.41 > /etc/hostname.pcn0
# svcadm restart network/physical:default


File:Logzilla_3.0_opensolaris_17.jpg


Setting the default route

If we check our current routing table with netstat we can see that we currently have no default route. For the purpose of this guide the default gateway on the network is at 172.31.1.1. To achieve this we issue the following commands (the -p flag for route makes this route change persistent):

# route -p add default 172.31.1.1


File:Logzilla_3.0_opensolaris_18.jpg


Setting up DNS resolution

As the last step of the network configuration we have to set up a DNS server we can use. For the purpose of this guide the IP of the DNS server is 172.31.1.1. We also need to set the name resolution order to use DNS (and the /etc/hosts file).

# cp /etc/nsswitch.dns /etc/nsswitch.conf

We edit the /etc/resolv.conf file and add our nameserver to it:

nameserver 172.31.1.1


File:Logzilla_3.0_opensolaris_19.jpg


Updating OpenSolaris 2009-06

Updating the Boot Environment

We will update our OpenSolaris to the release currently publically available:

# pkg image-update

If you are warned that pkg is out of date:

WARNING: pkg(5) appears to be out of date, and should be updated before
running image-update.

Please update pkg(5) using 'pfexec pkg install SUNWipkg' and then retry
the image-update.

we have to update the SUNWipkg package first:

# pkg install SUNWipkg

The results of the command should be similar to the one below.

 
DOWNLOAD                                    PKGS       FILES     XFER (MB)
Completed                                    3/3     132/132     0.59/0.59

PHASE                                        ACTIONS
Removal Phase                                    1/1
Install Phase                                  11/11
Update Phase                                 208/208

After we have successfully updated pkg we proceed with updating OpenSolaris to the current release:

# pkg image-update

After the image update completes you will receive the following notification:

A clone of opensolaris exists and has been updated and activated.
On the next boot the Boot Environment opensolaris-1 will be mounted on '/'.
Reboot when ready to switch to this updated BE.

Next, we reboot the server to the new Boot Environment and log on as before to the now updated OpenSolaris.

# reboot

Switching to the "dev" release

After the reboot, we check our new environment:

# uname -a
SunOS osol 5.11 snv_111b i86pc i386 i86pc Solaris

We are now at snv_111b. To update further, we will switch to the "dev" release and update our Boot Environment again:

# pfexec bash
# pkg set-authority -O http://pkg.opensolaris.org/dev dev
# pkg set-publisher -P dev
# pkg image-update

This step can take a longer time (depending on your network connection). After this step completes we again receive the notification that our Boot Environment was updated, and as before we reboot to the new Boot Environment.

After this reboot, we again check the environment:

# uname -a
SunOS osol 5.11 snv_134 i86pc i386 i86pc Solaris

The server is now updated to snv_134 which is the current release at the time of the writing of this guide.

Next, remove the old opensolaris.org publisher:

# pkg set-publisher -P -g http://pkg.opensolaris.org/dev/ opensolaris.org
# pkg unset-publisher dev
# pkg set-publisher --remove-origin=http://pkg.opensolaris.org/release/ opensolaris.org

To check the current publisher list:

# pkg publisher

This is the expected output:

PUBLISHER                             TYPE     STATUS   URI
opensolaris.org          (preferred)  origin   online   http://pkg.opensolaris.org/dev/

Adding The Blastwave® Software Stack

We will be using The Blastwave® Software Stack for Solaris™ and OpenSolaris™ at [2] to provide easier software installs and more up-to-date packages. We achieve this by downloading and installing a package from BlastWave:

# cd /tmp
# wget http://download.blastwave.org/csw/pkgutil_i386.pkg
# pkgadd -d ./pkgutil_i386.pkg

We select the package (1) and confirm the installation:

The following packages are available:
  1  CSWpkgutil     pkgutil - Installs Solaris packages easily
                    (i386) VERSION=1.8.0,REV=2010.03.08_rev=bw

Select package(s) you wish to process (or 'all' to process
all packages). (default: all) [?,??,q]: 1
Do you want to continue with the installation of <CSWpkgutil> [y,n,?] y

Next, we update the BlastWave package catalog and add the basic utilities that we will require. As you can see all of the packages that we install through BlastWave are installed under /opt/csw/bin.

# /opt/csw/bin/pkgutil --catalog
# /opt/csw/bin/pkgutil --install gnupg textutils
# /opt/csw/bin/pkgutil --install wget
# /opt/csw/bin/wget http://www.blastwave.org/gpg_key.txt
# /opt/csw/bin/gpg --import gpg_key.txt

Next we check that we have the proper GPG key installed:

# /opt/csw/bin/gpg --list-keys
/root/.gnupg/pubring.gpg
--------------------------------------------------------------------------------
pub   1024D/A1999E90 2008-08-17 [expires: 2011-08-17]
uid                  Blastwave Software (Blastwave.org Inc.) <software@blastwave.org>
sub   2048g/E4845389 2008-08-17 [expires: 2011-08-17]

We need to authorize the key for software installations:

# /opt/csw/bin/gpg --edit-key A1999E90
pub  1024D/A1999E90  created: 2008-08-17  expires: 2011-08-17  usage: SC
                     trust: unknown       validity: unknown
sub  2048g/E4845389  created: 2008-08-17  expires: 2011-08-17  usage: E
[ unknown] (1). Blastwave Software (Blastwave.org Inc.) <software@blastwave.org>


We issue the 'Trust' command, select how far we trust the key (5 - I trust ultimately) and confirm our decision, and finally issue 'quit' to exit gpg.

Command> Trust
pub  1024D/A1999E90  created: 2008-08-17  expires: 2011-08-17  usage: SC
                     trust: unknown       validity: unknown
sub  2048g/E4845389  created: 2008-08-17  expires: 2011-08-17  usage: E
[ unknown] (1). Blastwave Software (Blastwave.org Inc.) <software@blastwave.org>

Please decide how far you trust this user to correctly verify other users' keys
(by looking at passports, checking fingerprints from different sources, etc.)

  1 = I don't know or won't say
  2 = I do NOT trust
  3 = I trust marginally
  4 = I trust fully
  5 = I trust ultimately
  m = back to the main menu

Your decision? 5
Do you really want to set this key to ultimate trust? (y/N) y


Command> quit

To enable GPG to check the packages we install are secure we edit the /etc/opt/csw/pkgutil.conf file:

# vi /etc/opt/csw/pkgutil.conf

Change

#use_gpg=true

to

use_gpg=true

Complete the BlastWave Software Stack installation by recataloging the packages:

# /opt/csw/bin/pkgutil --catalog

Installation of the requirements for LogZilla

Environment preparation

We start with creating backups of the configuration files we will change:

# cp /etc/default/login /etc/default/login.original
# cp /etc/default/su /etc/default/su.original

Then we change the PATH and SUPATH statements in both the /etc/default/login and /etc/default/su files:

PATH=/opt/csw/bin:/usr/sbin:/usr/bin:/usr/dt/bin:/usr/openwin/bin:/usr/ccs/bin:/opt/csw/mysql51/bin/ 
SUPATH=/opt/csw/bin:/usr/sbin:/usr/bin:/usr/dt/bin:/usr/openwin/bin:/usr/ccs/bin:/opt/csw/mysql51/bin/ 

We also change the root's .profile and alter the PATH environment variable:

# vi ~/.profile
export PATH=/opt/csw/bin:/usr/sbin:/usr/bin:/usr/dt/bin:/usr/openwin/bin:/usr/ccs/bin:/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin:/opt/csw/mysql51/bin/

Installation of software packages

gcc, Glib, gettext, tcpwrappers, libnet, ggrep

As a first step in this chapter we will install the gcc, Glib, gettext, tcpwrappers, libnet and ggrep packages:

# pkg install SUNWgcc
# pkg install SUNWGlib
# pkg install gettext
# pkgutil -i tcpwrappers
# pkg install pcre
# pkg install SUNWlibnet
# pkgutil -i CSWggrep

After the installations complete we update the paths where the system looks for the shared libraries (crle is functionally equivalent to ldconfig in Linux)

# crle -u -l /opt/csw/lib
# crle -u -s /opt/csw/lib
# crle -u -l /usr/local/lib
# crle -u -s /usr/local/lib

MySQL installation

We install MySQL 5.1 and the associated development package. The second command installs the initial database files.

# pkgutil -i CSWmysql51 CSWmysql51devel
# /opt/csw/mysql51/bin/mysql_install_db --user=mysql

At this point your MySQL will probably notify you with: "WARNING: The host 'osol' could not be looked up with resolveip.". To fix this we edit the /etc/hosts file and make sure it looks similar to the example (replace osol and osol.local with your server name, but leave the localhost and loghost names in the configuration):

::1 osol osol.local localhost loghost
127.0.0.1 osol osol.local localhost loghost

The installation unfortunately sets incorrect permissions on the datafiles, so we fix this with:

# svcadm disable cswmysql51
# chown -R mysql /opt/csw/mysql51/var/mysql/
# svcadm enable cswmysql51

As a last step in the MySQL installation we secure our MySQL installation (use enter as the current password, but set a proper password as the new password):

# /opt/csw/mysql51/bin/mysql_secure_installation
Enter current password for root (enter for none):
Set root password? [Y/n] y
Remove anonymous users? [Y/n] y
Disallow root login remotely? [Y/n] y
Remove test database and access to it? [Y/n] y
Reload privilege tables now? [Y/n] y

Apache 2 installation

We will be using Apache2 as our webserver, so we install it, it's associated development package and DBD::MySQL:

# pkgutil -i CSWapache2 CSWapache2dev CSWpmdbdmysql

We also update crle:

# crle -u -l /opt/csw/mysql51/lib/i386/mysql
# crle -u -s /opt/csw/mysql51/lib/i386/mysql

At this point we will check our crle configuration. Your configuration should be very similar (if not the same) as below:

# crle
Configuration file [version 4]: /var/ld/ld.config
  Platform:     32-bit LSB 80386
  Default Library Path (ELF):   /lib:/usr/lib:/opt/csw/lib:/usr/local/lib:/opt/csw/mysql51/lib/i386/mysql
  Trusted Directories (ELF):    /lib/secure:/usr/lib/secure:/opt/csw/lib:/usr/local/lib:/opt/csw/mysql51/lib/i386/mysql

Eventlog, libdbi, libdbi-drivers, Syslog-NG

Eventlog

To install eventlog:

# cd /tmp
# wget http://www.balabit.com/downloads/files/eventlog/0.2/eventlog_0.2.12.tar.gz
# gzip -d eventlog_0.2.12.tar.gz
# tar xvf eventlog_0.2.12.tar
# cd eventlog-0.2.12
# ./configure
# make
# make install

To enable pkg-config to find Eventlog on the system we copy the configuration file into the correct directories:

# cp /usr/local/lib/pkgconfig/eventlog.pc /usr/lib/pkgconfig/
# cp /usr/local/lib/pkgconfig/eventlog.pc /usr/lib/amd64/pkgconfig/

libdbi

We install libdbi to enable syslog-ng to use SQL as it's destinations:

# cd /tmp
# wget http://sourceforge.net/projects/libdbi/files/libdbi/libdbi-0.8.3/libdbi-0.8.3.tar.gz/download
# gzip -d libdbi-0.8.3.tar.gz
# tar xvf libdbi-0.8.3.tar
# cd libdbi-0.8.3
# ./configure
# make
# make install

libdbi-drivers

Along with libdbi, the associated libdbi-drivers need to be installed. Since the installation is not able to find the MySQL libraries on it's own we will help it by setting the LD_LIBRARY_PATH environment variable and point it to the MySQL shared library directory:

# cd /tmp
# wget http://sourceforge.net/projects/libdbi-drivers/files/libdbi-drivers/libdbi-drivers-0.8.3-1/libdbi-drivers-0.8.3-1.tar.gz/download
# gzip -d libdbi-drivers-0.8.3-1.tar.gz
# tar xvf libdbi-drivers-0.8.3-1.tar
# cd libdbi-drivers-0.8.3-1
# export LD_LIBRARY_PATH=/opt/csw/mysql51/lib/i386/mysql/
# ./configure --with-mysql --with-mysql-dir=/opt/csw/mysql51/
# make
# make install
# unset LD_LIBRARY_PATH

Syslog-NG

To enable the operating system to use the correct lex, we alter the PATH environment variable for this compilation step:

# export SAVEDPATH=$PATH
# export PATH=/usr/sbin:/usr/bin:/usr/dt/bin:/usr/openwin/bin:/usr/ccs/bin:/usr/gnu/bin:/usr/bin:/usr/sbin:/sbin

Next, we download the sources, unpack them and start the compilation:

cd /tmp
wget http://www.balabit.com/downloads/files/syslog-ng/sources/3.0.8/source/syslog-ng_3.0.8.tar.gz
gzip -d syslog-ng_3.0.8.tar.gz
tar xvf syslog-ng_3.0.8.tar 
cd syslog-ng-3.0.8/
./configure --enable-sql

At this point we will have to alter a few files in the source.

First, we change 1 line in src/logmatcher.c:

Change

#if ENABLE_PCRE
-> #include <pcre.h> <-
#endif

to

#if ENABLE_PCRE
-> #include "/usr/include/pcre/pcre.h" <- 
#endif

The second change we need to perform is changing 1 line in src/Makefile (we need to manually add -ldbi to syslog_ng_LDADD)

Change

syslog_ng_SOURCES = main.c
-> syslog_ng_LDADD = libsyslog-ng.a -lpthread   -ldoor -lsocket -lrt -lnsl -ll -lgthread-2.0 -lpthread -lthread -lglib-2.0   -L/usr/local/lib -levtlog
                     -lssl -lcrypto -lsocket -lnsl -lc   -lz  -lwrap  -lresolv  -lpcre    globals.o <-
syslog_ng_wrapper_SOURCES = wrapper.c

to

syslog_ng_SOURCES = main.c
-> syslog_ng_LDADD = libsyslog-ng.a -lpthread   -ldoor -lsocket -lrt -lnsl -ll -lgthread-2.0 -lpthread -lthread -lglib-2.0   -L/usr/local/lib -levtlog 
                     -lssl -lcrypto -lsocket -lnsl -lc   -lz  -lwrap  -lresolv  -lpcre    globals.o -ldbi <-
syslog_ng_wrapper_SOURCES = wrapper.c

We continue the compilation process:

# make
# make install

Next, we copy the startup script to /etc/init.d, make it executable and create the /etc/syslog-ng directory:

# cp /tmp/syslog-ng-3.0.8/contrib/init.d.solaris /etc/init.d/syslog-ng
# chmod +x /etc/init.d/syslog-ng
# mkdir /etc/syslog-ng
# ln -s /etc/init.d/syslog-ng /etc/rc2.d/S99syslog-ng

We prepare the /etc/syslog-ng/syslog-ng.conf configuration file (it should be otherwise completely empty, since we will let LogZilla to "fill in the gaps"):

# vi /etc/syslog-ng/syslog-ng.conf

############################################################
source net {
        udp(ip(0.0.0.0) port(514) so_rcvbuf(1048576));
        tcp(ip(0.0.0.0) port(514) so_rcvbuf(1048576));
};
############################################################

And as a last step we set up the correct PATH environment variable again and restart syslog-ng:

# export PATH=$SAVEDPATH
# unset SAVEDPATH
# /etc/init.d/syslog-ng stop
# /etc/init.d/syslog-ng start

Perl modules

First, we install lynx as a prerequirement for perl's CPAN:

# pkg install lynx

Next, we configure the CPAN module and install the required modules:

# perl -MCPAN -eshell

Default settings for CPAN should be fine:

Are you ready for manual configuration? [yes]
CPAN build and cache directory? [/root/.cpan]
Cache size for build directory (in MB)? [10]
Perform cache scanning (atstart or never)? [atstart]
Cache metadata (yes/no)? [yes]
Your terminal expects ISO-8859-1 (yes/no)? [yes]
File to save your history? [/root/.cpan/histfile]
Number of lines to save? [100]
Policy on building prerequisites (follow, ask or ignore)? [ask]
Where is your gzip program? [/usr/bin/gzip]
Where is your tar program? [/usr/sbin/tar]
Where is your unzip program? [/usr/bin/unzip]
Where is your make program? [/usr/bin/make]
Where is your lynx program? [/usr/bin/lynx]
Where is your wget program? [/opt/csw/bin/wget]
Where is your ncftpget program? [/usr/bin/ncftpget]
Where is your ftp program? [/opt/csw/bin/ftp]
Where is your gpg program? [/opt/csw/bin/gpg]
What is your favorite pager program? [/usr/bin/less -ins]
What is your favorite shell? [/usr/bin/bash]

Parameters for the 'perl Makefile.PL' command?
Typical frequently used settings:

    PREFIX=~/perl       non-root users (please see manual for more hints)

Your choice:  []

Parameters for the 'make' command?
Typical frequently used setting:

    -j3              dual processor system

Your choice:  []

Parameters for the 'make install' command?
Typical frequently used setting:

    UNINST=1         to always uninstall potentially conflicting files

Your choice:  []

Timeout for inactivity during Makefile.PL? [0]
Your ftp_proxy?
Your http_proxy?
Your no_proxy?

Select your closest mirror:

Select your continent (or several nearby continents) [] 
Select your country (or several nearby countries) [] 
put them on one line, separated by blanks, e.g. '1 4 5' [] 
Enter another URL or RETURN to quit: []
cpan>

Date::Calc

We install Date::Calc with:

cpan> install Date::Calc

The installation will prepend a few more modules to the installation queue: Answer yes to all of these queries:

Shall I follow them and prepend them to the queue
of modules we are processing right now? [yes]

If the installation of Date::Calc fails (it did for me on one try), just reissue install Date::Calc and it will now install fine. (and they say computers don't have moods?). Finally we exit the cpan shell with quit:

cpan> quit

We are not able to install Text::LevenshteinXS and String::CRC32 through the cpan shell, but have to do it manually.

As an interlude - due to the fact that Perl was compiled with SunStudio with some flags, that don't make sense to gcc, we'll have to manually change the Makefiles for most modules.

There is the possibility of a semi-permanent change which involves editing the /opt/csw/lib/perl/5.8.8/Config_heavy.pl and making the changes there by changing the following lines:

/opt/csw/lib/perl/5.8.8/Config_heavy.pl:

cc='cc'
-> cccdlflags='-KPIC' <-
ccdlflags='-R /opt/csw/lib'
-> ccflags='-D_REENTRANT -xO3 -xtarget=generic -xarch=generic -I/opt/csw/bdb44/include -I/opt/csw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' <-
ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'

to

cc='cc'
-> cccdlflags='-fPIC' <-
ccdlflags='-R /opt/csw/lib'
-> ccflags='-D_REENTRANT -O3 -I/opt/csw/bdb44/include -I/opt/csw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64' <-
ccflags_uselargefiles='-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64'

Also change

cppccsymbols=''
-> cppflags='-D_REENTRANT -xO3 -xtarget=generic -xarch=generic -I/opt/csw/bdb44/include -I/opt/csw/include' <-
cpplast='-'

to

cppccsymbols=''
-> cppflags='-D_REENTRANT -O3 -I/opt/csw/bdb44/include -I/opt/csw/include' <-
cpplast='-'

and

old_pthread_create_joinable=''
-> optimize='-xO3 -xtarget=generic -xarch=generic' <-
orderlib='false'

to

old_pthread_create_joinable=''
-> optimize='-O3' <-
orderlib='false'

Please do note, that this Config_heavy.pl might be lost as you upgrade Perl - so keep this reference saved in case you run into compilation problems.

If you've decided to do it this way, you can finish the installation with the following commands and skip to the next chapter of the guide.

# perl -MCPAN -e shell
cpan>
cpan> install Text::LevenshteinXS
cpan> install String::CRC32
cpan> quit

Personally, I prefer the alternative way (the manual installation), even with the overhead - changing Config_heavy.pl might create unexpected problems in the future. The guide presumes you will do the same.

Text::LevenshteinXS

We continue by installing Text::LevenshteinXS:

 
# cd /tmp
# wget http://search.cpan.org/CPAN/authors/id/J/JG/JGOLDBERG/Text-LevenshteinXS-0.03.tar.gz
# gzip -d Text-LevenshteinXS-0.03.tar.gz
# tar xvf Text-LevenshteinXS-0.03.tar
#  Text-LevenshteinXS-0.03
# perl Makefile.PL
# vi Makefile

Change the following lines in Makefile:

CC = cc
-> CCCDLFLAGS = -KPIC <-
CCDLFLAGS = -R /usr/perl5/5.8.4/lib/i86pc-solaris-64int/CORE

to

CC = cc
-> CCCDLFLAGS = -fPIC <-
CCDLFLAGS = -R /usr/perl5/5.8.4/lib/i86pc-solaris-64int/CORE

and

-> CCFLAGS = -D_REENTRANT -xO3 -xtarget=generic -xarch=generic -I/opt/csw/bdb44/include -I/opt/csw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 <-
-> OPTIMIZE = -xO3 -xspace -xildoff <-
PERLTYPE =

to

-> CCFLAGS = -D_REENTRANT -O3 -I/opt/csw/bdb44/include -I/opt/csw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 <-
-> OPTIMIZE = -O3 <-
PERLTYPE =

We finish the installation of Text::LevenshteinXS with:

# make
# make test
# make install

String::CRC32

The last prerequisite module for LogZilla is String::CRC32:

# cd /tmp
# wget http://search.cpan.org/CPAN/authors/id/S/SO/SOENKE/String-CRC32-1.4.tar.gz
# gzip -d String-CRC32-1.4.tar.gz
# tar xvf String-CRC32-1.4.tar
# cd String-CRC32-1.4
# perl Makefile.PL

As before, we need to alter the Makefile and change:

CC = cc
-> CCCDLFLAGS = -KPIC <-
CCDLFLAGS = -R /usr/perl5/5.8.4/lib/i86pc-solaris-64int/CORE

to

CC = cc
-> CCCDLFLAGS = -fPIC <-
CCDLFLAGS = -R /usr/perl5/5.8.4/lib/i86pc-solaris-64int/CORE

and

-> CCFLAGS = -D_REENTRANT -xO3 -xtarget=generic -xarch=generic -I/opt/csw/bdb44/include -I/opt/csw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 <-
-> OPTIMIZE = -xO3 -xtarget=generic -xarch=generic <-
PERLTYPE =

to

-> CCFLAGS = -D_REENTRANT -O3 -I/opt/csw/bdb44/include -I/opt/csw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 <-
-> OPTIMIZE = -O3 <-
PERLTYPE =

We finish the installation of String::CRC32 with:

# make
# make test
# make install

PHP 5.3

In this step we will install PHP 5.3, several extensions and the apache2 php 5.3 module:

# pkgutil -i CSWphp53 CSWphp53gd CSWphp53gettext CSWphp53mysql CSWphp53mysqli CSWphp53pdomysql CSWap2modphp53

You will be asked to confirm your installation choices a few times during this step, answer with y to each of these queries:

44 packages to fetch. Do you want to continue? [Y,n]

Do you want to continue with the installation of <#package#> [y,n,?] y

Make a backup of httpd.conf, check that the php5_module extension is being loaded and add index.php as a Directory Index candidate:

# cp /etc/opt/csw/apache2/httpd.conf /etc/opt/csw/apache2/httpd.conf.orig
# vi /etc/opt/csw/apache2/httpd.conf

Check that the php5_module is being loaded, add it if it's not being loaded yet:

LoadModule alias_module libexec/mod_alias.so
LoadModule rewrite_module libexec/mod_rewrite.so
-> LoadModule php5_module libexec/libphp5.so <-
#

Also in httpd.conf change:

<IfModule dir_module>
->    DirectoryIndex index.html <-
</IfModule>

to

<IfModule dir_module>
->    DirectoryIndex index.php index.html <-
</IfModule>

Finally we restart Apache 2 with:

# svcadm restart cswapache2

DBI

LogZilla requires DBI:

# cd /tmp
# wget http://search.cpan.org/CPAN/authors/id/T/TI/TIMB/DBI-1.613.tar.gz
# gzip -d DBI-1.613.tar.gz
# tar xvf DBI-1.613.tar
# cd DBI-1.613
# perl Makefile.PL

And again, we have to alter the Makefile and change:

CC = cc
-> CCCDLFLAGS = -KPIC <-
CCDLFLAGS = -R /opt/csw/lib

to

CC = cc
-> CCCDLFLAGS = -fPIC <-
CCDLFLAGS = -R /opt/csw/lib

... and ...

-> CCFLAGS = -D_REENTRANT -xO3 -xtarget=generic -xarch=generic -I/opt/csw/bdb44/include -I/opt/csw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 <-
-> OPTIMIZE = -xO3 -xtarget=generic -xarch=generic <-
PERLTYPE =

to

-> CCFLAGS = -D_REENTRANT -O3 -I/opt/csw/bdb44/include -I/opt/csw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 <-
-> OPTIMIZE = -O3 <-
PERLTYPE =

We finish the installation of DBI with:

# make
# make test
# make install

If make test fails with reference to make test_dynamic it's safe to ignore it, since it will not affect our functionality.

DBD::MySQL

To enable us to run make test in this step we have to temporarily create the test database:

# mysql -p

Enter the previously selected password, and create the test database:

 
mysql> create database test;
mysql> quit

We continue the DBD::MySQL installation:

# cd /tmp
# wget http://search.cpan.org/CPAN/authors/id/C/CA/CAPTTOFU/DBD-mysql-4.016.tar.gz
# gzip -d DBD-mysql-4.016.tar.gz
# tar xvf DBD-mysql-4.016.tar
# cd DBD-mysql-4.016
# export SAVEDPATH=$PATH
# export PATH=$PATH:/opt/csw/mysql51/bin/i386/

To enable us to run the make test step, we pass the Makefile.PL script the --testuser and --testpassword arguments. Replace #password# with your root MySQL password (remember to clean up the compilation files later, since your password will be written to a few files).

# perl Makefile.PL --testuser=root --testpassword=#password#

Again, we have to change the Makefile:

CC = cc
-> CCCDLFLAGS = -KPIC <-
CCDLFLAGS = -R /opt/csw/lib

to

CC = cc
CCCDLFLAGS = -fPIC
CCDLFLAGS = -R /opt/csw/lib

and

-> CCFLAGS = -D_REENTRANT -xO3 -xtarget=generic -xarch=generic -I/opt/csw/bdb44/include -I/opt/csw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 <-
-> OPTIMIZE = -xO3 -xtarget=generic -xarch=generic <-
PERLTYPE =

to

-> CCFLAGS = -D_REENTRANT -O3 -I/opt/csw/bdb44/include -I/opt/csw/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 <-
-> OPTIMIZE = -O3 <-
PERLTYPE =

and one more change:

VERSION_FROM = lib/DBD/mysql.pm
-> INC = -I$(DBI_INSTARCH_DIR) -I/opt/csw/mysql51/include/mysql  -xtarget=generic -D__EXTENSIONS__ -I/opt/csw/include    -D_FILE_OFFSET_BITS=64 -DHAVE_CURSES_H -I/home/remko/gar2009/server/mysql5.1/work/remko-thor/i386/i386/mysql-5.1.46/include -DHAVE_RWLOCK_T -DUNIV_SOLARIS -DUNIV_SOLARIS -DDBD_MYSQL_WITH_SSL -DDBD_MYSQL_INSERT_ID_IS_GOOD -g <-
OBJECT = $(O_FILES)

to

VERSION_FROM = lib/DBD/mysql.pm
-> INC = -I$(DBI_INSTARCH_DIR) -I/opt/csw/mysql51/include/mysql -D__EXTENSIONS__ -I/opt/csw/include -D_FILE_OFFSET_BITS=64 -DHAVE_CURSES_H -DHAVE_RWLOCK_T -DUNIV_SOLARIS -DUNIV_SOLARIS -DDBD_MYSQL_WITH_SSL -DDBD_MYSQL_INSERT_ID_IS_GOOD -g <-
OBJECT = $(O_FILES)

and really just one more little change:

#
-> EXTRALIBS = -lCrun -lrt -L/usr/mysql/5.1/lib/mysql -R/usr/mysql/5.1/lib/mysql -lmysqlclient -lz <-
-> LDLOADLIBS = -lCrun -lrt -L/usr/mysql/5.1/lib/mysql -R/usr/mysql/5.1/lib/mysql -lmysqlclient -lz -lsocket -lnsl -lm <-
BSLOADLIBS =

to

#
-> EXTRALIBS = -lrt -L/usr/mysql/5.1/lib/mysql -R/usr/mysql/5.1/lib/mysql -lmysqlclient -lz <-
-> LDLOADLIBS = -lrt -L/usr/mysql/5.1/lib/mysql -R/usr/mysql/5.1/lib/mysql -lmysqlclient -lz -lsocket -lnsl -lm <-
BSLOADLIBS =

And we continue the compilation with:

# make
# make test
# make install

If make test did not report any errors, we can drop the test MySQL database:

# mysql -p 
mysql> drop database test;
mysql> quit

As the last step, we reset our PATH environment variable back to it's original value:

# export PATH=$SAVEDPATH
# unset SAVEDPATH

The installation of LogZilla itself

LogZilla

So, after a lengthy preparation, we're now finally ready to install LogZilla itself.

Please follow the section in the main install guide on how/where to get the software:

Install_Guide_for_LogZilla_v3.0#Obtaining_LogZilla


We will install LogZilla into the /opt directory:

# cd /opt/
# wget http://www.logzilla.info/v/logzilla_x.x.tgz
# gzip -d logzilla_x.x.tgz
# tar xvf logzilla_x.x.tar
# rm logzillax.x.tar

We have to alter a few files>

# cd /opt/logzilla/scripts/
# vi install.pl

We change the first line in install.pl from:

-> #!/usr/bin/perl <-

to

-> #!/opt/csw/bin/perl <-

also, we need to replace references to grep with ggrep in install.pl, since OpenSolaris' grep doesn't support the -R flag, so we change:

    print "Updating file paths\n";
->    foreach my $file (qx(grep -Rl $search ../* | egrep -v "install.pl|.svn|.sql|CHANGELOG")) { <-
        chomp $file;

to

    print "Updating file paths\n";
->    foreach my $file (qx(ggrep -Rl $search ../* | egrep -v "install.pl|.svn|.sql|CHANGELOG")) { <-
        chomp $file;

and change

    print "Updating log paths\n";
->    foreach my $file (qx(grep -Rl $search ../* | egrep -v "install.pl|.svn|.sql|CHANGELOG")) { <-
        chomp $file;

to

    print "Updating log paths\n";
->    foreach my $file (qx(ggrep -Rl $search ../* | egrep -v "install.pl|.svn|.sql|CHANGELOG")) { <-
        chomp $file;

The only deviation from the defaults in this guide for the LogZilla installation will be the change of the password for syslogadmin to syspassword. We start the LogZilla installation with:

# ./install.pl
========================================

     LogZilla Installation

========================================



Enter the MySQL root username [root]:
Enter the password for root [mysql]: password
Database to install to [syslog]:
Database table to install to [logs]:
Enter the name to create as the owner of the logs database [syslogadmin]:
Note that a password containing ' may not work.
Enter the password for the syslogadmin user [syslogadmin]: syspassword
Enter the name to create as the WEBSITE owner [admin]:
Enter the password for admin [admin]:
Enter your email address [cdukes@cdukes.com]:
Enter a name for your website [The home of LogZilla]:
Enter the base url for your site (include trailing slash) [/logs/]:
Where should log files be stored? [/var/log/logzilla]:
How long should I keep old logs? (in days) [30]:



========================================

     Path Updates

========================================



Getting ready to replace paths in all files with "/opt/logzilla"
Ok to continue? [y]:
Updating file paths
Modifying ../scripts/db_insert.pl
Modifying ../scripts/contrib/system_configs/logzilla.crontab
Modifying ../scripts/contrib/system_configs/syslog-ng.conf
Modifying ../scripts/contrib/system_configs/logzilla.apache
Modifying ../scripts/contrib/daily_text_report/mail_daily_counts.pl
Modifying ../scripts/contrib/genreport/genreport.pl
Modifying ../sphinx/sphinx.conf
Modifying ../sphinx/indexer.sh
Updating log paths
Modifying ../scripts/contrib/system_configs/logzilla.crontab
Modifying ../scripts/contrib/system_configs/logzilla.logrotate



========================================

     Database Installation

========================================



All data will be installed into the syslog database
Ok to continue? [y]: y



========================================

     Config.php generation

========================================



Generating /opt/csw/apache2/share/htdocs/logzilla/html/config/config.php
Ok to continue? [y]: y



========================================

     System files

========================================




     WARNING!
Unable to locate your /etc/logrotate.d directory
You will need to manually copy:
cp contrib/system_configs/logzilla.logrotate /etc/logrotate.d/logzilla
Where is your syslog-ng.conf file located? [/etc/syslog-ng/syslog-ng.conf]:
Adding syslog-ng configuration to /etc/syslog-ng/syslog-ng.conf
Ok to continue? [y]: y
Which source definition would you like to use? [net]:

     LogZilla installation complete...
Note: you may need to enable the MySQL Event Scheduler in your /etc/my.cnf file.
Please visit http://forum.logzilla.info/index.php/topic,71.0.html for more information.

Also, please visit http://nms.gdd.net/index.php/Install_Guide_for_LogZilla_v3.0#UDP_Buffers to learn how to increase your UDP buffer size (otherwise you may drop messages).

Please run /etc/init.d/syslog-ng restart

After this step, my backspace key refused to work, so I had to fix it with (instead of ^? press your backspace key once):

# stty erase ^?

Next, we restart syslong-ng as advised by the installation script:

# /etc/init.d/syslog-ng stop
# /etc/init.d/syslog-ng start

Next, we need to change the first lines of the following files:

  1. /opt/logzilla/scripts/db_insert.pl
  2. /opt/logzilla/scripts/contrib/daily_text_report/mail_daily_counts.pl
  3. /opt/logzilla/scripts/contrib/logreplay/logreplay.pl
  4. /opt/logzilla/scripts/contrib/genreport/genreport.pl

and change the first line of each of these 4 files from

-> #!/usr/bin/perl <-

to

-> #!/opt/csw/bin/perl <-

Sphinx

Next, we have to configure Sphinx:

# cd /opt/logzilla/sphinx/src
# gzip -d sphinx-0.9.9.tar.gz
# tar xvf sphinx-0.9.9.tar
# cd sphinx-0.9.9
# ./configure --prefix `pwd`/../.. --with-mysql --with-mysql-includes=/opt/csw/mysql51/include/mysql/ --with-mysql-libs=/opt/csw/mysql51/lib/i386/mysql/
# make
# make install
# cd ../..

/opt/logzilla/sphinx/sphinx.conf also needs a small change in it's first line also:

-> #!/usr/bin/php <-

to

-> #!/opt/csw/php53/bin/php <-

Next, we create the Sphinx search index:

# ./indexer.sh full

We also need to add the following entries to crontab by issuing:

# crontab -e

and adding the following entries to it (*/5 is not supported on OpenSolaris to the best of my knowledge):

30 0 1 * * /opt/logzilla/sphinx/indexer.sh full >> /opt/logzilla/sphinx/log/sphinx_indexer.log 2>&1
0,5,10,15,20,25,30,35,40,45,50,55 * * * * /opt/logzilla/sphinx/indexer.sh delta >> /opt/logzilla/sphinx/log/sphinx_indexer.log 2>&1
0 0 * * * /opt/logzilla/sphinx/indexer.sh merge >> /opt/logzilla/sphinx/log/sphinx_indexer.log 2>&1

To start the Sphinx searchd automatically, we create a file in /etc/init.d named sphinx-searchd:

# vi /etc/init.d/sphinx-searchd

and create it as:

#!/bin/sh

option="$1"

case "$option" in
'start')
        echo 'Starting Sphinx searchd'
        /opt/logzilla/sphinx/bin/searchd -c /opt/logzilla/sphinx/sphinx.conf
        ;;

'stop')
        echo 'Stopping Sphinx searchd'
        /usr/bin/pkill -f logzilla\/sphinx\/bin\/searchd
        ;;

*)
        echo "Usage: $0 { start | stop }"
        exit 1
        ;;
esac
exit 0

We make the startup script executable, link it to be automatically started upon system startup and finally start the sphinx-searchd itself.

# chmod +x /etc/init.d/sphinx-searchd
# ln -s /etc/init.d/sphinx-searchd /etc/rc2.d/S99sphinx-searchd
# /etc/init.d/sphinx-searchd start

Check that the MySQL event scheduler is turned on

To check that the MySQL event scheduler is turned on:

# mysql -p
mysql> 
mysql> SELECT @@event_scheduler;

If the event scheduler is turned on, we should see:

+-------------------+
| @@event_scheduler |
+-------------------+
| ON                |
+-------------------+
1 row in set (0.00 sec)

If your MySQL installation has the event_scheduler turned off, turn it on with:

mysql> SET GLOBAL event_scheduler = 1;

We leave the MySQL shell and Sphinx is now properly installed.

mysql> quit

Apache2 httpd.conf change

Next, we need to alter httpd.conf to have the alias logs pointing to our LogZilla installation:

# vi /opt/csw/apache2/etc/httpd.conf

Change (replace osol with the name of your server):

#
#ServerName www.example.com:80

to

#
#ServerName www.example.com:80
-> ServerName osol <-

and also in httpd.conf we add to the end of the file:

# LogZilla
   Alias /logs "/opt/logzilla/html/"
   <Directory "/opt/logzilla/html/">
       Options Indexes MultiViews FollowSymLinks
       AllowOverride All
   Order allow,deny
   Allow from all
   </Directory>

Technically it would be preferrable to add this configuration to sites-available/logzilla, but since the BlastWave Apache2 installation does not provide for this, we have to compromise.

We restart Apache, so the new configuration is applied:

# svcadm restart cswapache2

IONCube Loader installation

We need to add the IONCube loader files manually to OpenSolaris with:

# cd /usr/local
# wget http://downloads2.ioncube.com/loader_downloads/ioncube_loaders_sun_x86.tar.gz
# gzip -d ioncube_loaders_sun_x86.tar.gz
# tar xvf ioncube_loaders_sun_x86.tar
# rm ioncube_loaders_sun_x86.tar

and we add the zend_extension to our php.ini file with:

# vi /opt/csw/php53/lib/php.ini

and the following entry before any other zend_extension configuration directive:

zend_extension = /usr/local/ioncube/ioncube_loader_sun_5.3.so

Finally, we restart Apache again, so PHP loads the new zend_extension:

# svcadm restart cswapache2

Conclusion

Log on to your LogZilla installation by pointing your browser to http://w.x.y.z/logs/ (replace w.x.y.z with your IP).

Do not forget

It would be advisable to protect your server with a firewall (ipf is included with OpenSolaris). A good starting point is at [3]. For basic operation, you will need to allow connections to udp/514 (and tcp/514 if you use a tcp listener also), tcp/80 (where your webserver listens) and most probably tcp/22 if you wish to remotely administer your server.

It would also be advisable to optimize your MySQL parameters. MySQL will look for my.cnf in /opt/csw/mysql51/.

In case of trouble ...

In case that you have a question or need assistance feel free to contact me through the LogZilla forum - my userid is damirc.

Personal tools