Categories

Monday, 30 December 2013

How to Install Perl modules using Cpan

Hi,

Below is the steps to install perl modules using cpan(Comprehensive Perl Archive Network) in a CentOS machine.

The CPAN's main purpose is to help programmers locate modules and programs not included in the Perl standard distribution

It will act as a command line interpretor through which we can install perl modules.

You can get more details about Cpan in the wiki link http://en.wikipedia.org/wiki/CPAN.

sudo  perl -MCPAN -e shell

Above command will drop you in the CPAN shell.


cpan shell -- CPAN exploration and modules installation (v1.9402)
Enter 'h' for help.

cpan[1]> 


Now you can install a perl module. If you want to install a perl
module named Email::Sender, then you need to issue the below command.

cpan[1]> install Email::Sender

That is install module::name(Email is the module here and Sender is the name)

Once the installation shows as succesfull, then you can test it by listing installed perl modules using the command

# instmodsh

Available commands are:
   l            - List all installed modules
   m <module>   - Select a module
   q            - Quit the program
cmd? l
Installed modules are:
   Authen::SASL
   CPAN::Meta::Requirements
   CPAN::Meta::YAML
   Capture::Tiny
   Class::Load
   Class::Method::Modifiers
   Data::OptList
   Data::Serializer
   Devel::GlobalDestruction
   Devel::StackTrace
   Digest::SHA
   Dist::CheckConflicts
   Email::Abstract
   Email::Address
   Email::Date::Format
   Email::MIME
   Email::MIME::ContentType
   Email::MIME::CreateHTML
   Email::MIME::Encodings
   Email::MessageID
   Email::Sender
   Email::Simple
   ExtUtils::CBuilder
   ExtUtils::Config
   ExtUtils::Helpers
   ExtUtils::InstallPaths
   ExtUtils::MakeMaker
   File::Policy
   File::Slurp
   HTML::TokeParser::Simple
   IPC::Cmd
   Import::Into
   JSON::PP
   List::MoreUtils
   Locale::Maketext::Simple
   Log::Trace
   MIME::Tools
   MIME::Types
   MRO::Compat
   Mail::Sender
   Module::Build
   Module::Build::Tiny
   Module::CoreList
   Module::Implementation
   Module::Load
   Module::Load::Conditional
   Module::Metadata
   Module::Runtime
   Moo
   MooX::Types::MooseLike
   Package::Stash
   Params::Check
   Params::Util
   Parse::CPAN::Meta
   Perl
   Perl::OSType
   Role::Tiny
   Sub::Exporter
   Sub::Exporter::Progressive
   Sub::Install
   Sub::Override
   Test::Requires
   Test::Simple
   Test::Tester
   Throwable
   Try::Tiny
   parent
   strictures
   version

That's all . ..............

Saturday, 28 December 2013

Ion Cube Loader issue after Cpanel Update

Hi,

Two days before, we faced a problem after one of our client updated the apache  and php on a  cpanel server using /scripts/easyapache.

Then the site is showing the below error.

"Failed loading /usr/local/IonCube/ioncube_loader_lin_5.2.so"

It seems that easy apache was unsuccessful or the php modules are not properly updated. Here the error shows that Ioncube was not updated with the current version of php.

The fix for this is to install the php extension module ioncube using the below command

 /scripts/phpextensionmgr install IonCubeLoader

Now the error message has gone and site is working.

How to reduce the system reserved space in linux

Hi All,

 In linux system OS will reserve some space for a partition by default .That is about 5 % of disk space is reserved for the privileged process. So some times after the most of the disk space is used up, the disk space will be shown as full,  though there is some 6-7 Gb of free space.

Use the command df -h to check the current status of disk space.

So most of the process will get stopped, omce disk space is filled up


Especially in the case of large partitions, it is safe to set the reserved space to the minimum, which is one percent or even to 0 percent.

Best way to make the system reserved space to 0 % is by using tune2fs command, because we already partitioned the device and need to change the partition settings.


Suppose you want to make the reserved space to 0 % on /dev/sda1. We can use  the below command

#tune2fs -m 0 /dev/sda1

This will make the reserved space to 0 %

At the time of file system formatting, we can set the system reserved space to desired % by using the below command.

# mkfs.ext4 -m 1 /dev/sda1






Monday, 2 December 2013

undefined symbol: PQescapeLiteral error on running python postgresql import

Hello,

I got an error as follows, on running import pg command on python command line.

import pg

Traceback (most recent call last):


File "<stdin>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/pg.py", line 31, in <module>


from _pg import *

ImportError?: /usr/local/lib/python2.7/dist-packages/_pg.so: undefined symbol: PQescapeLiteral

This seems to be some issue with libpq module for postgresql

Below is the steps that I followed to  fix it.

1)I just checked which is the library directory for postgresql

 pg_config --libdir

/usr/lib

2)Then I checked libpq.so module  which is needed for the postgresql commands to work with python is present on the /usr/lib directory.

  ldd /usr/local/lib/python2.7/dist-packages/_pg.so | grep libpq
    libpq.so.5 => /usr/lib/libpq.so.5 (0x00007f0d6b943000)


3)I can see the libpq.so.5 is already on the path /usr/lib.  The issue is that the header module for libpq was not installed for the command to run. So I installed it using the command below.

apt-get install libpq-dev

which fixed the issue and now I am able to run the pg command from python command line.

Regards
Syamkumar.M

Thursday, 21 November 2013

No module named yum

Hi ,


I got an error as below on running the command on a centos 6.3  server.




There was a problem importing one of the Python modules
required to run yum. The error leading to this problem was:

   No module named yum

Please install a package which provides this module, or
verify that the module is installed correctly.

It's possible that the above module doesn't match the
current version of Python, which is:
2.7.3 (default, May 15 2012, 17:45:42)
[GCC 4.4.4 20100726 (Red Hat 4.4.4-13)]

If you cannot solve this problem yourself, please go to
the yum faq at:
  http://yum.baseurl.org/wiki/Faq




Some one installed installed  a new version of python for running eclypse on the machine and the system python package corrupted due to it, thereby corrupting the yum package.



Below is the steps I have done to fix it.


1)I checked the system location of python which is /usr/bin/python which is version 2.6


/usr/bin/python --version


2) I ran the command "rpm -V python" which will verify all the system packages and will report any error happened to them.


I got error as


Missing /usr/lib64/python2.6.6/*


That is all the system folder for python was some how deleted .




I have to recreate that folder for yum to work


3) I checked one of the identical server where /usr/lib64/python2.6.6 exists and then copied that folder to the other machine where folder is missing.  
The above step saved my time. Otherwise I need to reinstall the python 2.6.6 from centos repository



 cd /usr/lib64
 scp -r python2.6/ root@10.11.16.145:/usr/lib64/

But still I got one error as below


AttributeError: 'YumBaseCli' object has no attribute '_not_found_i'

 It seems that some file system atributes is still having issues. So I had to reinstall the current version of yum

First check the version of yum installed on the machine 

rpm -q yum
yum-3.2.29-40.el6.centos.noarch

Now download the same version of yum "yum-3.2.29-40.el6.centos.noarch"


wget http://mirror.centos.org/centos/6/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm


Then reinstall it using the command  


rpm -ivh --replacepkgs yum-3.2.29-40.el6.centos.noarch.rpm

 
And now yum worked with out any issues .




Cheers
Syamkumar.M

Thursday, 3 October 2013

Change Postgresql Data Directory

Hi,

Currently there was some disk issue on our server in which some script is importing huge amount of data on the postgresql datbases which filled up the disk space on the machine and stopped all the services .

/ had only 20 GB of disk space .

Postgresql is installed in the directory  /var/lib/pgsql/9.3/data for the postgresql version9.3 . The configuration file of postgresql is postgresql.conf, log files and all other important files are located in that directory

As /var is not a seperate partition, the data directory got filled and which inturn filled up the / partition.

So we need to either change the data directory to /attached which had almost 5 TB of disk space.

Changing the data directory of postgresql seems to be tedious task.

One work around for that issue is to move the data directory /var/lib/pgsql/9.3/data to /data and then create a symlink to /attached/data.

Below is the procedure for it

1) First stop the postgresql service
2)move the data directory to /attached by using the command

mv /var/lib/pgsql/9.3/data /attached

3)now create a sym link to /attached/data from /var/lib/pgsql/9.3/

ln -s /attached/data /var/lib/pgsql/9.3/data

So now the postgresql will check the configuration files and datas inside the same folder /var/lib/pgsql/9.3/data , but it is symlinked to /attached/data. So the actual files will store in /attached/data and won't fill  up /.

4)Restart the postgresql service

/etc/init.d/postgresql-9.3 start

5)Test if it is working perfectly.

su - postgres
-bash-4.1$ ll
total 4
drwx------. 3 postgres postgres 4096 Oct  3 04:31 9.3
-bash-4.1$ psql
psql (9.3rc1)
Type "help" for help.

postgres=# show data_directory ;
     data_directory    
-------------------------
 /var/lib/pgsql/9.3/data
(1 row)

postgres=#



Cheers
Syamkumar.M


Tuesday, 1 October 2013

MTS Data Card Installation in ubuntu 12.04

Hi,

For configuring the MTS Mblaze Datacard on ubuntu, Please do the following steps.

1)First install the service wvdial.

sudo apt-get install wvdial


2) Then create a configuration file /etc/wvdial.conf and add the following configurations on it.

[Dialer mts]
Stupid Mode = 1 
Inherits = Modem0 
Password = mts 
Username = internet@internet.mtsindia.in 
Phone = #777 
[Modem0] 
Init1 = ATZ 
SetVolume = 0 
Modem = /dev/ttyUSB0 
Baud = 115200 
FlowControl = Hardware (CRTSCTS) 
Dial Command = ATDT 
  
3) After this just plugin the the MTS data card on the ubuntu machine. The data card will be automatically detected on the ubuntu machine.

After this run the following command

  sudo wvdial mts


 --> WvDial: Internet dialer version 1.61
--> Initializing modem.
--> Sending: ATZ
OK
--> Modem initialized.
--> Sending: ATDT#777
--> Waiting for carrier.
ATDT#777
CONNECT 3100000
--> Carrier detected.  Starting PPP immediately.
--> Starting pppd at Tue Oct  1 21:21:48 2013
--> Pid of pppd: 8718
--> Using interface ppp0
--> local  IP address 116.202.128.90
--> remote IP address 10.228.138.3
--> primary   DNS address 10.228.129.113
--> secondary DNS address 10.228.129.114








Now you will be able to connect to the machine.



Also you can configure it on the Network Manager. For this do the following steps.

1)Click on the Connections Tab on the right side of your desktop.
2)Click on Edit Connections on the bottom
3)Go to the Mobile Broad Band Tab
4)Click on Add connections and give the necessary details 
5)Select the provider as MTS Mblaze and then add
6)Give any connection name

Then on the Mobile Broad Band settings Add the following

Number - #777
username - internet@internet.mtsindia.in
password - mts

Save it and then connect it after you plugged in the Data Card





.

Unable to connect to remote host: No route to host for postgresql

Hi,

When trying to connect to an postgresql database from outside, you may get the error as below " Unable to connect to remote host: No route to host for postgresql"

Here Iam using the postgresql version 9.3
Steps to check

1) First check the iptables rules on the server. If there is any unusual logs then flush it or try after stopping the iptables service using the command

/etc/init.d/iptables stop

2)Even after this if you are still unable to connect to the postgresql server, then do check the following

The postgresql default data directory in linux is   /var/lib/pgsql/9.3/data/

The configuration file for the service is postgresql.conf.

Open that file and search for the option  listen_addresses and make it to listen on all of the interfaces or IPs on that machine as below.

 listen_addresses = '*'

Now exit the configuration file after saving it.

3)Then go the configuration file  pg_hba.conf in the data directory /var/lib/pgsql/9.3/data/

This file controls the connection information of postgresql.

Open that file  and edit the configuration options as below

# IPv4 local connections:
host    all         all         127.0.0.1/32          trust
host    all             all             192.168.0.0/16            trust
# IPv6 local connections:

Above configuration will make the postgresql to listen on all hosts with the subnet range 192.168.0.0/16 . So add it based on your requirement.

Now save the file and then restart the postgresql database using the below command.

/etc/init.d/postgresql restart

Now try to connect to the database.

Also check for any startup errors on the log file /var/lib/pgsql/9.3/pgstartup.log


Regards
Syamkumar.M




Monday, 30 September 2013

message from server: "Host 'xxx' is not allowed to connect to this MySQL server"

Hi,

If you got the error while trying to import some thing as root to the mysql database as below

Host 'xxx' is not allowed to connect to this MySQL server"

The issue is that the root user of mysql has no privileges on all host names on the local database machine,

To resolve the issue do the following

Login to mysql

mysql -u root -pxxxxx

Select the database mysql

mysql> use mysql

And run the command as below

 GRANT ALL PRIVILEGES ON *.* TO root@'%' IDENTIFIED BY 'PASSWORD'

mysql> flush privileges;


and quit. Now you should be able to login as any hostname on the mysql machine.


Regards
Syamkumar.M





Sunday, 29 September 2013

Nagios Event Handler configuration

Hi,

 Event Handler is one of the configuration options on the Nagios server monitoring tools to take an action if a state has been changed on a particular service or host. An obvious use for event handlers (especially with services) is the ability for Nagios to proactively fix problems before anyone is notified.

Types of event Handlers
----------------------------------------

There are two main types of event handlers than can be defined - service event handlers and host event handlers. Event handler commands are (optionally) defined in each host and service definition. Because these event handlers are only associated with particular services or hosts, I will call these "local" event handlers. If a local event handler has been defined for a service or host, it will be executed when that host or service changes state.

Also there is global event handlers which are executed before the service and host event handlers. This will run for every host and services configured on the nagios.

You can enable the the global event handler by adding options   global_host_event_handler and global_service_event_handler main configuration file of nagios.

When Are Event Handler Commands Executed?

Service and host event handler commands are executed when a service or host:
  • is in a "soft" error state
  • initially goes into a "hard" error state
  • recovers from a "soft" or "hard" error state

Enabling the event handler on the nagios

For enabling the event handler on the nagios. First you need to add the option
enable_event_handler = 1 on the main configuration file /usr/local/nagios/etc/nagios.cfg.\



When Are Event Handler Commands Executed?
Service and host event handler commands are executed when a service or host:
  • is in a "soft" error state
  • initially goes into a "hard" error state
  • recovers from a "soft" or "hard" error state
    Soft States
    Soft states occur for services and hosts in the following situations...
  • When a service or host check results in a non-OK state and it has not yet been (re)checked the number of times specified by the <max_check_attempts> option in the service or host definition. Let's call this a soft error state...
  • When a service or host recovers from a soft error state. This is considered to be a soft recovery. 

Hard States
Hard states occur for services in the following situations (hard host states are discussed later)...
  • When a service check results in a non-OK state and it has been (re)checked the number of times specified by the <max_check_attempts> option in the service definition. This is a hard error state.
  • When a service recovers from a hard error state. This is considered to be a hard recovery.
  • When a service check results in a non-OK state and its corresponding host is either DOWN or UNREACHABLE. This is an exception to the general monitoring logic, but makes perfect sense. If the host isn't up why should we try and recheck the service? 


Writing Event Handler Commands
Event handler commands will likely be shell or perl scripts, but they can be any type of executable that can run from a command prompt. At a minimum, the scripts should take the following macros as arguments:
For Services: $SERVICESTATE$, $SERVICESTATETYPE$, $SERVICEATTEMPT$
For Hosts: $HOSTSTATE$, $HOSTSTATETYPE$, $HOSTATTEMPT$
The scripts should examine the values of the arguments passed to it and take any necessary action based upon those values.

SERVICE STATE cane be of four types

 1. OK
2. Warning
3.Unknown
4.Critical

SERVICESTATETYPE is of two types

1.Soft
2.Hard

SERVICEATTEMPT

How many times the attemts are made based on max_check_attempts defined in the configuration file.

Here I am writing a script to change the dns entries once httpd proccess goes down on a server. I will switch the dns to other httpd server which is running the same data. This is done by editing the zone file on the dns server.

Below the script for that

#!/bin/sh

#

# Event handler script for restarting the web server on the local machine

#

# Note: This script will only restart the web server if the service is

#       retried 3 times (in a "soft" state) or if the web service somehow

#       manages to fall into a "hard" error state.

#





# What state is the HTTP service in?

case "$1" in

OK)

    # The service just came back up, so don't do anything...

    ;;

WARNING)

    # We don't really care about warning states, since the service is probably still running...

    ;;

UNKNOWN)

    # We don't know what might be causing an unknown error, so don't do anything...

    ;;

CRITICAL)

    # Aha!  The HTTP service appears to have a problem - perhaps we should restart the server...



    # Is this a "soft" or a "hard" state?

    case "$2" in

       

    # We're in a "soft" state, meaning that Nagios is in the middle of retrying the

    # check before it turns into a "hard" state and contacts get notified...

    SOFT)

           

        # What check attempt are we on?  We don't want to restart the web server on the first

        # check, because it may just be a fluke!

        case "$3" in

               

        # Wait until the check has been tried 3 times before restarting the web server.

        # If the check fails on the 4th time (after we restart the web server), the state

        # type will turn to "hard" and contacts will be notified of the problem.

        # Hopefully this will restart the web server successfully, so the 4th check will

        # result in a "soft" recovery.  If that happens no one gets notified because we

        # fixed the problem!

        3)

            echo -n "Going to edit the dns zone file in the DNS server)(3rd soft critical state)..."

            # Below command will ssh into the DNS server and will change the dns entries.

            ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@192.168.6.209 < /usr/local/nagios/libexec/eventhandlers/script_dns.sh

            ;;

            esac

        ;;

               

    # The HTTP service somehow managed to turn into a hard error without getting fixed.

    # It should have been restarted by the code above, but for some reason it didn't.

    # Let's give it one last try, shall we? 

    # Note: Contacts have already been notified of a problem with the service at this

    # point (unless you disabled notifications for this service)

    HARD)

        echo -n "Going to edit the dns zone file in the DNS server)(3rd soft critical state)..."

        # Below command will ssh into the DNS server and will change the dns entries.

        ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no root@192.168.6.209 < /usr/local/nagios/libexec/eventhandlers/script_dns.sh

        ;;

    esac

    ;;

esac

exit 0
-----------------------

From the above it will ssh into the dns server and then execute the commands given in the file  /usr/local/nagios/libexec/eventhandlers/script_dns.sh

  cat /usr/local/nagios/libexec/eventhandlers/script_dns.sh

/etc/init.d/named stop
cp /var/named/test.com /var/named/test.com.bk
sed -i 's/192.168.6.209/192.168.6.208/' /var/named/test.com
/etc/init.d/named restart

Once the script is ready you should need to define it in the configuration file where commands are defined

/usr/local/nagios/etc/objects/commands.cfg

 define command{

        command_name    dns-edit

        command_line    /usr/local/nagios/libexec/eventhandlers/dns-edit.sh $SERVICESTATE$ $SERVICESTATETYPE$ $SERVICEATTEMPT$

        }

Also you need to define the script as the event handler so that it will be executed when event handler is called

 define service{
        use                             generic-service          ; Name of service template to use
        host_name                       webtest1
        service_description             HTTP
    check_command            check_http
    notifications_enabled        0
    max_check_attempts        4
    event_handler                   dns-edit
  }

Above one should be added on the configuration file of host.


Once every thing is configured correctly then the script will execute when a service is stopped.


Regards
Syamkumar,M










Thursday, 26 September 2013

Amazon Cloud Commands


Amazon Cloud
-------------------
Amazon Cloud is the place where you can create a number of ec2 instances in a Virtual Private Cloud.
You can get the complete documentation in the link http://docs.aws.amazon.com/AmazonVPC/latest/GettingStartedGuide/ExerciseOverview.html.

Here  I am listing some commands usefull to check varrious things in an amazon instance

Once you launched an ec2 instance in an VPC , there will be a default path where amazon API tools are located. The default path on my instances are is /opt/amazon/api-tool/bin/

1) How to check if an elastic ip is attached on the machine or not

GET http://169.254.169.254/latest/meta-data/public-ipv4

It will list the elastic ip on the amazon

2)To list the instance information of all machines on the amazon

ec2-describe-instances -K ~/.ec2/*.key -C ~/.ec2/*.crt

it need amazon keys to work


 

steps to Migrate Amazon Cloud Machines from one VPC to Another

Hi,

Recently I had some tasks to migrate the amazon Cloud Machines from one VPC with range 10.13.x.x to Another VPC with IP Range 10.15.x.x.

Requirements
----------------------
1) Neet to migrate the machines from VPC 10.15.x.x to 10.13.x.x VPC

Resolution
-------------------

a)We need to create AMI of the machines that need to be migrated and then need to create another machine on the subnet range 10.15.x.x from that AMI.

Please go through the link http://docs.aws.amazon.com/AWSToolkitVS/latest/UserGuide/tkv-create-ami-from-instance.html " for creating AMI of a machine.


2) The machines had two subnets in each region(us-east-zone 1a and us-east-zone- There are additional volumes attached with the machines which also need to migrated to the new VPC.We cannot detach the volume and attach it from one region to another.only it is possible on the same region.

Resolution
-----------------

So we need to create machine on the same region as that of the machine to be migrated, so that we can detach volume and attach it to the new machine easily

Below are the steps for detaching and attaching the volume on the AWS machine

a)First note down the volume ID of  extra volumes attached with the machines . You will get the volume ID by clicking on the instance name and checking the description tab below it.

b) Stop the running machine.
c)Detach the volume from the respective machine and then attach it to the new machine.

Issues faced
--------------------
 On linux machines , some machines got hanged , as it fail to  detect the extra volume on the new machine as mentioned in the /etc/fstab. 

Resolution
------------------

For this we need to do the following steps

a)Stop the machine
b)Detach the root volume (/dev/sda1 from it)
c)attach it to another running linux instance and mount it some where
d)then go to that mount and edit the etc/fstab there and remove the entries for that additional mounted volume
e)unmount the volume and detach it from that instance in the AWS console
f)Attach it again as root device for the earlier machine (/dev/sda1)

This time it will boot up properly. Then we can attach that extra volume of the old machine to the new one as I explained above.

Regards
Syamkumar.M

 

Sunday, 4 August 2013

How to install SuPHP on centos


   1. Add the RepoForge repo if you don't already have it.

        32-bit:
        rpm -ivH http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.i686.rpm
        64-bit:
        rpm -ivH http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.2-2.el6.rf.x86_64.rpm

  2.  Install the packages

        yum install -y php-cli mod_suphp

  3.  Edit /etc/suphp.conf and adjust lines 25 and 28 respectively

        x-httpd-php="php:/usr/bin/php-cgi"
        x-suphp-cgi="execute:!self"

   4. Set PHP session directory group ownership permission

        groupadd phpsession
        chgrp phpsession /var/lib/php/session

  5.  For each VirtualHost you wish to operate under suPHP, you will need to add the following to their Apache config file in /etc/httpd/conf.d, replacing username and group respectively

        suPHP_Engine on
        suPHP_UserGroup username group
        AddHandler x-httpd-php .php .php3 .php4 .php5
        suPHP_AddHandler x-httpd-php

 6.   For each user operating under suPHP, you will need to add them to the phpsession group you just created otherwise they will get errors about session creation. Replace username respectively

        usermod -a -G phpsession username

    If you get a 500 Internal Server Error message, your PHP scripts and/or directories probably have incorrect permissions. You can reset all directories to rwxr-x-r-x (ie. 0755) and all files to rwxr--r-- (ie. 0644) by running the following at your HTML root

        find . * -type d -exec chmod 0755 {} +
        find . * -type f -exec chmod 0644 {} +

Saturday, 20 July 2013

Sungrid Engine client Installation Centos

Hi,

 Oracle Sungrid engine is mainly used for clustering, in which user can submit jobs on the machines on the cluster.

There will be a master node , submit node and then slave machines in which jobs are submitted.

Below is the steps to install sungrid engine client on the machines. In this scenario master is already installed on the cluster. Here we will install and configure a machine as slave on that cluster.

yum -y install binutils csh java ksh libXpm openmotif22 tcl
yum --enablerepo=epel install gridengine gridengine-qmaster gridengine-execd gridengine-qmon gridengine-devel



cd /usr/share/gridengine/
./inst_sge -x -m



just proceed with the installation.



 
When the grid engine is installed , there will be two directories in which grid

 engine data is found.

 One is /usr/share/gridengine = $SGE_ROOT

in which all configuration files resides

another configuration root is $SGE_CELL which is named as default/common directory

 inside the $SGE_ROOT derectory

 source /usr/share/gridengine/default/common/settings.sh

chkconfig --level 35 sge_execd on
chkconfig --level 35 sgemaster on
qconf -as `hostname`
qconf -msconf


Now you have to make sure that the machine must need  a hostname. Set it in

/etc/sysconfig/network.Then add the hostname in DNS so that hostname is pinging

from any where especially from the master node.



now go to


cd /usr/share/gridengine/defaults/common


Edit the configuration file act_qmaster.


vi act_qmaster


add the hostmame of the master node here.


suppose say the hostname of master kmaster.example.com


and hostname of the new node we are creating is knode01.example.com





Now ssh into the master node 
kmaster.example.com





run the command qconf -shgrpl



this command will show the list of available host ques.



the queues will be lised as



@queue1

@queue2



etc



now you need to add the new machine to any of the queue on the master node.



using the command qconf -mhgrp @queue1



  a new text file will open and you need to add the hostname of the new machine

(knode01.example.com) to it



save the file in VI.



Now you need to add the machine as submit host and administrative host to run the

 jobs in them



so use the command



qconf -ah knode01.example.com

qconf -as knode01.example.com







now exit from the master node and ssh again into the new slave node.



go to directory /usr/share/gridengine



run the command ./install_execd



type in yes when prompted.



This will install the slave node and will add it to the master node.





after the installation is finished.



Please start the service /etc/init,d/sge_execd





and then run the command qstat -f



if every thing is correct , this command will list all the available nodes

on the grid.









Regards

Syamkumar.M















Wednesday, 26 June 2013

how to fix the error "ERROR:root:code for hash sha512 was not found." when running a python script

Hi,

 IF you got the error "ERROR:root:code for hash sha512 was not found." on running any python script then it might be due to a package called hashlib for python is missing . Here is the steps to install the package .

Download the package hashlib-20081119.tar.gz  from http://code.krypto.org/python/hashlib/

Then do the following steps

tar xvfz hashlib-20081119.tar.gz
cd hashlib-20081119
sudo python setup.py install

It will install the package.

Then run the script again .

Regards
Syamkumar

Tuesday, 25 June 2013

How to install Ruby on rails application on Ubuntu machine.


Hi All,

Below is the step by step installation procedure for ruby on rails on ubuntu 11.10 machine.

The packages needed for the installation of Ruby on rails on

    Ubuntu 11.10
    Ruby 1.92
    Rails 3.20
    Rubygems 1.8.15
    MySQL
    SQLite
    Git


1) First upgrade and update your system packages using the commands

"sudo apt-get upgrade
sudo apt-get update"

2)Install Ruby 1.9.2 , build-essential and git.

 Ubuntu provides several versions of Ruby. If you aren’t careful, you may end up installing older or even multiple versions. We want to install version 1.9.2 so we have the latest and greatest. For this, and other tasks ahead of us, we’ll also need build-essential as it has the developer tools that will be needed to compile various gems. Git is optional,

sudo apt-get install ruby1.9.2-full build-essential git-core

3)Install RubyGems 1.8.15

wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.15.tgz
tar -zxvf rubygems-1.8.15.tgz
cd rubygems-1.8.15
sudo ruby setup.rb

4)Update gems

sudo gem update --system
sudo gem install rubygems-update
sudo update_rubygem


5)Install the remaining some packages using the below commands


As rubygems  is installed we have to install rails on the machine now



sudo gem install rails
sudo apt-get install libsqlite3-dev
sudo gem install sqlite3
sudo apt-get install nodejs
sudo apt-get install mysql-server mysql-client
sudo apt-get install libmysql-ruby libmysqlclient-dev
sudo gem install mysql


6)Test the application

You should now have a working Ruby on Rails environment

to test it out


cd ~/
rails new app_of_the_century
cd app_of_the_century
rails generate model User


If you installation worked, Rails should create your application file/folder structure and generate a User model all without a single error.




Reference :http://www.brandedclever.com/the-perfect-rails-install-on-ubuntu-11-10/




Monday, 24 June 2013

How to install R application on ubuntu machine to install and run Bioconductor on ubuntu machine

Hi,

The current release of Bioconductor is version 2.12; it works with R version 3.0.1.

So we have to install or upgrade the R on the machine.

1) So first download the latest R package using the command.

wget https://launchpadlibrarian.net/140308028/r-base_3.0.1.orig.tar.gz

2) Extract it to the machine using the command  tar -xvzf r-base_3.0.1.orig.tar.gz


3)cd R-3.0.1/

change into the extracted directory and then run the following commands.


 ./configure

 make

 make install

 This will install the R on the machine

You can check the version by issuing the command

R --version

4)Now we have to install Bioconductor.

So just get into the R console using the command

R

and then run the following commands in it.

source("http://bioconductor.org/biocLite.R")
biocLite()

This will automatically install the required package for Bio conductor on the ubuntu machine.


Reference:http://bioconductor.org/install/


Regards
Syamkumar























E: Could not perform immediate configuration on 'util-linux' error on running apt-get update on ubuntu machine.

Hi,

 If you got the error as "E: Could not perform immediate configuration on 'util-linux': on ubuntu machine while running the command apt-get upgrade or apt-get update,

then do the following .


apt-get install util-linux -f -o APT::Immediate-Configure=0

This will fix the error on upgrading .


Friday, 21 June 2013

How to create a shared VNC connection using xinetd

Hi all,

In this tutorial, we are going to create vnc connections which can be accessed by any users and which can be resumed at any point of time.

Also we can create vnc for individual users as well..


 1) Install the required packages

# yum install vnc-server xinetd

2) Enable the XDMCP by editing the custom.conf file

# vi /etc/gdm/custom.conf

[xdmcp]
Enable=true
MaxSessions=30

[security]
AllowRemoteRoot=true
DisallowTCP=false

Note: Here “AllowRemoteRoot=true” used to allow root access.

3) Create a file with below content, in inside the /etc/xinetd.d directory

# vi /etc/xinetd.d/xvncserver

service vnc
{
  type = UNLISTED
 disable = no
 socket_type = stream
 protocol = tcp
 wait = yes
 user = test1
 server = /usr/bin/Xvnc
 server_args = -inetd -query localhost  -geometry 1280x800 -depth 16 passwordfile=/etc/vncpasswd/Xvnc.pass2
 log_type = FILE /var/log/xinetdlog
 log_on_failure += USERID
 port = 5950
 }



5)Now create a vnc password using the commands below.

mkdir /etc/vncpasswd/
vncpasswd /etc/vncpasswd/Xvnc.pass2
Then type the password you want to connect to vnc. It will be stored in that file.

6) Define the vnc01 service by edit the /etc/services file

# vi /etc/services

vnc   5950/tcp
7) Restart the xinetd and gdm services

# service xinetd restart
# gdm-restart
8) Test using the vncviwer command

# vncviewer localhost:5950
9) To connect from the remote system use the below one

# vncviewer IPADDRESS:5950

How to run multiple versions of java in Ubuntu linux

Hi,

 First install the two version of java by issuing the commands.

apt-get install openjdk-6-jre
apt-get install openjdk-7-jre

It will install the two version of java but the last installed version can be used by default on the system.


The installation path will be

/usr/lib/jvm/java-7-openjdk-i386
/usr/lib/jvm/java-6-openjdk-i386

By default the java bin path /usr/bin/java is linked to the file /etc/alternatives/java which is linked to /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java(if it is installed first). Other wise the link will be to /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java

To use a different version of java on the same ubuntu machine, we need to export the java home path using the command

export JAVA_HOME=/usr/lib/jvm/java-7-openjdk-i386/

If you need to make it permenant you need to add this in the .bashrc file.


Other wise there is another command which will help to change the java version.

which is

update-alternatives --config java
which will list the installed java versions

update-alternatives --config java
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                           Priority   Status ------------------------------------------------------------
  0            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1061      auto mode
  1            /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java   1061      manual mode
* 2            /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java   1051      manual mode
  3            /usr/lib/jvm/java-7-oracle/jre/bin/java         1         manual mode

If you want to use java version 1.6 choose the first one and enter it will change the binary path of the java to the new one.

Regards
Syamkumar
















Thursday, 23 May 2013

Lustre Client Installation in Servers.

Lustre Client installation
------------------------








As luster is not available on different kernel versions, we have to rebuild the rpm for a specific kernel. the steps are given below.



1)FIrst download the lustre source RPM from the site link http://downloads.whamcloud.com/public/lustre/lustre-2.1.1/el6/client/SRPMS/

You can download according to different version of lustre. Here I need lustre-2.1.1

2)Then rebuild the RPM using the command

rpmbuild --define 'kversion 2.6.32-279.el6.x86_64' --define 'kdir /usr/src/kernels/2.6.32-279.el6.x86_64/' --rebuild lustre-client-2.1.1-2.6.32_220.el6.x86_64.src.rpm

it will build the new RPM for the desired kernel you want.

The new RPM will be in /root/rpmbuild/RPMS/x86_64

3)There will be 5 rpms in that location
lustre-2.1.1-2.6.32_279.el6.x86_64.x86_64.rpm
lustre-debuginfo-2.1.1-2.6.32_279.el6.x86_64.x86_64.rpm
lustre-modules-2.1.1-2.6.32_279.el6.x86_64.x86_64.rpm
lustre-source-2.1.1-2.6.32_279.el6.x86_64.x86_64.rpm
lustre-tests-2.1.1-2.6.32_279.el6.x86_64.x86_64.rpm

There might get some dependancy problem while installing the packages l


For that install with out any dependancies

rpm -ivh --nodeps package.rpm


4)After that load the module using the command

modprobe lustre

5) Then you will be able to mount the llustre file systems using the commands

mount -t lustre .....

Regards
Syamkumar.M

Wednesday, 22 May 2013

How to rename a KVM virtual machine image

Hello,

 Below is the steps to rename a kvm virtual machine.

1)Shutdown the Virtual machine first

virsh shutdown test1

or

virsh destroy test1

2) I just want to rename the virtual machine to test2

first dump the xml file of the old virtual machine which needs to be renamed

virsh dumpxml test1 > test2.xml

Then it will dump the xml file of test1 to test2.xml

The xml files are in the location /etc/libvirt/qemu


3)Then edit the file test2.xml using vi command line

vi /etc/libvirt/qemu/test2.xml

find the below two lines in the file

<domain type='kvm'>
  <name>test1</name>

replace the test1 with test2(new name)

Then save it and exit

4)Then undefine the older virtual machine using the command

virsh undefine test1

5)Define the new one using the command

virsh define /etc/libvirt/qemu/test2.xml


New renamed vm will start now.

regards
Syamkumar.M

Tuesday, 23 April 2013

php_network_getaddress: getaddrinfo failed.

Hello,

 If you face the error as php_network_getaddress: getaddrinfo failed. on using file_get_contents on php

Then first check if fopen is enabled on php
else enable alloe_url_fopen on php.ini of the server and restart apache

If it is still not fixed, check the resolver configurations
change the name servers to google's one in /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4

Then load the code . If still not fixed , then do the following in /etc/hosts.

127.0.0.1 yourdomainname:80
 
Replace  yourdomainname with the server's hostname

This will fix the issue..


Regards
Syamkumar.M

Tuesday, 16 April 2013

How to fix PROFTPD login failed error

Hello,


If you got incorrect password  on proftpd after installing the package succesfully  and created a user correctly.


First check /var/log/messages


The error for me is as follows.


Apr 16 15:04:15 backup1 proftpd[14860]: ) - FTP session opened.
Apr 16 15:04:14 backup1 proftpd[14837]: - FTP session closed.


Then check the /var/log/secure


If you see error as
USER ftpuser (Login failed): Incorrect password.
Apr 16 14:56:45 backup1 proftpd: PAM unable to dlopen(/lib64/security/pam_stack.so): /lib64/security/pam_stack.so: cannot open shared object file: No such file or directory


PAM adding faulty module: /lib64/security/pam_stack.so


Then it is due to some incorrect settings on the default pam security settings of proftpd in


/etc/pam.d/proftpd


take a backup of it and then replace all the codes with below settings


#%PAM-1.0M-1.0
auth required pam_listfile.so item=user sense=deny file=/etc/ftpusers onerr=succeed
auth required pam_shells.so
auth include system-auth
account include system-auth
#session include system-auth
session required pam_loginuid.so
Then save the file and restart proftpd service


Then try to login with the created user. You should be able to login.

Reference-http://blog.redbranch.net/2012/04/17/proftpd-centos-6-pam-unable-to-dlopen-lib64securitypam_stack-so/


Regards
Syamkumar.M

Sunday, 14 April 2013

How to Reinstall Perl to fix perl errors .

Hello,


  Some times we need to reinstall perl on the Cpanel server due if existing perl package is no longer working.

common errors are as follows.
------------------------------------
Error
------------
frontpage-2002-SR1.2.i386 has missing requires of libexpat.so.0
1:java-1.6.0-openjdk-1.6.0.0-1.43.1.10.6.el6_2.x86_64 has missing requires of libasound.so.2()(64bit)
1:java-1.6.0-openjdk-1.6.0.0-1.43.1.10.6.el6_2.x86_64 has missing requires of libasound.so.2(ALSA_0.9)(64bit)
1:java-1.6.0-openjdk-1.6.0.0-1.43.1.10.6.el6_2.x86_64 has missinrl error on Cpanel server .
If you got the error “! Failed to install CPAN Perl module(s) Crypt::PasswdMD5 !!I”error


---------------------------------


First try to fix it by running cpanel perl script /scripts/fixperl

if that doesn't do it you'll need a complete perl reinstall so do the following:

wget http://httpupdate.cpanel.net/perl588installer.tar.gz
tar xzvf perl588installer.tar.gz
rm -rf perl588installer.tar.gz (skip this if you want to keep the tarball)
cd perl588installer/
./install

it'll take awhile but when it's done it should be fixed. 

If it still not fixed, then do the following steps.

-----------------------------------
Reinstall Perl
Get latest source from http://search.cpan.org/dist/perl/ , unarchive and go to that folder.

yum install make gcc
sh Configure -de -Dusethreads
make && make test && make install
cd /usr/bin
mv perl perl-backup
ln -s /usr/local/bin/perl perl

Reinstall Cpanel and Fix accounts

/scripts/upcp –force
/scripts/fixhome
/scripts/chownpublichtmls
-------------------------------


Regards
Syamkumar.M

Friday, 12 April 2013

How to fix sendmail error on Ubuntu

Hello,

 If you ever face below error on running sendmail on the Ubuntu server. Then please do the following fix.

error
-------------------
/etc/mail/sendmail.cf: line 100: fileclass: cannot open '/etc/mail/local-host-names': Group writable directory
-----------------------

Make a copy of  /etc/mail/sendmail.cf on the server before we edit it.

Fix
------------------------

Replacing line Fw/etc/mail/ local-host-names with line Fw-o /etc/mail/local-host-names in sendmail.cf, and Ft/etc/mail/trusted-users with line Ft-o /etc/mail/trusted-users in submit.cf and sendmail.cf.

save the file after making the above changes and then restart it.
-----------------------

Reference-
http://forums.fedoraforum.org/archive/index.php/t-199647.html



Regards
Syamkumar.M

 

Tuesday, 9 April 2013

Xen Vps showing offline after creating it from Solusvm

Hello,

If you are not able to create para virtualized Xen containers from your solusvm control panel, please follow the below procedure.

First check the xen configuration file which will be in /home/xen/vmid/vmid.conf
If it exist then try to start the container with the command xm create /home/xen/vmid/vmid.conf


it will show the exact error or you can refer the error log of xen which is /var/log/xen/xend.log

If you get error as disk image not found then check the image file on the server which will be in /dev/mapper/vmid.img. IF it doen't exist then there should be some issue with configuration of xen vms in the solusvm.

For me below step fixed.

1) I compared the configuration file of newly created xen vps with one which is running and created before. I found difference in the parameters defined in the configuraiton files(/home/xen/vmid/vmid.cfg)

The difference is that kernal and initrd images are different, also the hard disk is showing as sda instead of xvda(xen virtual device)

2)Then check the solusvm xen advanced configuration file /usr/local/solusvm/data/advanced.conf. I found it empty on the slave node where iam creating vps
3) But on the master node the file usr/local/solusvm/data/advanced.conf contains all the data.
4)just copy the configuraiton file from master and copy to the slave node
5)Then restart the solusvm service using the command
/etc/init.d/solsuvm restart
6)then delete and recreated the new vps
7)server should be created and online now.

Saturday, 6 April 2013

How to reset Xen Root password if it is not changing from SolusVM control Pannel

Hello,

  Some times One of the Xen VPS became in accessibe thriough ssh and we are not able to change the Root password through SolusVM. Then please follow the steps mentioned below to reset the root password.

1)First Stop the container using command(xm shutdown CTID) or through solusvm
2)Secondly find the the the Xen image location  of the VPS which is /dev/mapper/xen-vm369_img(example)
3)create a directory name test and then mount the image to it using command
 mount /dev/mapper/xen-vm369_img /test
4)then change the root environment to test using the command
 chroot /test
5)Now the root environment will be same as that of Xen VPS which we have mounted
6)Then change the root password of root using passwd command.
passwd root
7)Then exit from the root environment by typing the command exit and unmount the /test directory using umount /test
8)Reboot the server in solusvm

Now you will be able to ssh into the server with the new password

Regards
Syamkumar.M 

Friday, 5 April 2013

How to install Geo IP module for apache(Especially in a Cpanel Server) to block sites in different countires

 Hello,

 Geo IP module is used to block access for certain countries to the websites. This is done by a module named mod_Geoip on the apache. Below is the steps to enable and configure Geo IP on a Cpanel linux servers .

 1.Install GeoIP binaries:

    yum install GeoIP GeoIP-devel

2.You can download  more databases from MaxMind and put them into /opt/geoip/share/GeoIP/:

    http://geolite.maxmind.com/download/geoip/database/

3.install CPanel EasyApache GeoIP module:

    View details: http://www.cpanel.net/apps/easyapache/custom.html
    Download mod_GeoIP:

    wget http://easyapache.cpanel.net/optmods/custom_opt_mod-mod_geoip.tar.gz

    tar -C /var/cpanel/easy/apache/custom_opt_mods -xzf custom_opt_mod-mod_geoip.tar.gz}
Steps 2 and 3 are optional as Geo IP module is already enabled on the easy apache.

4.    Run EasyApache and select mod GeoIP:

    /scripts/easyapache

5.configure GeoIP by adding to httpd.conf (or pre_virtualhost_global.conf):

    /usr/local/apache/conf/httpd.conf
    /usr/local/apache/conf/includes/pre_virtualhost_global.conf

LoadModule geoip_module modules/mod_geoip.so
<IfModule mod_geoip.c>
  GeoIPEnable On
  GeoIPDBFile /var/lib/GeoIP.dat
</IfModule> 
6.Install GeoIP PHP Extension:

    Install geoip via PECL:

    pecl install geoip

7.Restart Apache:

    /scripts/restartsrv_apache


8.After this has been done we can test if the Geo IP was enabled by adding some rules on .htaccess of a website .

edit .htaccess of a website and add the following lines to it

SetEnvIF GEOIP_COUNTRY_CODE CN BlockThese
SetEnvIF GEOIP_COUNTRY_CODE TR BlockThese
# Add more countries here
Deny from env=BlockThese

A full list of 2 digit country codes can be found here: http://www.iso.org/iso/country_codes/iso_3166_code_lists/english_country_names_and_code_elements.htm

The above listed in the example are "CN = China" and "TR = Turkey"


Regards
Syamkumar.M



Cacti Server monitoring Tool Installation on Centos

Cacti
----------

Cacti is a complete frontend to RRDTool, it stores all of the necessary information to create graphs and populate them with data in a MySQL database. The frontend is completely PHP driven. Along with being able to maintain Graphs, Data Sources, and Round Robin Archives in a database, cacti handles the data gathering. There is also SNMP support for those used to creating traffic graphs with MRTG.

All the Steps for the installation of Cacti Software was mentioned in the link http://www.cyberciti.biz/faq/fedora-rhel-install-cacti-monitoring-rrd-software/.

 Please follow the steps one by one.

Regards
Syamkumar.M

How to remove Banned IP from the Cpanel Cphulkd and from the WHMCS

Hello,

 some times your IP got banned on cpanel or WHMCS  due to invalid login attempts . Usually if you type the the username and password incorrectly for more than 3 times then then your IP will get blocked on CPhulkd Database.

Same is the case with WHMCS. IP will get blocked on the table named tblbannedips on the WHMCS databases.

To unblock the IP please doe the following steps .

For Cphulkd
---------------

Login to mysql on the server as root user  and connect to the cphulkd database.

mysql> use cphulkd;

You will now connect to database cphulkd. Now type in sql query
just to confirm if your IP is really blocked there.
mysql> SELECT * FROM `brutes` WHERE `IP`=’x.x.x.x’;

It will list your IP if it got blocked . The next step is to unblock the IP using the below command.

mysql> DELETE FROM `brutes` WHERE `IP`=’x.x.x.x’;
once it done quit the mysql by typing
mysql> quit
In this way your IP will be removed from brute force

For WHMCS
--------------
For whmcs identify the database used by whmcs appication.

Then select the database from mysql

mysql> use example_whmcs
Issue the command

select * from `tblbannedips` WHERE `IP`=’x.x.x.x’;

It will list your IP.

Then remove the IP using the command as below

DELETE  FROM  tblbannedips WHERE  ip='x.x.x.x.';

Then  you will be able to access your WHMCS

Regards
Syamkumar.M





How to rescue openvz from File System corruptions

Hello,

 Some times File System in linux server may got corrupted . Suppose that /vz partition got corrupted in OpenVZ Hardware node. Then Please follow the below the steps to fix it.

You will see the file system errors in /var/log/messages and on dmesg.
Also on issuing the command df -h on the server, it will show incorrect Disk statistics if the File system is corrupted. Some times partition will show as 100% even though there is enough free space.

If /vz partition is corrupted..

Then at first stop vz service which is openvz service by command /etc/init.d/vz stop
After that unmount /vz partition using the command
umount /vz

Some times /vz partition won't un mount properly if there is some qoata issues are there on any of the Virtual Machines.

Don't use lazy unmount for unmounting it (umount -l /vz). Even if it shows as unmounted , fsck fail to run showing error as still it is mounted.

If such issue persists, then either reboot the server and enter into single user mode and run fsck on the server if you have KVM details from the DC.

If you don't have KVM details, then open /etc/fstab using the command vi /etc/fstab
Then comment out the entry of the partition /vz on it and then reboot the server

Wait for few minutes for the server to be online. As the /vz partition is commented out , it is automatically disabled when the server boots up.

ensure that /vz is unmounted using either the command mount or df -h

After that Run the fsck command as below.

fsck -fyC /vz

Always run the command on screen (screen -S fsck)


It will take some time for the task to complete depending upon size of the partition. Once it completes check the server using commands df -h. If it shows the correct disk statistics, then the issue has been fixed.

Regards


Thursday, 4 April 2013

Commands to Fix Permission on Linux Server

Hello,

To fix the permission of all the files on the linux server especially for files inside public_html(Cpanel) ,then please do the following steps .

cd Directory

Then issue the command for files

find . -type f -exec chmod 644 {} \;


For directories


find . -type d -exec chmod 755 {} \;



Regards

Syam



 




Use Full tips to find out load issues on the Linux Server(Server with Cpanel as well)

Finding Load causing connections and users

Below are certail scripts the user that is causing the load and for finding the procees,ip which has high cpu usage.

To check number of IPs connected to port 80
# netstat -tn 2>/dev/null | grep ':80 ' | awk '{print $5}' |sed -e 's/::ffff://' | cut -f1 -d: | sort | uniq -c | sort -rn | head

To list number of connections to domains in the server
# /usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | awk  'BEGIN { FS = ” ” } ; { print $12 }' | sed '/^$/d' | sort | uniq -c | sort -n

To list the Busiest Site in the server
# /usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | grep GET | awk '{print $12}' | sort | uniq -c | sort -rn | head

To list the Busiest Script running on the server
# /usr/bin/lynx -dump -width 500 http://127.0.0.1/whm-server-status | grep GET | awk '{print $14}' | sort | uniq -c | sort -rn | head

To list the most running process in the server
# ps aux | awk '{print $1}' | sort | uniq -c | sort -nk1 | tail -n5

To list the total process running by the users
# ps aux | awk '{print $1}' | sort | uniq -c | sort -nk1

When we see the process in the top result with “php” or “/usr/bin/php”, we can find the directory it is working with. You can use,
# for i in `ps -ef | awk '/php/{print $2}'`; do ls -l /proc/${i}/cwd; done

We can even check this dynamically with in a particular time limit, say 5 sec. We can use it as below.
# while true; do clear; for i in `ps -ef | awk '/php/{print $2}'`;do ls -l /proc/${i}/cwd; done; sleep 5; done

Ubuntu 12.04 OpenVz template issue in kernal 2.6.18-308.el5.028stab099.3

Hello,

 If you are running kernal  2.6.18-308.el5.028stab099.3 openvz. Then VM built with template ubuntu 12.04 won't boot with the error as FATAL: kernel too old.

To fix the issue, First add the ubuntu12.04 with latest kernal in the file named /etc/vz/osrelease.conf on the hardware node.

ubuntu-12.04    2.6.32

Another option is that

cd /proc/sys/kernel/
 cat virt_osrelease
 2.6.18-238.5.1.el5.028stab085.5

 echo 2.6.32 > virt_osrelease

Then restart the ubuntu VPS which will start the  VPS.

 But there will be problem with network.

 on restarting the network you may get the error as ifdown: failed to open statefile /run/network/ifstate: No such file or directory

Just manually create  the folder named /run/network/ on th virtual machine and then restart the network which will fix the issue.

Regards

Tuesday, 5 March 2013

How to install Tomcat on the Linux Servers

Hello,
First install java or jdk for the tomcat to run.

 Then installe tomat using the link below
 http://java.dzone.com/articles/installing-tomcat-7-ubuntu

Inorder to access tomcat on port 80 which is apache port we need to redirect the port 80 requests to port 8080 via iptables .
Below is the command for that.

iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080


Ad