web analytics

Category Installations

Install solr with jetty in Ubuntu

Solr is a search platform which is built on Apache Lucene. It makes search easier and faster. Solr can be installed along with tomcat or jetty. This post explains the installation based on jetty.

First you should install java and jetty as mentioned in the link here.

We will install solr also in /opt. First download the latest version of solr from https://archive.apache.org/dist/lucene/solr/

I am going to download version 4.10.4. Once downloaded, uncompress it and copy the war file from dist directory to jetty webapps folder.

[root@test ~]#cd /opt

[root@test ~]# wget https://archive.apache.org/dist/lucene/solr/4.10.4/solr-4.10.4.tgz

[root@test ~]# tar -xzvf solr-4.10.4.tgz

[root@test ~]#cp  solr-4.10.4/dist/solr-4.10.4.war   /opt/jetty/webapps/solr.war

Now, a few more files need to be ...

Read More

Installing Jetty in Ubuntu 14.04

Jetty is a java web server like tomcat, and java servlet container. This post describes how to install the latest version of Jetty in Ubuntu.

Latest version of Jetty can be downloaded from http://download.eclipse.org/jetty/stable-9/dist/

Jetty requires java and hence the first step is to install java. The latest version of Jetty, as of this writing is Jetty 9.3.8. Check the link here which shows what version of Java is required for the version of Jetty you are installing. If the version of Java does not match the version in which Jetty is compiled, then it will result in version conflict and Jetty will fail to start.

I am going to install Jetty 9.3.8, hence I need JVM 1.8. Login to your ubuntu machine and switch to root. Then issue the following commands to install java in the server.

[ro...

Read More

Hetzner server with > 2TB disk

Recently I ordered a Hetzner server for one of our clients. The server had two 3TB disks. Hetzner provides a command line installation of the desired OS once we login to their server. As such, I logged in to the server and installed Centos6 by executing “installimage” option as suggested by Hetzner.

After installing OS and rebooting the server, I noticed that the 3T disk is not showing full space.

[root@abc ~]#df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda3        99G  2.5G   91G   3% /
tmpfs           463M     0  463M   0% /dev/shm
/dev/sda2       976M  126M  800M  14% /boot

/dev/sda4   2.3T     123M   2.2T  1% /home

If the disk size is greater than 2T you cannot use normal fdisk to create partition...

Read More

ERROR: Error creating index db.collection-101613_nno.csv: 16633 err: “text search not enabled”

I was trying to restore a database onto a new server, when I got the following error.

mongorestore -d db /backup/db

ERROR: Error creating index db.collection-101613_nno.csv: 16633 err: “text search not enabled”

In order to correct this, you need to enabled text search. Simply stop the mongo process and start it with text search enabled.

root@abc# /etc/rc.d/init.d/mongod stop

root@abc# /usr/bin/mongod -f /etc/mongod.conf –setParameter textSearchEnabled=true

Now try restoring again and it works.

Read More

Adding domains under nginx

You can install nginx webserver as mentioned in this link

Now to add domains to it, we create two folders for the virtualhosts.

1) sites-available for all virtualhosts

2) sites-enabled for those virtualhosts that are active

We are going to create the domain greproot.com with username as greproot

The document root will be under /var/www/greproot/public_html. So create a user with home directory set to /var/www/greproot

[root@abc ~]# useradd -d /var/www/greproot  greproot

[root@abc ~]# passwd greproot                      # give a strong password for the user

[root@abc ~]# mkdir /var/www/greproot/public_html

[root@abc ~]# mkdir /var/www/greproot/logs

[root@abc ~]# touch /var/www/greproot/logs/access.log

[root@abc ~]# touch /var/www/greproot/logs/error.log

[root@abc ~]# chown -R...

Read More

Install nginx webserver in Centos6 server

You can install nginx webserver in Centos6 server with yum. It is simple and easy. Follow the steps given below.

First we need to install the nginx repo

[root@abc ~]# cd /etc/yum.repos.d/

[root@abc yum.repos.d]# wget http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm

[root@abc yum.repos.d]# rpm -ivh nginx-release-centos-6-0.el6.ngx.noarch.rpm

Make sure that the repo nginx.repo is listed at /etc/yum.repos.d. Once it is done, you can install nginx using yum

[root@abc yum.repos.d]# yum install nginx

The nginx configuration file is available at /etc/nginx/nginx.conf. You need to update the worker process in it. The worker process can be equal to the number of CPUs in the server.

[root@abc ~]# cat /proc/cpuinfo  | grep processor | wc -l

8

The above ...

Read More

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
Activate

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 [122.174.199.157]:58121 (TCP/IP connection count = 1)
2013-07-24 03:11:48 no IP address found for host abts-tn-dynamic-157.199.174.122.airtelbroadband.in (during SMTP connection from [122.174.199.157]:58121)
2013-07-24 03:11:48 H=[122.174.199.157]: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.

#!/bin/sh

TO=”abc@123.com”

CC=”def@123.com”

#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