Subscription..

How do I install chmviewer on Centos

# yum install python-chm if it is not work download the following rpm from rpmforge respository
# wget ttp://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
# rpm -ivh rpmforge-release-0.5.1-1.el5.rf.i386.rpm
# yum clean all , Again
# yum install python-chm
Now we need to install gnochmviewer
#wget http://dag.wieers.com/rpm/packages/gnochm/gnochm-0.9.11-1.el5.rf.noarch.rpm
# rpm -ivh gnochm-0.9.11-1.el5.rf.noarch.rpm

My installation files for this package are,

[root@rc-090 chmviewer]# ls -la
-rwxr-xr-x 1 root root 45884 Mar 10 13:26 chmlib-0.40-1.el5.rf.i386.rpm
-rwxr-xr-x 1 root root 173836 Mar 10 13:26 gnochm-0.9.11-1.el5.rf.noarch.rpm
-rw-r–r– 1 root root 239 Mar 10 13:26 install.sh
-rwxr-xr-x 1 root root 66405 Mar 10 13:26 python-chm-0.8.4-1.el5.rf.i386.rpm

Enabling Zend optimizer on php

How do I install zend optimiser enabled on php ?

Download Zend optimizer from Zend website

#tar -zxvf ZendOptimizer-3.3.9-linux-glibc23-i386.tar.gz
# cd ZendOptimizer-3.3.9-linux-glibc23-i386
# cd data/5_2_x_comp/
# cp ZendOptimizer.so /usr/lib/extensions/no-debug-non-zts-20060613/
Where I set extension_dir varible set to “/usr/lib/extensions/no-debug-non-zts-20060613/” on php.ini

Adding entry on php.ini
#cat "zend_extension=/usr/lib/extensions/no-debug-non-zts-20060613/ZendOptimizer.so" >> /etc/php.ini

Restart Apache and verify the installation

[root@rc-033 5_2_x_comp]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]
[root@rc-033 5_2_x_comp]# php -r ‘phpinfo();’| grep “zend”
report_zend_debug => Off => Off
zend.ze1_compatibility_mode => Off => Off
PWD => /home/installation/zendoptimiser/ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp
OLDPWD => /home/installation/zendoptimiser/ZendOptimizer-3.3.9-linux-glibc23-i386
_SERVER["PWD"] => /home/installation/zendoptimiser/ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp
_SERVER["OLDPWD"] => /home/installation/zendoptimiser/ZendOptimizer-3.3.9-linux-glibc23-i386
_ENV["PWD"] => /home/installation/zendoptimiser/ZendOptimizer-3.3.9-linux-glibc23-i386/data/5_2_x_comp
_ENV["OLDPWD"] => /home/installation/zendoptimiser/ZendOptimizer-3.3.9-linux-glibc23-i386
[root@rc-033 5_2_x_comp]#

Fatal error: Allowed memory size of 134217728 bytes exhausted

I got this error when I try to exeucute a scheduled job.

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 16 bytes) in /home/login/www/libraries/joomla/database/database/mysql.php on line 462

The solution is,

Increase the memory_limit on php.ini. Since I am using a shared hosting I can’t change the settings globally. So O switched to the webroot and create .htaccess file then add the line


-bash-3.2# vi .htaccess
php_value memory_limit 400M
php_value max_execution_time 18000

Problem Solved !!

EnterepriseDB : – Administrative commands

I’d worked with one client who is using enterprisedb ( Redwood version).This database claims the stable performance and index searching same like Oracle does. It’s installation is more difficult since it’s using a GUI installer which requires separate “tmp” partition to start the GUI launcher. very sad thing – :(

Here are the few examples I uses to administrate it.

For Linux Server.

How start and stop Enterprisedb server

Change to EDB binary directory
cd /opt/EnterpriseDB/8.1.3.12/dbserver/bin
a. For Stopping
#pg_ctl -D /opt/EnterpriseDB/8.1.3.12/data stop

b. For Starting
pg_ctl -D start
Eg: #pg_ctl -D /opt/EnterpriseDB/8.1.3.12/data start
c. Restarting
pg_ctl -D restart/reload

Eg: #pg_ctl -D /opt/EnterpriseDB/8.1.3.12/data restart/reload
Note : U may use reload command in order of loading the chagedset without having DB shout down.

1. To dump all databases:
$ pg_dumpall > db.out -Uenterprisedb

2. To restore the database,
edb-psql -d -f -U enterprisedb
C:\>edb-psql -d symbiosis -f temp.sql -Uenterprisedb
Password for user enterprisedb:

3. Creating a database
C:\>createdb test -Uenterprisedb
Password:
CREATE DATABASE

4. Dumping a single database
C:\>pg_dump -d test -f dump.sql -Uenterprisedb
Password:
C:\>

How to check the Runlevel currently using on Linux

[root@rc-040 installation]# who -r
run-level 5 2010-02-19 22:12 last=3

How do I syncronize the FTP files/ incremental FTP backup

I want to backup all the files on the live server to keep on my backup server. How I can do this ?

I prefer lftp to do this. Using lftp we can either synchronize the local files to a remote location or wise versa.

1. How do I syncronise the a folder on a FTP location to my local Linux server.

Suppose these are my remote ftp details:
FTP : 208.74.34.93
User: user
Password : pass
Ftp backup folder: securedata

[root@web-test1 ~]# yum install lftp*

Then

#lftp -u user,pass -e "mirror --delete --only-newer --verbose /securedata /Backup/local/webfiles" 208.74.34.93</code>

I simply create script file and add this to a daily cron job,

[root@rc-040 scripts]# crontab -l
10 12 * * * /bin/sh /home/installation/scripts/marketbkp.sh

Second one is, copying the local files and upload to a remote ftp location. Just append the word "--reverse" to the existing command line path.

#lftp -u user,pass -e "mirror --reverse --delete --only-newer --verbose /securedata /Backup/local/webfiles" 208.74.34.93

Which would upload/synchronize all the files from the locally and upload to the remote location. This would be very helpful in case of disaster management. I do create a script for this.

How Do I enable ffmpeg extension on php

I’m using PHP 5.2.9 on Centos5.3 server where php is installed from the source compilation.

First I added the diag repository on my yum path,


#rpm -Uhv http://apt.sw.be/redhat/el5/en/i386/rpmforge/RPMS/rpmforge-release-0.3.6-1.el5.rf.i386.rpm
#yum clean all
#yum update
#yum install ffmpeg ffmpeg-devel
#yum install mplayer mencoder

How to test ffmpeg is installed

[root@rc-149 ffmpeg-php-0.6.0]# ffmpeg
FFmpeg version 0.5, Copyright (c) 2000-2009 Fabrice Bellard, et al.
configuration: –prefix=/usr –libdir=/usr/lib –shlibdir=/usr/lib –mandir=/usr/share/man –incdir=/usr/include –enable-libamr-nb –enable-libamr-wb –enable-libdirac –enable-libfaac –enable-libfaad –enable-libmp3lame –enable-libtheora –enable-libx264 –enable-gpl –enable-nonfree –enable-postproc –enable-pthreads –enable-shared –enable-swscale –enable-x11grab
libavutil 49.15. 0 / 49.15. 0
libavcodec 52.20. 0 / 52.20. 0
libavformat 52.31. 0 / 52.31. 0
libavdevice 52. 1. 0 / 52. 1. 0
libswscale 0. 7. 1 / 0. 7. 1
libpostproc 51. 2. 0 / 51. 2. 0
built on Nov 6 2009 19:05:03, gcc: 4.1.2 20080704 (Red Hat 4.1.2-46)
At least one output file must be specified
[root@rc-149 ffmpeg-php-0.6.0]#

Then install flvtool2

#yum install flvtool2*

Then I download the latest from php-ffmpeg package from sourceforge.

#wget http://downloads.sourceforge.net/project/ffmpeg-php/ffmpeg-php/0.6.0/ffmpeg-php-0.6.0.tbz2?use_mirror=nchc
tar -xjf ffmpeg-0.5.2.1.tbz2
#phpize
#./configure
#make
#make install

Now I’m going to edit the php.ini (/etc/php.ini) and add/modify the following lines on it,
extension_dir = “/usr/lib/extensions/no-debug-non-zts-20060613/”
extension=ffmpeg.so

[root@rc-149 ~]# php -r ‘phpinfo();’| grep “ffmpeg”
ffmpeg
ffmpeg-php version => 0.6.0-svn
ffmpeg-php built on => Feb 15 2010 19:11:38
ffmpeg-php gd support => enabled
ffmpeg libavcodec version => Lavc52.20.0
ffmpeg libavformat version => Lavf52.31.0
ffmpeg swscaler version => SwS0.7.1
ffmpeg.allow_persistent => 0 => 0
ffmpeg.show_warnings => 0 => 0

Mantis Default password, Remove the old backup files

Even though mantis installation is very easy, But I fed up with the option for getting initial administrator password for the login.

Mantis default password for ‘Administrator’ is “root”

How to remove the old back up files,

I found following command is very useful for removing old backup file which causing Disk free space alert mails. I used to create the backup file named based on the created dated like , backupname-day-month-year Eg. securesvn-12-02-2010.zip

# Re: # rm -rf svn-backup-*-12* which will be deleted the all backup file created on December. I uses a script to do this job which will help to save a great sys-admin’s time.

How do I upgrade the ghostscripts version on my Redhat server ?

our requirement is, I have a pdf file which is created using doc conversion ( have a look at my previous post). While I converting it to jpg it’s showing the errors as follows,

xecution stack:
%interp_exit .runexec2 --nostringval-- --nostringval-- --nostringval-- 2 %stopped_push --nostringval-- --nostringval-- --nostringval-- false 1 %stopped_push
Dictionary stack:
--dict:1147/1684(ro)(G)-- --dict:0/20(G)-- --dict:71/200(L)--
Current allocation mode is local
Last OS error: 2
GPL Ghostscript 8.63: Unrecoverable error, exit code 1

After googling, I found upgrading of ghostscripts will solve my problem. And I had success on upgrading ghostscripts on local desktop but not on server :-(

I found the same technique will not work for me since imagemagic is bind with ghoscripts. Suppose whenever I try to install imagemagic it will either install ghostscripts along with it or terminate with the error with lasted ghostscripts package conficts that were installed manually before.
My solution is,
1. First remove the Imagemagic and ghostscripts from the server.
2. Then I did jasper installation and then installed the ghostscript latest rpm.
3. After I installed Imagemagick separately from the Centos latest package repository.

rpm -Uvh http://chrisschuld.com/centos52/jasper-libs-1.900.1-8.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/jasper-1.900.1-8.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/jasper-utils-1.900.1-8.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/jasper-devel-1.900.1-8.i386.rpm

rpm -Uvh http://chrisschuld.com/centos52/ghostscript-8.63-1.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/ghostscript-devel-8.63-1.i386.rpm
rpm -Uvh http://chrisschuld.com/centos52/ghostscript-gtk-8.63-1.i386.rpm

Then download the imagemagic rpm from here,
http://mirror.vpshosting.com.hk/pub/linux/centos/5.4/os/i386/CentOS/ You may found various youm repository list from Centos download urls. Just go through the parent url to reach rpm distribution.

After that I can convert .pdf to image easily.
# convert test.pdf test.jpg

How to convert word document/powerpoint file to pdf or jpg on LINUX

Here are the quick work around to convert.odc/.ppt to image or pdf file.

We need the following packages installed on the server,
a. openoffice
b. imagemagick
c. Java

Installing openoffice

#yum install openoffice.org*
#yum install ImageMagick*

How to verify imagemagick is installed and working

[root@rc-170 ~]# convert logo: logo.gif
[root@rc-170 ~]# convert –version
Version: ImageMagick 6.2.8 04/17/08 Q16 file:/usr/share/ImageMagick-6.2.8/doc/index.html
Copyright: Copyright (C) 1999-2006 ImageMagick Studio LLC

Downloading jodconverter from sourceforge

#wget http://downloads.sourceforge.net/project/jodconverter/JODConverter/2.2.2/jodconverter-2.2.2.zip?use_mirror=nchc
#unzip jodconverter-2.2.2.zip
#mv jodconverter-2.2.2 /usr/local/jodconverter/ ( optional)

Verify the java installed
[root@rc-170 ~]# java -version
java version "1.6.0_14"
Java(TM) SE Runtime Environment (build 1.6.0_14-b08)
Java HotSpot(TM) Server VM (build 14.0-b16, mixed mode)

Now we need to run openoffice as a service. So we can create a init script for this. A sample scripts can be download from here
#vi /etc/init.d/openofficed

#!/bin/bash
OOo_HOME=/usr/lib64/openoffice.org
SOFFICE_PATH=$OOo_HOME/program/soffice
PIDFILE=$OOo_HOME/openoffice-server.pid

case “$1″ in
start)
if [ -f $PIDFILE ]; then
echo “OpenOffice headless server has already started.”
exit
fi
echo “Starting OpenOffice headless server”
$SOFFICE_PATH -headless -accept=”socket,host=127.0.0.1,port=8100;urp;” -nofirststartwizard & > /dev/null 2>&1
touch $PIDFILE
;;
stop)
if [ -f $PIDFILE ]; then
echo “Stopping OpenOffice headless server.”
killall -9 soffice && killall -9 soffice.bin
rm -f $PIDFILE
exit
fi
echo “Openoffice headless server is not running, foo.”
exit
;;
*)
echo “Usage: $0 {start|stop}”
exit 1
esac
exit 0

In this script I found the open office installation for was different according to the OS architecture. Since my OS is 64 bit it will be “/usr/lib64/openoffice.org” else it is “/usr/lib/openoffice.org” on Linux box.

[root@s15351481 ~]# vi /etc/rc.local then add the line “/etc/init.d/opeofficd start”

# java -jar /usr/local/jodconverter/lib/jodconverter-cli-2.2.2.jar document.ppt mam.pdf
You may use to call it from php using the “exec” funcation.
exec(‘java -jar /usr/local/jodconverter/lib/jodconverter-cli-2.2.2.jar/lib/jodconverter-cli-2.2.2.jar document.doc mam.pdf’);

This program will support for the following conversions,
1. DOC —> PDF
2. DOC —> ODT
3. DOC —> RTF
4. XLS —> PDF
5. XLS –> ODS
6. XLS –> CSV
7. PPT –> PDF
8. PPT —> ODP
9. PPT —> SWF
10. ODT –> PDF
11. ODT —> DOC
12. ODT —> RTF
13. ODS —> PDF
14. ODS —> XLS
15. ODS —> CSV
16.ODP —> PDF
17. ODP —> PPT
18. ODP —> SWF

How do I solve this error ?

[root@rc-040 installation]# /usr/lib/openoffice.org/program/soffice “-accept=socket,host=localhost,port=8100;urp;StarOffice.ServiceManager” -nologo -headless -nofirststartwizard
/usr/lib/openoffice.org/program/soffice.bin X11 error: Can’t open display:
Set DISPLAY environment variable, use -display option
or check permissions of your X-Server
(See “man X” resp. “man xhost” for details)
[root@rc-040 installation]#

I started the vnc and server and execute the service script.
/etc/init.d/openofficed start