Categories

Thursday 27 February 2014

ImageMagic Installation in plesk Centos


Hi,

Below is the steps to install ImageMagic on  plesk server.

1)Install ImageMagic using yum

yum install ImageMagic

2)Also Install ImageMagic-devel package

yum install ImageMagick-devel

3)For compiling ImageMagic with php, we need the package called php-pear

yum install php-pear

4)Now compile ImageMagic with php using pecl

pecl install imagick

For the above command to work, server need to have gcc compiler installed.

Some times you will get the error as sh: phpize: command not found

 To fix that error you need to install php5-devel package using the command

yum install php-devel

5)Now the extension module for imagick.so will be created under the php modules directory usually under /usr/lib/php/modules/

So we need to add the extension to php.ini

find out the location of php.ini on the server using the command

php -i | grep php.ini

default location should be /etc/php.ini

vi /etc/php.ini

open it in a editor and add the following line under “extension_dir” directive

extension = “imagick.so”

6)Save file and restart apache.

ImageMagic should be installed now.  The path of the convert for the ImageMagic should be /usr/bin/convert.


Thanks
Syamkumar.M

Monday 24 February 2014

Fix Sungrid Engine state 'E' (error)

Hi All,

I got an error state named E on some of the nodes running sun grid engine. The error message is getting while I issue the command

qstat -f 

queuename                      qtype resv/used/tot. load_avg arch          states
---------------------------------------------------------------------------------
m1.large@machine1.com BIP   0/0/1          -NA-     lx26-amd64    au
---------------------------------------------------------------------------------
m1.large@machine2.com BIP   0/0/1          -NA-     lx26-amd64    au
---------------------------------------------------------------------------------
m1.large@machine3.com BIP   0/0/1          0.05   lx26-amd64    E
---------------------------------------------------------------------------------
m1.large@machine4.com BIP   0/0/1          -NA-     lx26-amd64    au
---------------------------------------------------------------------------------



As shown above you can see that the machine3 is in E state. On the sungrid engine documentation E state  is an error state.



You will get the exact reason for this error state by issuing the command

qstat -f -explain E

  The E error state will not clear till the node is rebooted or restarting the grid engine. 

Because of this error, no job will hook in to that node and job will be in queue wait state.

Once you resolved the issues related to that node, you can issue the command 

# qmod -c '*'

This will clear the E state of the node and now job will hook into it.

Cheers
Syamkumar.M


Sunday 23 February 2014

Steps to Migrate Wordpress websites in Linux

Hi,

In this post, I am explaining the steps to migrate a wordpress website from one hosting space to another.

Wordpress is a popular blogging software now adays and is used in many of the popular websites. It was completely based on  mysql and php. The key configuration file for the wordpress is wp-config.php where the wordpress stores the database details.

Typical configuration details of mysql in wp-config.php is like below


// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for WordPress */
define('DB_NAME', 'skm_wp717');

/** MySQL database username */
define('DB_USER', 'skm_wp717');

/** MySQL database password */
define('DB_PASSWORD', 'dbpassword');

/** MySQL hostname */
define('DB_HOST', 'localhost');

/** Database Charset to use in creating database tables. */
define('DB_CHARSET', 'utf8');

/** The Database Collate type. Don't change this if in doubt. */
define('DB_COLLATE', '');

We should specify a database with a db user with full privileges to the database. Also need to specify the database password of the DB user.


Here I only describe the steps needed to migrate the wordpress website

1)First login to your wordpress website document root(for a cpanel it will be /home/user/public_html). And open the configuration file wp-config.php. Note down the database name, username, password from it.

2)Take a backup of the database you got from the configuration file wp-config.php.

If you have root access to the server, then you can create a database backup using mysql dump

mysqldump -u root -pdbpassword skm_wp717 > skm_wp717.sql

This will generate the mysql backup in sql format. 

Also you can export the backup of the database from the phpmyadmin.

3)Now you need to copy the data from the existing server to a new server.  I assume you already know the document root where the database files exists for the wordpress site. So you can eithere use scp or rsync to copy the files from here to there. You can also use the FTP as well.

scp example command for the transfer

scp -r root@servername:/home/user/public_html root@remoteserver:/home/newuser/public_html

Also copy the database to the new server using scp or rsync or ftp

scp root@servername:/home/user/skm_wp717.sql root@remoteserver:/home/


4)Now the data and mysql has been migrated.  You need to check if the permission for the files we transfered are correct with respect to the user in the new server. If not you need to change them manually

That is for changing the owner ship and group of the files in the new server .

cd /home/user
chown -R newuser:newuser public_html

if all the files need to have 644 permission , you can use the command find to change the permission of files to 644 and directories to 755.

Note: the below command is for cpanel users , as cpanel files need to have 644 permission for files and 755 permission for directories
cd public_html
find . -type f -exec chmod 644 {} \;
find . -type d -exec chmod 755 { } \;

5)Now create a database (Eithere you can use the same name or another). If you have different name . then you need to change it in the wp-config.php

Also create a database user with password and grant all previlages to the user on that database.

6)Now restore the database tables from the backup sql file to the new database we had created.

mysql -u root -ppassword newdatabase < skm_wp717.sql

Once it completes you have all the database data on your new db.

7)Open wp-config.php and change the values to the new one on it. Modify database name , user and password to the new one if it is different from the old server. If you have created the db, user and password same as that of the old server, you can skipp this step, but need to cross check the wp-config.php

8)Open your website with the new configurations from the new server.  You can do it by specifying the new ip with the website name in /etc/hosts file in your linux system

open /etc/hosts

ip websitename


If every thing is correct, then the wordpress page will load fine.

Cheers
Syamkumar.M





Friday 21 February 2014

NFS4 share configuration in Ubuntu

Hi,

NFS is a service used to share a folder or a directory  located on one networked computer with other computers/devices on that network. It is a native Linux/ Unix protocol unlike samba, which can be shared both in windows and Linux

In NFS version 4 , there is a concept called pseudo file system.

That is there is a directory called /exports which is shared as pseudo file system and all of the directories in the server can be shared by binding it inside the /exports file system

/exports file system can be mounted using the command

mount -t nfs shareip:/ /mnt

That is there is no need to give the share name /exports on mounting it.

Also we can bind any directory inside the /exports folder and can be shared via nfs version4

Below is the steps to configure it

apt-get install nfs-kernel-server

Above command will install the required packages to run nfs server on ubuntu

In NFS 4 all of the directories we are going to share will exist inside a single pseudo file system

All of the directories can be shared under that pseudo file system using --bind option

Let's say we want to export our users' home directories in /home/users. First we create the export filesystem:

mkdir -p /export/users 
  
Now we will bind the /home/users directory inside the /export as

mount --bind /home/users /export/users
Also add it on /etc/fstab

/home/users /export/users none bind 0 0
 


Now open the configuration file /etc/exports and add the following shares as given below

/export 10.11.15.0/24(rw,fsid=0,insecure,no_subtree_check,async) /export/users 10.11.15.0/24(rw,nohide,insecure,no_subtree_check,async)

That is we are exporting the share to subnet 10.11.15.0/24
Once it is done we can start the nfs kernel service using the below command

# service nfs-kernel-server restart
 
 
On the client side install package called

apt-get install nfs-common


Once it is done try to mount the nfs share using the command below

mount -t nfs shareip:/ /mnt

mount -t nfs shareip:/users /mnt/users

Cheers
Syamkumar.M



Thursday 20 February 2014

Lustre Troubleshooting

Hi,

 Last Week, we faced an issue in which our KVM infrastructure, we are using lustre share for storing the disk images of VMs. We have few critical vms running in one of the nodes and those machines get into paused state showing that disk space is full on nodes

Exact error message is given below

"block I/O error in device 'drive-ide0-0-1': No space left on device (28)"

Upon checking the hard drive disk space inside that vm in single usermode, I can see that it had almost 2 TB of free space.

So I believe it was some issue with disk image. So I ran fsck on the disk image in single user mode. But still it didn't worked. Finally I confirmed that it was some issue with the lustre file system, when one more VM running from lustre getinto paused state with the same error.

Finally I began to trouble shoot for lustre errors. Below are the steps that I have done on debugging the lustre

I checked the lustre logs and found the error as


"(vvp_io.c:1018:vvp_io_commit_write()) Write page 369920 of inode ffff8820120601b8 failed -28".


On lustre documentation the error code -28 is "The file system is out-of-space or out of inodes"(http://wiki.lustre.org/manual/LustreManual20_HTML/LustreTroubleshooting.html)


Also I checked the command to list the disk space of all of the OSTs in lustre

lfs df -h 


UUID                       bytes        Used   Available Use% Mounted on
klust01-MDT0000_UUID        1.2T      933.1M        1.1T   0% /klust01[MDT:0]
klust01-OST0000_UUID        9.1T        8.6T      202.8M 100% /klust01[OST:0]
klust01-OST0001_UUID        9.1T        5.8T        2.8T  68% /klust01[OST:1]
klust01-OST0002_UUID        9.1T        5.5T        3.1T  64% /klust01[OST:2]
klust01-OST0003_UUID        9.1T        5.8T        2.9T  67% /klust01[OST:3]
klust01-OST0004_UUID        9.1T        6.5T        2.2T  75% /klust01[OST:4]
klust01-OST0005_UUID        9.1T        6.6T        2.0T  76% /klust01[OST:5]
klust01-OST0006_UUID        9.1T        7.9T      796.0G  91% /klust01[OST:6]
klust01-OST0007_UUID        9.1T        6.4T        2.2T  74% /klust01[OST:7]
klust01-OST0008_UUID        9.1T        6.8T        1.8T  79% /klust01[OST:8]
klust01-OST0009_UUID        9.1T        6.4T        2.2T  74% /klust01[OST:9]
klust01-OST000a_UUID        9.1T        8.6T       48.2M 100% /klust01[OST:10]
klust01-OST000b_UUID        9.1T        7.9T      733.8G  92% /klust01[OST:11]

filesystem summary:       109.1T       82.8T       20.8T  80% /klust01


In above the OST 0 and OST 10 is filledup to 100%.

On checking I can see that both the VM disks are located in OST10  whose disk is filled up.

Below is the command to check in which OST the image locates

lfs getstripe /var/test.img

lmm_stripe_count:   2
lmm_stripe_size:    1048576
lmm_stripe_offset:  8
    obdidx         objid        objid         group
         8           1815776         0x1bb4e0                 0
        10           1728679         0x1a60a7                 0


 So finally we deleted some unused data from ost 10 and then rebooted the OST main node, which fixed the issue.

Cheers 
Syamkumar M 
 
   







Thursday 6 February 2014

How to make a KVM Virtual machine boot From CDROM

Hi,

If you have a running KVM VM and you need to boot this VM from a Bootable Linux iso image inorder to fix some issues on the KVM machine. Below are the steps to boot the KVM machine from CD ROM.

KVM machine is using the xml files for the configuration. We need to edit the configuration xml file inorder to make any changes in the VM.

1_First Shutdown the VM using the command.

virsh shutdown vmname

2)Open the configuration file of the VM using the command

virsh edit vmname

3)Search for the word cdrom and add the lines as below

<disk type='file' device='cdrom'>
      <driver name='qemu' type='raw'/>
      <source file='/opt/isos/CentOS-6.3-x86_64-bin-DVD1.iso'/>
      <target dev='hdc' bus='ide'/>
      <readonly/>
      <address type='drive' controller='0' bus='1' unit='0'/>
    </disk>


Here we specified the iso image as the source file parameter.




4)Now the cdrom has been added on the VM. But now we need to make the cdrom as the first boot device.

For that we need to change the boot order of vm. Below is the lines which specifies the boot loader for the KVM vm


<os>
    <type arch='x86_64' machine='rhel6.2.0'>hvm</type>

<boot dev='cdrom'/>
<boot dev='hd'/>
    <bootmenu enable='yes'/>
  </os>






In above I put the boot device as cdrom in the parameter <boot dev='cdrom'/> and put it above the hd.

Now reboot the machine and then the vm will boot from the Linux iso image we added.

Cheers
Syamkumar




Ad