web analytics

Monthly Archives July 2013

Multpile sphinx instances in a single server using wordpress sphinx plugin

Not satisfied with the server sphinx instance? Need sphinx on your own? Try this.

Install wordpress and get the sphinx plugin from http://wordpress.org/plugins/wordpress-sphinx-plugin/

Go to your wordpress admin panel -> Plugins -> Add new -> Upload
Upload the zip file of the plugin you just downloaded
Click Install

Once the plugin is activated, you need to install and start searchd through wordpress.

Go to Wp Admin Panel -> Settings -> Sphinx Search -> Start Wizard
Enter the following details:
Host name or IP address – localhost
Port – 9312 will be enabled by default. Please note, if you already have a serverwide sphinx running, this will conflict. If so, change port to anything else. I used 9315.
Index name – leave as default
Install or use existing binaries – Since you need ...

Read More

Script to delete all messages from mailman archives

One of our customer wanted to delete all messages from mailman archives. He had around 101 mailing lists and hence manually deleting them was not possible. I wrote a small script to delete the contents and attachments  – and Bingo – all cleared !! :- )

Check out the script here

First I took the list details into a file called ss

cd   /usr/local/cpanel/3rdparty/mailman/archives/private

ls | grep abc.org | grep -v mbox > ss

For a given mailing list, the path “/usr/local/cpanel/3rdparty/mailman/archives/private” contains two folders namely listname_abc.org and listname_abc.org.mbox . listname_abc.org contains a folder called ‘attachments’ which contains the attachments and files of following three types.

2013-April 2013-April.txt 2013-April.txt.gz

Our intent is to delete all such files a...

Read More

temporarily rejected connection in “connect” ACL: “Host is ratelimited due to multiple failure only connections”

Sometimes you won’t be able to send/receive emails. Telnet may mention a temporary problem as follows.

telnet abc.com 25
Trying 123.456.789.12…
Connected to abc.com.
Escape character is ‘^]’.
451 Temporary local problem – please try later
Connection closed by foreign host.

Upon checking the error log, I noticed the following error displayed.

2013-07-24 03:11:48 SMTP connection from []:58121 (TCP/IP connection count = 1)
2013-07-24 03:11:48 no IP address found for host abts-tn-dynamic- (during SMTP connection from []:58121)
2013-07-24 03:11:48 H=[]:58121 temporarily rejected connection in “connect” ACL: “Host is ratelimited due to multiple failure only connections (7.9/1h max:5)”

To overcome this error, I did t...

Read More

Software raid monitoring script

You wake up one day and realize that your site is dead. You try to reboot your server, nothing happens, your hard disk is gone 🙁 🙁

You wish if there was an alert to notify of the disk problem. See a sample script below with software raid which will alert you when disk fails.




#Suppose there are two raid arrays md1 and md3

CONTENT=`/sbin/mdadm –detail /dev/md3 ; /sbin/mdadm –detail /dev/md1`

COMPARE_md3=`/sbin/mdadm –detail /dev/md3 | grep “State :” | awk -F’:’ ‘{ print $2 }’`
COMPARE_md1=`/sbin/mdadm –detail /dev/md1 | grep “State :” | awk -F’:’ ‘{ print $2 }’`

if [[ ( $COMPARE_md3 = ” clean ” || $COMPARE_md3 = ” active ” || $COMPARE_md3 = “clean, checking” || $COMPARE_md3 = “active, checking” &&  $COMPARE_md1 = ” clean ” ||  $COMPARE_md1 =...

Read More

Install sphinx using yum CentOS/RedHat

Ouff, sphinx!!!! I used to sigh when someone talks to me about sphinx. But now I find it easy. Try it yourself.

yum install sphinxsearch  should do the trick normally.

If the above didn’t work, download the sphinx rpm from http://sphinxsearch.com/downloads/release/

My machine is centos5/32bit so I downloaded http://sphinxsearch.com/downloads/accept.php?file=sphinx-2.0.8-1.rhel5.i386.rpm

cd /usr/local/src

wget http://sphinxsearch.com/downloads/accept.php?file=sphinx-2.0.8-1.rhel5.i386.rpm

Now you can use yum to install this.

yum localinstall –nogpgcheck sphinx-2.0.8-1.rhel5.i386.rpm

Once it is installed, the sphinx config is available at /etc/sphinx.conf

You can start/stop sphinx using /etc/rc.d/init.d/sphinx start/stop

Indexer can be run as

/usr/bin/indexer –all

Read More

Install sphinx search engine Centos/RHEL from source

Installing sphinx from the source file is mentioned here. Installation with yum is available here

Download the sphinx source from http://sphinxsearch.com/downloads/release/

cd /usr/loca/src
wget http://sphinxsearch.com/downloads/accept.php?file=sphinx-2.0.8-release.tar.gz

If you are unable to get it through direct wget, you can download it to your local machine and ftp/scp to the server.

Now untar the file.

tar -xzvf sphinx-2.0.8-release.tar.gz

rm -fv sphinx-2.0.8-release.tar.gz

cd sphinx-2.0.8-release

./configure –prefix=/usr/local/sphinx

make install

This will install sphinx search engine. You can find if it is the correct version as follows.

# /usr/local/sphinx/bin/searchd -V
Sphinx 2.0.8-release (r3831)

You installed it at /usr/local/sphinx and the binaries are present at /usr/loca...

Read More

PHP cannot access MongoDB, you need to install the Mongo extension for PHP.

When you access the phpMoAdmin to manage your mongo databases, sometimes you may get the following error.

PHP cannot access MongoDB, you need to install the Mongo extension for PHP.”

This is because mongo is installed, but the mongo extension for php is not installed. You can install it using pecl.

pecl install mongo

Once it finishes, add the mongo.so file to your php.ini and restart apache.

You can find your php.ini as follows.

php -i | grep ini and check for the following line

“Loaded Configuration File => /usr/local/lib/php.ini”

Now open that file and make the changes

vi /usr/local/lib/php.ini

Add the following down to any already present extensions


/etc/rc.d/init.d/httpd restart

Now clear the browser cache and try accessing the phpMoAdmin once again, it shou...

Read More

Install mongodb – Centos/RHEL/Fedora

Install mongodb in CentOS

Depending on the architecture, add the mongo repo to your system.

1)First find if your machine is 32 bit or 64 bit as follows.

uname -m

i686 – it is 32 bit
x86_64 – it is 64 bit.

2) Create the mongo repo as follows.

# vi /etc/yum.repos.d/10gen.repo

If it is 32bit machine, add the following to the file.

name=10gen Repository

If it is a 64bit machine, use the following.

name=10gen Repository

3) Now you can use yum to install mongo.

yum install mongo-10gen mongo-10gen-server

Mongo is now installed and you can start and stop mongo as follows.


Read More

APE over SSL using stunnel in cpanel server

Refer To APE installation in cpanel server here

1) In order for APE to work with stunnel, make sure that the stunnel version in the server should be less than 4.3. Centos and RHEL 5 will most probably have stunnel installed already. If not, install stunnel.

2) Now we need to create a conf for ape.
vi /etc/stunnel/ape.conf and add the following to it.

cert = /etc/stunnel/stunnel.pem
debug = 7
output = /etc/stunnel/stunnel.log
;disable delay DNS lookup for ‘connect’ option
delay = no
;no time to wait for close_notify!
TIMEOUTclose = 0
accept =
connect =

Create a file for stunnel log.

# touch /etc/stunnel/stunnel.log

3) Now generate a CSR and key for *.ape.divya.com

# cd /etc/stunnel
# openssl req -nodes -newkey rsa:2048 -out csr.pem -keyout stunnel.pem

The ...

Read More

APE on port 80 – Installation and Setup in cpanel server

Version Installed – 1.1.1 and 1.1.2-dev are installed. Can switch as needed.
Config file – /usr/local/src/APE/bin/ape.conf

1) cd /usr/local/src

2) wget http://www.ape-project.org/stable/APE_Server-1.1.1.amd64.bin.tar.gz

3) tar -xzvf APE_Server-1.1.1.amd64.bin.tar.gz

4) cd APE_Server/bin

5) ./aped (notice it is a dot followed by a slash)

6) This will start APE. You may issue a Ctl+C and edit the file ape.conf in the same location as follows.

port = 80
daemon = yes
ip_listen = (put your IP address here)
domain = abc.com (put your domain name here)

7) Now we need to assign a dedicated IP address for ape.abc.com from WHM -> Edit DNS -> abc.com

8) DNS Functions -> Edit DNS zone -> abc.com and add the following entry

ape     14400     IN      A

Read More