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



Thursday, May 2, 2013

remove IP block

If your cPanel server csf will not remove temporary / permanent block while using

csf -tr and csf -dr commands. In this situation we can remove the block using following method.

[~]# csf -g IP_ADDRESS

Chain            num   pkts bytes target     prot opt in     out     source               destination        

DENYIN           3     1178 72006 DROP       all  --  !lo    *       ip         0.0.0.0/0



Solution
 [~]#  iptables -D DENYIN 3


root@ajeesh [~]# csf -g 174.129.254.101
Chain num pkts bytes target prot opt in out source destination

LOCALOUTPUT 9 183 11076 DROP all -- * !lo 0.0.0.0/0 IP/16 Solution
root@ajeesh [~]# iptables -D LOCALOUTPUT 9

Saturday, April 13, 2013

Formating and mouting a disk

Formating and mouting a new disk in Linux system.

In cPanel server we can take backups in /backup folder. For this we can purchase a new disk and formate and mount to your existing system. So the backup space will be added in the new disk.


Step 1: We need to find out the new disk attached to our system.

# fdisk -l

Disk /dev/sda: 1999.9 GB, 1999978364928 bytes
255 heads, 63 sectors/track, 243150 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        6387    51199155   83  Linux
/dev/sda3            6388        6897     4096575   83  Linux
/dev/sda4            6898      243150  1897702222+   5  Extended
/dev/sda5            6898       10084    25599546   83  Linux
/dev/sda6           10085       10594     4096543+  82  Linux swap / Solaris
/dev/sda7           10595       10849     2048256   83  Linux
/dev/sda8           10850      243150  1865957751   83  Linux

 Disk /dev/sdb: 500 GB, 16139354112 bytes

/dev/sdb new partition will not have a partition. 

Step 2:

Check new disk is already mounted

# df

If the new device is mounted you can unmounted this
# umount /dev/sdb

Step 3:

Create a new partition in" /dev/sdb"

A) # fdisk /dev/sdb

A console will be prompted and

Press "n"  make new partition
Press Enter Button
Preess P button to create a new partition(primary)
Press 1
Press Enter Button
Press Enter Button for First and last cylinder. This will make the entire disk as a single partition.
Press t button   To change the file system typr
Press  Enter Button
Press L  button to see all list
type 83 for Linux
Press Enter Button
press w  Button
Press  Enter Button

This will create a new partition on your /dev/sdb disk.

Step 4:
Formate the new partition
# mkfs.ext4 /dev/sdb1

Step 5:
Mount the partition.

# mkdir /backup
# mount /dev/sdb1 /backup

# vi /etc/fstab

/dev/sdb1 /backup ext4 defaults 1 2

Another Issue.
My test server which is created in VMWare EXSI server. After upgrading the disk space we need to mount the extra hard disk space on it.


root@puppetmaster:/# df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       6.8G  6.0G  501M  93% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            1.1G  4.0K  1.1G   1% /dev
tmpfs           208M  512K  207M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.1G  208K  1.1G   1% /run/shm
none            100M     0  100M   0% /run/user
overflow        100M     0  100M   0% /tmp
overflow        100M     0  100M   0% /tmp
root@puppetmaster:/# mkfs.ext3 /dev/sda2



root@puppetmaster:/# fdisk -l

Disk /dev/sda: 19.3 GB, 19327352832 bytes
255 heads, 63 sectors/track, 2349 cylinders, total 37748736 sectors

So I have created a new partition /dev/sda2
root@puppetmaster:/# fdisk /dev/sda

Command (m for help): n
Partition type:
   p   primary (1 primary, 0 extended, 3 free)
   e   extended
Select (default p):
Using default response p
Partition number (1-4, default 2):
Using default value 2
First sector (14680064-37748735, default 14680064):
Using default value 14680064
Last sector, +sectors or +size{K,M,G} (14680064-37748735, default 37748735):
Using default value 37748735

Command (m for help): p

I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00047f2a

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048    14680063     7339008   83  Linux
/dev/sda2        14680064    37748735    11534336   83  Linux


Command (m for help): t
Partition number (1-4): 2
Hex code (type L to list codes): 83

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
root@puppetmaster:/#

while formating the new partition,

root@puppetmaster:/# mkfs.ext3 /dev/sda2
mke2fs 1.42.9 (4-Feb-2014)
mkfs.ext3: inode_size (128) * inodes_count (0) too big for a
    filesystem with 0 blocks, specify higher inode_ratio (-i)
    or lower inode count (-N).
So I have rebooted the server and executed the command.

The system is going down for reboot NOW!
root@puppetmaster:/#

ubuntu@puppetmaster:~$ sudo mkfs.ext3 /dev/sda2
mke2fs 1.42.9 (4-Feb-2014)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
655360 inodes, 2621440 blocks
131072 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=2684354560
80 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632

Allocating group tables: done                           
Writing inode tables: done                           
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done

ubuntu@puppetmaster:~$
ubuntu@puppetmaster:~$ sudo mount /dev/sda2 /backup
ubuntu@puppetmaster:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda1       6.8G  6.0G  506M  93% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            1.1G   12K  1.1G   1% /dev
tmpfs           208M  500K  207M   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            1.1G  208K  1.1G   1% /run/shm
none            100M     0  100M   0% /run/user
/dev/sda2       9.8G   23M  9.2G   1% /backup

Wednesday, April 3, 2013

Make atractive color for your Linux shell prompt.

You can make actractive colors for your linux servers shell prompt.

Add the following lines to your home directories .bashrc file.

export PS1='\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]'

Here you can see  color codes used for user , @, hostname , w, etc in the above scripts. By changing the values you can use your own colors.

 ajeesh@tech3:~$ export PS1='\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]'

ajeesh@tech3 ~ $


Monday, April 1, 2013

Monitoring Mysql in cPanel server.

You can easily monitor mysql process on your cPanel servers.

Steps:
1. cd /home
2. remove file named latest-watchmysql , if any
3. wget http://www.ndchost.com/cpanel-whm/plugins/watchmysql/download.php
4. sh latest-watchmysql

Login to WHM > Plugins > Watch MySQL

After enabling the watchmysql daemon you can monitor your mysql process on your server.