Monday, January 28, 2008

Republic Day Weekend : 26-27 Jan 08 : Trek to Avchit Gad, Ghosale, Tale, Chambhargad, Songad Forts & Pale Caves ( Leni )

After a lot of change of plans, deliberations & chages in schedules, we finally set of for a trek in the Mahad region, early in the morning of 26th of January '08, Saturday. After a long time a nice long weekend had come our way ( We work Saturdays, so a long week end translates to anything more than 1 day here :) ) We were to actually leave on Friday night itself, but i ended up being in the office till 9 & Darshan had to run off to his workshop again to take care of an Engine. Thank god at that as iwas having a splitting head ache then which might just have canceled the trip for me :(

So finally Lalya ( aka Shridhar Joshi. 50 yr old young at heart & activity!) came to pick us up at my place in his Esteem. Thankfully i was feeling refreshed after a good night's sleep! After many deductions & additions, we were left a group of four : Lalya, Somesh, Darshan & Myself. The day's plan was to go to Roha via Tamhini. In spite of the potholes we managed to reach Roha by breakfast time. After feasting on the super Parathas courtesy Darshan's Mom! we went on to Medhe, the base village of Avachitgad.

We stopped at a superb lunch home just above the ST stand in Roha & had a great lunch. The fish was superb. The lunch was a bit more than we'd planned to have & that really set us yawning! After a drive of about an hour & half we reached Ghosale the base village of Ghosalgad. After climbing for hardly 5 mins we stretched out under forest canopy & dozed off for about half an hour. The short nap was really refreshing...

The climb to the col which is closed huge walls was pretty short about 15 -20 mins. The most surprising part here was the col separating the two hills which made up the fort. It was completely sealed off from both sides by huge walls , with a very small space between them.

The wall on the side of the Ghosale village has a small Dindi or Chor Darwaja ( Small Door). There is also a small water tank here. On the right hand side of this coll there is a built up 'Machi'. this portion is pretty flat & has remnants of some fortification. The width of the protrusion is very less giving it a more longish look. Again on this fort we were pleasantly surprised to find the Indian Tricolor hoisted by the villagers or government officials as we later found out. On the left hand side the hill climbs steeply towards the top point. There are nice large steps for some part of it after which the 'paywat' abruptly ends. From here on you can either climb the small rock patch or climb up through the forest . Either ways there is a lot of loose scree & the going is a bit hard. After climbing for about 20 mins we reached the top. The top is completely devoid of any remnants or fortification. It is almost impossible to access it any other way than from the coll as on all other sides its walls drop down very steeply. The Top offers a magnificent view of the countryside around. You can see the nearby Tale fort. Also Raigad can be seen in the distance.

After spending some time on the top we quickly started down as we still had to go to complete the Tale fort & head on the the base village of the next fort to spend the night. On the way down we met two guys from Pune who had gone to the Nearby fort of Birwadi which we had skipped in favour of Avachitgad. After chit chatting with them for sometime we got back into the car & headed towards Tale village .

To be continued

Thursday, January 24, 2008

Moving DB driven sites ( Joomla, Drupal , PHP Nuke & the like or custom) effortlessly using SSH

If you have ever administered a db driven site or one built on CMS like Joomla or Drupal you'll know that it can be a huge pain when it comes to moving hosts. I am putting up this tutorial here as a follow up to the basic SSH commands posts.

SSH makes moving huge sites a effortless process ( learning it can be painful though! ) .

I hope you find this useful!

Here we go.

A few Prerequisites :

1. Both your hosts provide SSH access to their servers.
2. You need a SSH client like Putty installed & ready to go on your machine.
3. If you are doing this for the first time then the below are a must :
i. A large mug of Coffee
ii. A lot of patience

1. Connect to current Server through SSH

So if you are ready, lets start by connecting to your current host using SSH. If you are using Putty start it up put in the your host name, port is usually 22 for SSH & select connection type as SSH.
Once you connect the terminal will pop up. Put in your username & password ( this wont show up anything as you type so dont worry about it being blank) & press enter .

Thats it now you have terminal access to your host.
Now lets first take a backup of the public_html or htdocs or www or whatever root directory your host provides you. In most cases this would be the directory you see as root when you access through FTP.

Ok gotta go to watch Janata Raja...I'll update this later
Ok Back! Lets continue!

2. Take a backup of the root directory.

Now run the following command at the terminal.

Browse & enter the directory that you need to move.

then type

zip -r *

Dont forget to end the command with a ; before you press enter to execute it, if you are using putty.

Once you are done, check if the archive has been created by typing in the command below at the terminal.

ls -al

Please note that the command above will create the zip archive in the folder that you are currently in. ls -al will show you the list of files in that folder. you should see the file in the file list there. It would be a good idea to check if the file size is decent enough in comparison with your site size. This will give you an idea if the archive is created properly. This isn't a concrete verification , but thats what i normally do.

There we now have a file backup ready. But hold on we are not out of the woods yet! We use a DB driven site remember! So on we go to step three.

3. Take a back up of your mysql database

First of all you need the following data before you begin the backup.

a. host name : this is localhost on most servers, but may be different in case your servers hosts databases on different servers.

b. database name : the name of the db you want to backup

c. Db User : the username that you use to connect to the database

d. Password : The password of the db user you are using.

If you are using Joomla, you can get all this data from the configuration.php file. They are named as $mosConfig_host, $mosConfig_db, $mosConfig_user & $mosConfig_password respectively.

All right now we are ready to go to the terminal to take a mysql dump of your db.

Here's the command you need to construct :

mysqldump -u yourdbuser -p -h yourhostname yourdbname > backup.sql

On executing this command ( & dont forget the ; at the end! ) you will be prompted for your password type in the db password here. Alternatively you can add it in the command itself. after the -p .

Now better tar this sql file as as well & ( in case it is large which in most cases is bound to be)

Great so if you have got so far you will have 2 zip files ready one with the file backup & another with the database backup.

4. WGET these files to new server

Now we need to use wget to transfer the files to our new server.

Connect to the new server through SSH & type in the command below :


Once thats done


This will get both the files to your new server.

5. UnZip the Files

Ok now lets untar the file backup in the root folder. Type in the

unzip backupfiles.tgz

Be sure to do this such that your root folder on the new site is populated with the contents of the archive.

now untar the sql files

unzip backupsql.tgz

6. Restore Database

Before you do this create a new database & a new database user for it. Then use the following command to restore the database.

mysql -u username -p password -h hostname databasename <>Once you are done doing all the above stuff make changes in the configuration file of your site to reflect the new database & location.

Note that for smaller databases it would be easier to create the dump & import using GUI tools like PHPMyadmin

Whew! We are done.. Well at least i hope it is done for you!

I hope you will find this useful.

Tuesday, January 22, 2008

Let's start with a few basic SSH commands

Secure Shell or SSH is a network protocol that allows data to be exchanged over a secure channel between two computers. Encryption provides confidentiality and integrity of data. SSH uses public-key cryptography to authenticate the remote computer and allow the remote computer to authenticate the user, if necessary.

SSH is typically used to log into a remote machine and execute commands, but it also supports tunneling, forwarding arbitrary TCP ports and X11 connections; it can transfer files using the associated SFTP or SCP protocols.

An SSH server, by default, listens on the standard TCP port 22. So thats the port you should keep open to allow incoming SSH requests.

Tools :

I usually use Win SCP or Putty when using from Windows or the inbuilt SSH client in Linux.

Here are a few common SSH commands :

1. ls -al : Lists all files & Directories in current folder with their attributes

2. chmod : Change Permissions on file/folder

The set of 3 go in this order from left to right:

0 = --- No permission
1 = --X Execute only
2 = -W- Write only
3 = -WX Write and execute
4 = R-- Read only
5 = R-X Read and execute
6 = RW- Read and write
7 = RWX Read, write and execute

chmod numberpermissions filename

3. chown : change file/ folder ownership

chown username folder/filename : changes ownership to username
chown username.groupname folder/filename:changes ownership to username, group to groupname
4. cd : change directory

5.tar Used for creating and extracting .tar.gz and .tar files
tar -zxvf file.tar.gz : Extracts the file
tar -xvf file.tar : Extracts the file
tar -cf archive.tar contents/ : Takes everything from contents/ and puts it into archive.tar

ZIP Files: Extracting .zip files shell command

First real brush with Linux

When we decided that it was time to evaluate various Linux flavors for deployment at our office, i started out with downloading the Mandriva One 2008 Live CD distro. Though not my first encounter with a Linux based OS, this one's been the most serious to date as i am seriously considering moving over completely to Linus Torvald's popular OS. In this series of blogs i will be trying to put together information that has been useful in using Mandriva or any other Linux flavor & anything that will be useful for those wanting to migrate from Windows.

What i plan to do over the coming few months is to use the following Linux flavours, get them setup with OS apps to match the Windows applications that i am used to using on it & test them for the best user experience, stability & all such stuff.

1. Mandriva
2. Ubuntu
3. OpenSuse

While i am at it i'll keep updating my progress & experience here.

Finally... My first post

I'd been thinking of starting a blog for a long time..
Finally got down to doing it today.. Not really sure what all's gonna go in here
Lets wait & watch!