Saturday, July 13, 2013

Installing Java for development

For your java development you may need to install JDK package for your system instead of installing jre. Once you install JDK package jre will automatically installed.

Please note down the steps for implementing java environment on your computer.

First you should download the java package from here : http://www.oracle.com/technetwork/java/javase/downloads/index.html

 * Click on "Java" 
* Then you need to click "Accept License Agreement"
* Download the 64bit Package 
(For windows 7) => jdk-7u25-windows-x64.exe 
(for Xp ) => jdk-7u25-windows-i586.exe

Double click on jdk-7u25-windows-x64.exe package and follow the installation instructions (clieck next ..next )

Finally you will receive the following out put.
Successfully installed Java SE Development Kit 7 Update 25(64-bit) : This will create "jdk as well as "jre" on your installation.
Click "Close" in the installation window. Thats it you have installed your java software on your machine.

Setting Environment path in windows 7:
Sometimes you will encountered the following error while running java on you your machine.

'javac' is not recognized as an internal or external command, operable program or batch file,

For correcting this error please do the following steps: 
Control Panel > System
Or
Right click on your MyComputer > Properties > Advanced System Settings >  Advanced > Environment Variables
Click "New" Set Variable name as " java" and Variable value as "C:\Program Files\Java\jdk1.7.0_25\bin" without any quotes click ok and now you can execute your command anywhere on your command prompt.

If you don't want to set an environment path you can change the installed "bin" directory on your command prompt and execute the java command.

That is cd command ,
For example : > cd C:\Program Files\java\
C:\Program Files\Java>cd jdk1.7.0_25
cd bin



Friday, July 5, 2013

Root Login Email alert

cPanel / WHM / Centos server root login alert to your email address:
open bashrc file and and the following line at the end of the file

 vi /root/.bashrc


echo 'ALERT - Root Shell Access ( server.ajeesh.com )on:' `date` `who` | mail -s "Alert: Root Access from `who | cut -d'(' -f2 | cut -d')' -f1`"   ajeesh@xxxx.com

Sunday, June 30, 2013

Grub2 recovery

centos / cPanel server grub2 recovery steps : 
1. Boot your server from a live CD 
2. type fdisk -l command to find out your primary disk partition where you want to recover your grub. 

3. mkdir /media/sda1
4.  mount /dev/sda1 /media/sda1 
5.  mount --bind /dev /media/sda1/dev
6.  mount --bind /proc /media/sda1/proc 
7.  chroot /media/sda1
8.  grub-install /dev/sda
9.  If you get an error, then we need to execute this command -> grub-install --recheck /dev/sda 

10 After the grub installation we will exist from chroot => exit

11 umount /media/sda1/proc
12 umount /media/sda1/dev
13 umount /media/sda1 
14 reboot the server

Friday, June 28, 2013

CSF WHM Internal Server Error

When trying to access CSF via WHM it's coming back with:

Internal Server Error

500
No response from subprocess (/usr/local/cpanel/whostmgr/docroot/cgi/addon_csf.cgi): subprocess exited with status 2

=================
We can check the error log here tail -f /usr/local/cpanel/logs/error_log while accessing csf through your WHM.

From the error log we can see which perl module is missing for csf. We can install the missing perl module using the follows command.

/usr/sbin/csf -x
/scripts/perlinstaller --force Net::LibIDN
/usr/sbin/csf -e
/usr/sbin/csf -u

But this is not fixed my 500 internal server error. I have fixed this issue by executing the following command.

curl -s configserver.com/free/csupdate | perl

Saturday, June 15, 2013

Upgrade Firefox version to 21

I have upgraded my Fedora 16 firefox to the latest version 21. Please check my upgrade steps for this process.

[root@localhost ajeesh]# cd /usr/local/src/
[root@localhost src]# wget http://rpms.famillecollet.com/remi-release-16.rpm

[root@localhost src]# rpm -Uvh remi-release-16.rpm
warning: remi-release-16.rpm: Header V3 DSA/SHA1 Signature, key ID 00f97f56: NOKEY
Preparing...                ########################################### [100%]
   1:remi-release           ########################################### [100%]

[root@localhost src]# yum --enablerepo=remi list firefox
Installed Packages

firefox.i686                                                                  18.0-1.fc16                                                                       @updates

Available Packages                                                                                                                                                       
firefox.i686                                                                  21.0-4.fc16.remi                                                                  remi 

[root@localhost src]# yum --enablerepo=remi update firefox

Dependencies Resolved

========================================================================================================================================================================
 Package                                     Arch                              Version                                          Repository                         Size
========================================================================================================================================================================
Updating:
 firefox                                     i686                              21.0-4.fc16.remi                                 remi                               26 M
Installing for dependencies:
 xulrunner-last                              i686                              21.0-2.fc16.remi                                 remi                               19 M

Transaction Summary
========================================================================================================================================================================
Install       1 Package
Upgrade       1 Package

Total download size: 45 M
Is this ok [y/N]: y

Thursday, June 13, 2013

Centos 6 32bit PAE kernel

There is no centos 6 32 bit PAE kernel. So you should be very careful while selecting a 32 centos6 OS on your server. Latter you can not upgrade more than 4GB RAM on your server. In the case of RAM upgrade you need a server migration from 32 bit CentOS 6 to 64 bit CentOS 6

Thursday, May 23, 2013

Integrating Varnish cache with Apache


Installing Varnish cache in cPanel server+Centos5.8

Varnish cache can be configure as a reverse apache proxy for accelarate web site access. Varnish cache stores the web pages in server's virtual memory.
Each users connection will be handled by each worker thread. I have tested this in my testing server. Here we are listrning port 80 to Varnish process and web server will handles the request in port 8080.


 # wget http://repo.varnish-cache.org/redhat/varnish-3.0/el5/noarch/varnish-release-3.0-1.noarch.rpm
 # rpm --nosignature -i varnish-release-3.0-1.noarch.rpm
 # yum install varnish

Open /etc/sysconfig/varnish and make the changes as follows:
NFILES=131072
MEMLOCK=82000
RELOAD_VCL=1
VARNISH_VCL_CONF=/etc/varnish/default.vcl
VARNISH_LISTEN_PORT=80
VARNISH_SECRET_FILE=/etc/varnish/secret
VARNISH_MIN_THREADS=2
VARNISH_MAX_THREADS=1000
VARNISH_THREAD_TIMEOUT=120
VARNISH_STORAGE_FILE=/var/lib/varnish/varnish_storage.bin
VARNISH_STORAGE_SIZE=1G

We need to make sure the following options are updated in this configuration file:
VARNISH_LISTEN_ADDRESS , VARNISH_LISTEN_PORT, VARNISH_VCL_CONF
VARNISH_ADMIN_LISTEN_ADDRESS,VARNISH_ADMIN_LISTEN_PORT
VARNISH_TTL,VARNISH_MIN_THREADS,VARNISH_MAX_THREADS,VARNISH_THREAD_TIMEOUT
VARNISH_SECRET_FILE,VARNISH_STORAGE

Next configuration is at /etc/varnish/default.vcl

backend b1 {
.host = "IP_Address of your server";
.port = "8080";
}

acl a1 {
"IP_Address";
}

sub vcl_recv {
if (server.ip ~ a1) {
set req.backend = b1;
}
}

Next we need to change Apache's port from 80 to 8080

]# /etc/init.d/varnish restart
Stopping Varnish Cache:                                    [  OK  ]
Starting Varnish Cache:                                    [  OK  ]

]# /etc/init.d/httpd restart

]# netstat -lpn | grep varnish
tcp        0      0 127.0.0.1:6082              0.0.0.0:*                   LISTEN      18276/varnishd    
tcp        0      0 0.0.0.0:80                  0.0.0.0:*                   LISTEN      18278/varnishd    
tcp        0      0 :::80                       :::*                        LISTEN      18278/varnishd