Monday, 15 June 2015

Install sshpass


'sshpass' command can be used to provide password runtime while logging into a server over ssh.

                                                Installation 

O/S - Centos 6.5

Download rpm -

wget http://pkgs.repoforge.org/sshpass/sshpass-1.05-1.el6.rf.x86_64.rpm

Install -

rpm -ivh sshpass-1.05-1.el6.rf.x86_64.rpm

Run -

sshpass -p 'XXXXX'  ssh username@server.test.com




Saturday, 6 June 2015

Linux sort by column number



Sample data : 

# cat flle.txt
1  field1  11
2  field2  40
3  field3  09
4  field4  22


Sort by column 3  ( lowest to highest ) - 

# cat file.txt | sort  -k3
3  field3  09
1  field1  11
4  field4  22
2  field2  40

Sort by column 3  ( highest to lowest ) - 

# cat file.txt | sort  -r -k3
2  field2  40
4  field4  22
1  field1  11
3  field3  09



Thanks



Sunday, 12 April 2015

Nodejs Installation Centos


O/s- Centos
Prerequisite - Python

Download and Extract the tar -

# cd /usr/local/src
# wget http://nodejs.org/dist/node-latest.tar.gz
# tar zxvf node-latest.tar.gz
# cd node-v0.10.17/

Configure -

 # python2.6 configure
 # make
 # make install

Test -
# /usr/local/bin/node --version


#####################


Splunk Installation on Linux


O/s - Centos 6

Splunk Server Setup  -

Package - splunk-4.3.2-123586-linux-2.6-x86_64.rpm

# rpm -ivh splunk-4.3.2-123586-linux-2.6-x86_64.rpm
# /opt/splunk/bin/splunk start
# netstat -tunlp | grep 8090


Splunk Client (Forwarder) Setup -

Package -  splunkforwarder-4.2.4-110225-linux-2.6-x86_64.rpm

# rpm -ivh splunkforwarder-4.2.4-110225-linux-2.6-x86_64.rpm
# /opt/splunkforwarder/bin/splunk start
# ps aux| grep splunk
# cd /opt/splunkforwarder/

 # /opt/splunkforwarder/bin/splunk enable boot-start

Adding Source  -

# /opt/splunkforwarder/bin/splunk add monitor  </path/logfile1>
# /opt/splunkforwarder/bin/splunk add monitor  </path/logfile2>


Contacting Splunk Server -

# /opt/splunkforwarder/bin/splunk add <serverip>:8090
# /opt/splunkforwarder/bin/splunk add forward-server <serverip>:8090


Thursday, 9 April 2015

Aeroproxy Installation Guide

                                                    Aeroproxy installation 


OS - centos 6.5

Packages required  -

yum install libevent-devel.x86_64 libevent.x86_64  cmake.x86_64 openssl-devel.x86_64 openssl.x86_64
yum groupinstall "Development Tools"

1. libevhtp

wget https://sourceforge.net/projects/levent/files/libevent/libevent-2.0/libevent-2.0.22-stable.tar.gz --no-check-certificate
tar -zxvf libevent-2.0.22-stable.tar.gz
./configure
make
make install
git clone https://github.com/ellzey/libevhtp.git
cd libevhtp/
cmake . -DEVHTP_DISABLE_SSL=ON
make
make install

2. Protobuf -c
wget http://ftpmirror.gnu.org/autoconf/autoconf-2.65.tar.gz
cd autoconf-2.65
./configure
make
make install

wget https://protobuf.googlecode.com/svn/rc/protobuf-2.6.0.tar.gz
cd protobuf-2.6.0
./configure
make
make install

git clone https://github.com/protobuf-c/protobuf-c.git
cd protobuf-c/
./autogen.sh
./configure
make
make install


3. C libevent Client Library - Linux SDK from Aerospike

tar -zxvf citrusleaf_client_libevent2_2.1.41.tgz
cd citrusleaf_client_libevent2_2.1.41
vi Makefile and change following

        $(MAKE) -C example
        $(MAKE) -C example2
        $(MAKE) -C example3
        $(MAKE) -C example4
        $(MAKE) -C example6
        $(MAKE) -C tests/loop_c_ev2

to

        #$(MAKE) -C example
        #$(MAKE) -C example2
        #$(MAKE) -C example3
        #$(MAKE) -C example4
        #$(MAKE) -C example6
        #$(MAKE) -C tests/loop_c_ev2

make
make install

cd lib
cp lib/libev2citrusleaf.a ../aeroproxy/libs/

cd aeroproxy

vim aeroproxy_common.h +20
and change following

include "aerospike/as_integer.h"
include "aerospike/as_string.h"
include "aerospike/as_arraylist.h"
include "aerospike/as_pair.h"
include "aerospike/as_hashmap.h"
include "aerospike/as_hashmap_iterator.h"
include "aerospike/as_stringmap.h"

to

//#include "aerospike/as_integer.h"
//#include "aerospike/as_string.h"
//#include "aerospike/as_arraylist.h"
//#include "aerospike/as_pair.h"
//#include "aerospike/as_hashmap.h"
//#include "aerospike/as_hashmap_iterator.h"
//#include "aerospike/as_stringmap.h"

vim aeroproxy.h +19

and change following

int as_write_data_map(evbase_t *evbase, const char *key, const char *bin_name, const as_map *map, void *udata);
 to
//int as_write_data_map(evbase_t *evbase, const char *key, const char *bin_name, const as_map *map, void *udata);

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib

make

make will generate aeroproxy bin file , copy that in aeroproxy folder of aerospike server.


##########

Tuesday, 7 October 2014

S3cmd Installation On Ubuntu

's3cmd' is a command utility to manage S3 through command lines. I've given the installation steps for ubuntu linux.

Installation 

1. Import S3tools signing key:

# wget -O- -q http://s3tools.org/repo/deb-all/stable/s3tools.key | sudo apt-key add -


2. Add the repo to sources.list:

# sudo wget -O/etc/apt/sources.list.d/s3tools.list http://s3tools.org/repo/deb-all/stable/s3tools.list

3. Refresh package cache and install the newest s3cmd:

# sudo apt-get update && sudo apt-get install s3cmd

# sudo s3cmd --configure

4. Then it'll ask for  Access Key ID and Secret Access Key which you can get from AWS Account Security Credentials.


Thanks

Voltdb Client

Building Voltdb PHP and CPP Client
1. Download Voltdb Client Php Extension-
2. Extract it to /opt
cd /opt
tar -xvzf voltdb-client-php-extension-2.8.4.tar.gz
[You'll get voltdb-client-cpp and voltdb-client-php under voltdb-client-php-extension-2.8.4
3. Install dependencies -
# yum install php-dev glibc-static zlib zlib-devel
# cd /opt/voltdb-client-php-extension-2.8.4/voltdb-client-cpp
# make
# cd /opt/voltdb-client-php-extension-2.8.4/voltdb-client-php
# phpize
[ If phpize command not found -
then install php-devel-<version> ]
4. Configure 
# ./configure --with-voltdb=/opt/voltdb-client-php-extension-2.8.4/voltdb-client-cpp/ CXXFLAGS="-m64" LDFLAGS="-m64"
# make
# vi /etc/php.ini
-and edit following line
extension=/opt/voltdb-client-php-extension-2.8.4/voltdb-client-php/modules/voltdb.so

# php -m | grep voltdb
Output - voltdb

If you have any queries or suggestions, please comment.

Thanks

Shell Script : Mail Attachment Linux uuencode

This example shows how to send an email with multiple attachments in linux using uuencode and mail command.

Files to be attached -

/opt/file1.txt
/opt/file2.txt
/opt/file3.txt
/opt/file4.txt

Code -

#/bin/bash

>/tmp/out.mail

echo "Your messae body" >> /tmp/out.mail

for i in `ls /opt/file*.txt`
do
uuencode  $i $i  >> /tmp/out.mail

done

mail -s "Subject" emailid@domain.com < /tmp/out.mail

#######

[ Note - If you've files having different names like abcd.txt outfile.txt sample.csv etc. then you can define the 'for' loop like - for i  in  abcd.txt outfile.txt sample.csv and while uuencode give the full path ]


If you have any queries or suggestions , please comment.



Thanks

Deep DB Mysql

                               Deep DB Mysql - A general purpose database for Big Data

Installation - 

My O/s - Centos 6, 64 bit


* Update Repository -

# wget "http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/epel-release-6-5.noarch.rpm"
# wget "http://dl.iuscommunity.org/pub/ius/stable/Redhat/6/x86_64/ius-release-1.0-11.ius.el6.noarch.rpm"

# rpm -Uvh epel-release-6-5.noarch.rpm
# rpm -Uvh ius-release-1.0-11.ius.el6.noarch.rpm

* Installing Mysql55

# yum install mysql55 mysql55-libs mysql55-server mysql55-devel

# /etc/init.d/mysqld start

* Set root password

# /usr/bin/mysqladmin -u root password 'password'

# /etc/init.d/mysqld stop

# chkconfig mysqld on --level 235

* Install Deepdb Plugin

# yum install yum-utils
# yum-config-manager --add-repo http://repo.cloudtree.net/repo

# yum install --nogpgcheck deepdb-5.5.31-plugin.x86_64

* Start mysql

# /etc/init.d/mysqld start


Thanks

Shell Script : lftp Example

Hi guys, the following scripts you can use to upload and download directories from your ftp server using lftp.


1. Upload Script


#!/bin/bash

### Defining Path

dir1="/source/path"
dir2="/destination/path"

user="ftp-username"
pass="password"

### Upload command

lftp -e "mirror  -R $dir1 $dir2 ;quit" -u $user,$pass yourdomain.com

#### Checking upload failure/success

if [ $? -eq 0 ]
then

echo "Download Successful"
exit 0;
else
echo "Download Not Successful"
exit 1;
fi
####

2. Download Script
In above script change this  command 
lftp -e "mirror  -R $dir1 $dir2 ;quit" -u $user,$pass yourdomain.com
to
lftp -e "mirror  $dir2 $dir1 ;quit" -u $user,$pass yourdomain.com


[ 
Note: You can pass source and destination path (parameters) from command line as run time argument. For this replace source and destination path with $1 and $2 and run your script like below -
sh filename.sh source destination  
]   
If you have any queries and difficulties, please comment. 
  

Thanks