Thursday, October 8, 2009

Installing and Upgrading Perl module using PPM

This post describes how to install/upgrade perl modules using PPM on windows

1. To install a new package run ppm command from the command prompt


ppm install

eq: C:\PERL>ppm install Text::CSV_XS

2. To upgrade an existing package use the ppm upgrade command

ppm upgrade --install


In the following example we are trying to upgrade the Text::CSV_XS module

2.1 Check the current version

C:\PERL>perl -MText::CSV_XS -e "print $Text::CSV_XS::VERSION"
0.23

2.2 Update the current version

C:\PERL>ppm upgrade --install Text-CSV_XS
Text-CSV_XS 0.23: new version 0.65 available in Autonamed 3
Text-CSV_XS 0.23: new version 0.65 available in Autonamed 2
Text-CSV_XS 0.23: new version 0.35 available in ActiveState Package Repository
Text-CSV_XS 0.23: new version 0.35 available in ActiveState PPM2 Repository

Note: Text-CSV_XS version 0.23 is available from more than one place.
Which repository would you like to upgrade from?

1. Autonamed 3
2. Autonamed 2
3. ActiveState Package Repository
4. ActiveState PPM2 Repository

Repository? [ActiveState PPM2 Repository] 1
====================
Upgrade 'http://ppm.tcool.org/archives/Text-CSV_XS.ppd' version 0.65 in ActivePerl 5.8.2.808.
====================
Files found in blib\arch: installing files in blib\lib into architecture dependent library tree
Installing C:\Perl\site\lib\auto\Text\CSV_XS\CSV_XS.dll
Installing C:\Perl\site\lib\auto\Text\CSV_XS\CSV_XS.exp
Installing C:\Perl\site\lib\auto\Text\CSV_XS\CSV_XS.lib
Installing C:\Perl\site\lib\auto\Text\CSV_XS\CSV_XS.pdb
Installing C:\Perl\site\lib\Text\CSV_XS.pm
Writing C:\Perl\site\lib\auto\Text\CSV_XS\.packlist
Successfully upgraded Text-CSV_XS version 0.65 in ActivePerl 5.8.2.808.

2.3 Check the version again

C:\PERL>perl -MText::CSV_XS -e "print $Text::CSV_XS::VERSION"
0.65

Saturday, August 15, 2009

Modifying Swap file size

Sometimes it is necessary to add more swap space after installation. For example, you may upgrade the amount of RAM in your system from 1024 MB to 2048 MB, but there is only 2048 MB of swap space. It might be advantageous to increase the amount of swap space to 3072 MB if you perform memory-intense operations or run applications that require a large amount of memory.

You have two options: add a swap partition or add a swap file. It is recommended that you add a swap partition, but that can be difficult if you do not have any free space available.

The example below assumes you don’t have an additional free space available to create a partition so we will be adding a swap file to enable more swap space

To add a swap file:

Determine the size of the new swap file in megabytes and multiple by 1024 to determine the block size. For example, the block size of a 64 MB swap file is 65536.

Here we want to add additional 1024 MB to increase the swap space to 3072 from 2048

1.At a shell prompt as root, type the following command with count being equal to the desired block size:

dd if=/dev/zero of=/swapfile bs=1048576 count=1024

2.Setup the swap file with the command:

mkswap /swapfile

3.To enable the swap file immediately but not automatically at boot time:

swapon /swapfile

4.To enable it at boot time, edit /etc/fstab to include:

Echo “/swapfile swap swap defaults 0 0” >> /etc/fstab

The next time the system boots, it enables the new swap file.

5.After adding the new swap file and enabling it, you can verify it is enabled by the following commands

# cat /proc/swaps

# free –m


To Remove a swap file

1.At a shell prompt as root, execute the following command to disable the swap file (where /swapfile is the swap file):

swapoff /swapfile

2.Remove its entry from /etc/fstab

3.Remove the actual file:

rm /swapfile

If you want to disable an additionally added swap partition use the swapoff on that partition and then remove the fstab entries

for eq:

swapoff /dev/hdb3

Saturday, August 8, 2009

Installing Bugzilla

Bugzilla is a bug-tracking system from mozilla.org. Bugzilla is enterprise-class piece of software that tracks bugs and issues for hundreds of organizations around the world.

Step 1: Create server say bugzilla.mydomain.com

Setup hostname, network, dns etc properly

Step 2 : Install the following prerequisites

Before installing see bugzilla documentation for supported versions for the package you are going to install

•Install MTA
#yum install sendmail*
•Install database server
#yum install mysql-server
•Install web server
#yum install httpd-*
•Install Perl
#Yum Install perl-*
#yum install ImageMagick-devel

Step 3 : Configure sendmail to send and recive email

You may need to configure your DNS server properly to set your email server to send and receive email. By default send mail will listen port on 25 in 127.0.0.1 only ,Change DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl as below

#vi /etc/mail/sendmail.mc

dnl #DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

#m4 /etc/mail/sendmail.mc > /etc/mail/sendmail.cf
#service sendmail restart
#chkconfig sendmail on

Note: - [Please see send mail documentation for any additional configurations]

Step 4 : Setup Database Server

•Start mysql server
#service mysqld start
•Set mysqladmin password
# mysqladmin password ********

Step 4.1: Allow large attachments and many comments

By default, MySQL will only allow you to insert things into the database that are smaller than 64KB. To change MySQL’s default, you need to edit your MySQL configuration file, which is usually /etc/my.cnf on Linux.

# vi /etc/my.cnf

[mysqld]
max_allowed_packet=10M

Step 4.2: Allow small words in full-text indexes

By default, words must be at least four characters in length in order to be indexed by MySQL’s full-text indexes. This causes a lot of Bugzilla specific words to be missed, including "cc", "ftp" and "uri".
MySQL can be configured to index those words by setting the ft_min_word_len param to the minimum size of the words to index. This can be done by modifying the /etc/my.cnf according to the example below:

# vi /etc/my.cnf
[mysqld]
# Allow small words in full-text indexes
ft_min_word_len=2

Step 4.3: create a database user to use for bugzilla

You need to add a new MySQL user for Bugzilla to use. (It’s not safe to have Bugzilla use the MySQL root account.) You will need the $db_pass password later to set in localconfig . I used SQL GRANT command to create a “bugs” user. This also restricts the “bugs”user to operations within database called “bugs”, and only allows the account to connect from “localhost”. Modify your setup if you will be connecting from another machine or as a different user. Replace $db_password with your proffered password


mysql> GRANT SELECT, INSERT,UPDATE, DELETE, INDEX, ALTER, CREATE, LOCK TABLES,CREATE TEMPORARY TABLES, DROP, REFERENCES ON bugs.* TO bugs@localhost IDENTIFIED BY ’$db_password’;

mysql> FLUSH PRIVILEGES;

Step 4.4 . Permit attachments table to grow beyond 4GB Note: [This has to be done only after completing bugzilla installation]

By default, MySQL will limit the size of a table to 4GB. This limit is present even if the underlying filesystem has no such limit. To set a higher limit, follow these instructions. After you have completed the rest of the installation (or at least the database setup parts), you should run the MySQL command-line client and enter the following, replacing $bugs_db with your Bugzilla database name (bugs by default):

mysql> use $bugs_db
mysql> ALTER TABLE attachments AVG_ROW_LENGTH=1000000,MAX_ROWS=20000;

Step 5: Setup webserver

Normally you will have to add set the server name and specify the document root directory .
Note [ Follow apache/httpd documentation for any advance configurations]

#vi /etc/httpd/conf/httpd.conf

ServerName bugzilla.mydomain.com


#service httpd restart
#chkconfig httpd on

Setup 6: Install Bugzilla

Download the latest package from bugzilla and unzip it

#tar -xvzf bugzilla-3.4.1.tar.gz
#mv bugzilla-3.4.1 /var/www/html/
# chown -R 751 bugzilla-3.4.1/
#chown root:apache -R bugzilla-3.4.1/


Step 7: Edit localconfig

#vi /var/www/html/bugzilla/localconfig

Set database password , username , location of dot /usr/bin/dot etc here

Step 10: Install all required modules

#cd /var/www/html/bugzilla/

Check whether all required modules are installed or not using checksetup.pl --check-modules
#./checksetup.pl --check-modules

Install any missing modules
eg: #/usr/bin/perl install-module.pl GD::Text

Step 11: Run checksetup.pl

After resolving all dependencies you can install bugzilla by running the below command

#./checksetup.pl


Step 12: Verify whether bugzilla is accessible

At this point we will be able to upgraded bugzilla instance bu accessing http://bugzilla.mydomain.com/bugzilla


Well .... its ready do some customization and play with bugs:-)

Tuesday, August 4, 2009

How to find include path (@INC) for installed Perl environment?



Methode 1: You can run the following commands to get the @INC path

perl -e "print qq(@INC)"


You can just run that command from the both Linux and dos command line.

The output from this command on Windows PC will looks like this:

C:/Perl/lib C:/Perl/site/lib .


The output from Linux server will looks like this:

/usr/lib/perl5 //usr/lib/perl5/site_perl /usr/lib/perl5/vendor_perl .


Methode 2: Alternatively you can use #perl -V to find out included paths along with other information's

Use perl -V to see the include paths @INC

The output from Linux server will looks like this:

/usr/lib/perl5/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/5.8.0
/usr/lib/perl5/site_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/site_perl/5.8.0
/usr/lib/perl5/site_perl
/usr/lib/perl5/vendor_perl/5.8.0/i386-linux-thread-multi
/usr/lib/perl5/vendor_perl/5.8.0
/usr/lib/perl5/vendor_perl

Sunday, August 2, 2009

Installing Jboss On Linux

This blog decribes how to install and setup jboss to start automatically on RedHat Linux

Step1: Install Java and set environment variables

Please follow this link for instructions

Step2: Create a user called jboss

It always advisable to create a user "jboss" that can be used to start/stop jboss and can be assign permissions
#useradd jboss

Step3: Download appropriate package from Jboss and Install it

#tar -xvxf jboss-5.1.0.GA-jdk6.zip
#mv jboss-5.1.0.GA /usr/local/
#chown -R jboss:jboss /usr/local/jboss-5.1.0.GA
Step4: Set Environment variables for JBOSS

Create a file /etc/profile.d/jboss
# touch /etc/profile.d/jboss
# chmod +x /etc/profile.d/jboss

#vi /etc/profile.d/jboss ( Add the following entries)

#***** Set Env Variables for Jboss

JBOSS_HOME=/usr/local/jboss-5.1.0.GA
export JBOSS_HOME
export PATH=$JBOSS_HOME/bin:$PATH
export LAUNCH_JBOSS_IN_BACKGROUND=1

Step5: Logout from shell to get the above path settings updated

Note: [Instead of creating /etc/profile.d/jboss we can always update the variables in /etc/profile]

Step6: Configure Jboss to script start automatically on restart
Starting from JBoss 4.0.1 and above a sample start-up script ( eq: jboss_init_redhat.sh for redhat) is supplied with the package , we just need to modify it
Copy the script to /etc/init.d and name it as jboss
#cp /usr/local/jboss-5.1.0.GA/bin/jboss_init_redhat.sh /etc/init.d/jboss
#chmod +x /etc/init.d/jboss
Step7: create links

The links will be used to identify at which run levels JBoss should be started and stopped.
#ln -s /etc/rc.d/init.d/jboss /etc/rc3.d/S84jboss
#ln -s /etc/rc.d/init.d/jboss /etc/rc5.d/S84jboss
#ln -s /etc/rc.d/init.d/jboss /etc/rc4.d/S84jboss

#ln -s /etc/rc.d/init.d/jboss /etc/rc6.d/K15jboss
#ln -s /etc/rc.d/init.d/jboss /etc/rc0.d/K15jboss
#ln -s /etc/rc.d/init.d/jboss /etc/rc1.d/K15jboss
#ln -s /etc/rc.d/init.d/jboss /etc/rc2.d/K15jboss
Linux will execute the equivalent of "service jboss start" for the "S" links and "service jboss stop" for the K links.
Red Hat has a chkconfig command to manage these links, which may or may not work (it uses comments in the top of the script to determine which run-levels it should be started/stopped in)
Step8: Modify the script to work with chkconfig command in Redhat

Add the following entries just after #!/bin/sh in the script

#
# JBoss Control Script
#
# chkconfig: 345 80 20
# description: JBoss Startup File
#
#
# To use this script run it as root - it will switch to the specified user
#
Step9: Modify the script with JJboss,JavaPath, User and Host details

Find out the following entries and change according to you installation directories and path

#define where jboss is - this is the directory containing directories log, bin, conf etc
JBOSS_HOME=${JBOSS_HOME:-"/usr/local/jboss-5.1.0.GA"}

#define the user under which jboss will run, or use 'RUNASIS' to run as the current user
JBOSS_USER=${JBOSS_USER:-"jboss"}

#make sure java is in your path
JAVAPTH=${JAVAPTH:-"/usr/java/jdk1.6.0_14/bin"}
#bind jboss services to a specific IP address - added by rasith

JBOSS_HOST=${JBOSS_HOST:-"yourserver.yourdomain.com"} Note:[Either give FQDN of your server or IP Address]

Step10: set chkconfig to start jboss in different runlevel

#chkconfig --level 345 jboss on
Step11: Start Jboss and Verify whether it is running properly

#/sbin/service jboss start
You should be able to see jboss up and running at http:://yourserver.yourdomain.com:8080
Use /sbin/service jboss start|stop|restart to start , stop and to restart jboss
Stept12: Restart your server and verify jboss is running automatically after the restart







Installing Jboss On Linux

This blog decribes how to install and setup jboss to start automatically on RedHat Linux
Step1: Install Java and set environment variables

Please follow this link for instructions
http://easylinuxstuffs.blogspot.com/2009/08/installing-java-on-linux.html

Step2: Create a user called jboss

It always advisable to create a user "jboss" that can be used to start/stop jboss and can be assign permissions
#useradd jboss

Step3: Download appropriate package from Jboss and Install it
#tar -xvxf jboss-5.1.0.GA-jdk6.zip
#mv jboss-5.1.0.GA /usr/local/
#chown -R root:jboss /usr/local/jboss-5.1.0.GA
Step4: Set Environment variables for JBOSS

Create a file /etc/profile.d/jboss
# touch /etc/profile.d/jboss
# chmod +x /etc/profile.d/jboss

#vi /etc/profile.d/jboss ( Add the following entries)

#***** Set Env Variables for Jboss

JBOSS_HOME=/usr/local/jboss-5.1.0.GA
export JBOSS_HOME
export PATH=$JBOSS_HOME/bin:$PATH
export LAUNCH_JBOSS_IN_BACKGROUND=1

Step5: Logout from shell to get the above path settings updated

Note: [Instead of creating /etc/profile.d/jboss we can always update the variables in /etc/profile]

Step6: Configure Jboss to script start automatically on restart
Starting from JBoss 4.0.1 and above a sample start-up script ( eq: jboss_init_redhat.sh for redhat) is supplied with the package , we just need to modify it
Copy the script to /etc/init.d and name it as jboss
#cp /usr/local/jboss-5.1.0.GA/bin/jboss_init_redhat.sh /etc/init.d/jboss
#chmod +x /etc/init.d/jboss
Step6: create links

The links will be used to identify at which run levels JBoss should be started and stopped.
#ln -s /etc/rc.d/init.d/jboss /etc/rc3.d/S84jboss
#ln -s /etc/rc.d/init.d/jboss /etc/rc5.d/S84jboss
#ln -s /etc/rc.d/init.d/jboss /etc/rc4.d/S84jboss

#ln -s /etc/rc.d/init.d/jboss /etc/rc6.d/K15jboss
#ln -s /etc/rc.d/init.d/jboss /etc/rc0.d/K15jboss
#ln -s /etc/rc.d/init.d/jboss /etc/rc1.d/K15jboss
#ln -s /etc/rc.d/init.d/jboss /etc/rc2.d/K15jboss
Linux will execute the equivalent of "service jboss start" for the "S" links and "service jboss stop" for the K links.
Red Hat has a chkconfig command to manage these links, which may or may not work (it uses comments in the top of the script to determine which run-levels it should be started/stopped in)
Step7: Modify the script to work with chkconfig command in Redhat

Add the following entries just after #!/bin/sh in the script

#
# JBoss Control Script
#
# chkconfig: 345 80 20
# description: JBoss Startup File
#
#
# To use this script run it as root - it will switch to the specified user
#
Step8: Modify the script with JJboss,JavaPath, User and Host details

Find out the following entries and change according to you installation directories and path

#define where jboss is - this is the directory containing directories log, bin, conf etc
JBOSS_HOME=${JBOSS_HOME:-"/usr/local/jboss-5.1.0.GA"}

#define the user under which jboss will run, or use 'RUNASIS' to run as the current user
JBOSS_USER=${JBOSS_USER:-"jboss"}

#make sure java is in your path
JAVAPTH=${JAVAPTH:-"/usr/java/jdk1.6.0_14/bin"}
#bind jboss services to a specific IP address - added by rasith

JBOSS_HOST=${JBOSS_HOST:-"yourserver.yourdomain.com"} Note:[Either give FQDN of your server or IP Address]

Step8: set chkconfig to start jboss in different runlevel

#chkconfig --level 345 jboss on
Step9: Start Jboss and Verify whether it is running properly

#/sbin/service jboss start
You should be able to see jboss up and running at http:://yourserver.yourdomain.com:8080
Use /sbin/service jboss start|stop|restart to start , stop and to restart jboss
Stept10: Restart your server and verify jboss is running automatically after the restart







Installing Java on Linux

This Post describes how to install and set pathvariable for java in linux

Step1: Get rpm packages for Java

Download appropriate package from http://java.sun.com/javase/downloads/index.jsp

Step2: Install Java

Make the downloaded bin file executable

#chmod +x jdk-6u14-linux-x64-rpm.bin
#./jdk-6u14-linux-x64-rpm.bin

By default java will get installed on /usr/java/ , in this case /usr/java/jdk1.6.0_14


Step3: Set Java_Home and add it to Path Variable

Create a file /etc/profile.d/java

# touch /etc/profile.d/java
# chmod +x /etc/profile.d/java

#vi /etc/profile.d/java

#***** Set Env Variables for Java
JAVA_HOME=/usr/java/jdk1.6.0_14
export JAVA_HOME
export PATH=$JAVA_HOME/bin:$PATH

Logout from shell to get this updated


Note: [ Instead of creating /etc/profile.d/java we can always update the variables in /etc/profile ]

Step4: Test the installation

# java -version
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) 64-Bit Server VM (build 14.0-b16, mixed mode)

Saturday, August 1, 2009

Installing Apache2 on Linux



Step1: Get tar.gz packages for apache

Download appropriate package
#wget http://apache.mirror.facebook.net/httpd/httpd-2.2.11.tar.gz

Step2: Configure and Install Apache

#tar -xvxf httpd-2.2.11.tar.gz
# mv httpd-2.2.11 /usr/local/
#cd /usr/local/httpd-2.2.11
#./configure
#make
#make install

By default apache will install on /usr/local/apache2


Step3: Configure Apche to start automatically on reboot

# cp /usr/local/apache2/bin/apachectl /etc/init.d/httpd

Add the fllowing lines to /etc/init.d/httpd

#
# Startup script for the Apache Web Server
#
# chkconfig: - 85 15
# description: Apache is a World Wide Web server. It is used to serve
# HTML files and CGI.
# processname: httpd
# pidfile: /usr/local/apache/logs/httpd.pid
# config: /usr/local/apache/conf/httpd.conf
#
Then execute the below commands

# chmod 755 /etc/init.d/httpd
# chkconfig --add httpd
# chkconfig --level 35 httpd on


Note [ If you need a more detailed feedback we can use the below scrip as startup script]


#!/bin/bash
# httpd Startup script for the Apache HTTP Server
# chkconfig: 345 85 15
# description: Apache is a World Wide Web server. It is used to serve
# HTML files and CGI.
# processname: httpd
# config: /usr/local/apache2/conf/httpd.conf
# pidfile: /var/run/apache2.pid

# Source function library.
. /etc/rc.d/init.d/functions

# Start httpd in the C locale by default.
HTTPD_LANG=${HTTPD_LANG-"C"}

# This will prevent initlog from swallowing up a pass-phrase prompt if
# mod_ssl needs a pass-phrase from the user.
INITLOG_ARGS=""

# Path to the apachectl script, server binary, and short-form for messages.
apachectl=/usr/local/apache2/bin/apachectl
httpd=${HTTPD-/usr/local/apache2/bin/httpd}
prog=httpd
pidfile=${PIDFILE-/var/run/apache2.pid}
lockfile=${LOCKFILE-/var/lock/subsys/apache2}
RETVAL=0

start() {
echo -n $"Starting $prog: "
LANG=$HTTPD_LANG daemon $httpd $OPTIONS
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch ${lockfile}
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $httpd
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
}
reload() {
echo -n $"Reloading $prog: "
if ! LANG=$HTTPD_LANG $httpd $OPTIONS -t >&/dev/null; then
RETVAL=$?
echo $"not reloading due to configuration syntax error"
failure $"not reloading $httpd due to configuration syntax error"
else
killproc $httpd -HUP
RETVAL=$?
fi
echo
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $httpd
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f ${pidfile} ] ; then
stop
start
fi
;;
reload)
reload
;;
graceful|help|configtest|fullstatus)
$apachectl $@
RETVAL=$?
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status|fullstatus|graceful|help|configtest}"
exit 1
esac

exit $RETVAL





Step4: Add path variabled if required

Create a file /etc/profile.d/apache2

# touch /etc/profile.d/apache2
# chmod +x /etc/profile.d/apache2
#vi /etc/profile.d/apache2

#***** Set Env Variables for Apche

APACHE_HOME=/usr/local/apache2
export APACHE_HOME
export PATH=$APACHE_HOME/bin:$PATH



Logout from shell to get this updated


End Of the Document
*******************************************
Courtesy: http://olex.openlogic.com

Wednesday, July 29, 2009

Configure VNC Server for Remote Desktop

Step1: Get packages for VNC

The server package is called 'vnc-server'. If the server is not installed, install it
#yum install vnc-server
The client program is 'vnc'. If is not installed, install it.
#yum install vnc

Step2: Create a user who can use VNC

#useradd zooz
Step3: Set password for VNC user
Logon as each user and create password for each user. This will create .vnc directory
# vncpasswd

Step4: Create xstartup scripts

We will create the xstartup scripts by running vncserver as root
# vncserver
This will start first vnc server instance ( We can run multiple vnc instances #vncserver :2 #vncserver :3 etc)
# vi .vnc/xstartup
# Uncomment the following two lines for normal desktop:
unset SESSION_MANAGER
exec /etc/X11/xinit/xinitrc

Step5:Modify etc/sysconfig/vncservers

#vi /etc/sysconfig/vncservers
Add the vnc server entries
VNCSERVERS="1:root 2:zooz"
VNCSERVERARGS[1]="-geometry 1280x1024"
VNCSERVERARGS[2]="-geometry 1280x1024"

Step6: Configure VNC Server to start automatically on restart

#chkconfig vncserver on 345
# service vncserver restart


Cool , Its ready!!! We can now connect to the server; just install vnc client and access with any of the vnc server instances
Servername:1
Servername:2