Chette Soriano
home . about . contact me
Chette Soriano *
Backing up your website | Print |  E-mail
Written by Chette Soriano   
Sunday, 04 September 2005
Article Index
Backing up your website
Page 2
Page 3
Page 4

Backing it up

In a nutshell: The easiest way to backup your site is by compressing all your HTML/PHP/etc. files, and then downloading the compressed files. Here's how to do it:

Step 1: Get shell access to your account. If you don't have one, ask your web hosting provider nicely :) For security reasons, this is usually disabled by default.

A shell allows you to access your server thru a command-line interface (think DOS). With shell access, you can FTP, debug CGI scripts, set permissions, and even read your email.

If your web hosting provider refuses to grant you an SSH/Telnet access, you have no choice but to download each of your file via FTP, which is a time-consuming process.

Step 2: Get a Telnet/SSH client. I personally use PuTTY, a free telnet/SSH client.

Step 3: Login to your account. Open PuTTY (or your favorite SSH/Telnet client). Under Host Name, enter your domain name or IP address. Under Protocol, it is highly recommended that you select SSH instead of Telnet. Click the Open button at the bottom of the window to connect to your server.

Backing up your website

You will be asked to enter your account's username and password. If your login is successful, you will be taken to the prompt, which is typically represented by a dollar sign ($)

Step 4: Backup your database. Enter the following commands:

mysqldump --opt -Q -u USERNAME -pPASSWORD DATABASENAME > BACKUPNAME.sql

Replace USERNAME with the username of your database, replace PASSWORD with the password of your database, replace DATABASENAME with the name of your database, and replace BACKUPNAME with the desired filename of your backup.

When completed, you will be taken back to the prompt. Verify that the BACKUPNAME.sql is in the path you specified. You can compress this file by following similar commands at the next step.

Step 5: Backup your web files.

Go to the directory that you want to backup.

To view the contents of a directoty, enter the following commands:

ls

To change directories, just enter the following:

cd DIRECTORYNAME

Replace DIRECTORYNAME with the desired directory name, For example:

cd public_html

And finally, to compress/archive all the files and subdirectories in that directory, enter the following commands:

tar -cvzf FILENAME.tar.gz *

Replace FILENAME with the desired filename of your backup. Verify that the backup was successfully created. You can do an ls, or view your directory using your FTP client.

Step 5: Download the backup files. Use your favorite download manager. I personally use ReGet and GetRight.

Pretty nifty, huh? Hope this helps.

Trackback(0)
Comments (2)add comment

This e-mail address is being protected from spam bots, you need JavaScript enabled to view it said:

If you have ssh access to your webhost, you could do it faster and save bandwith by transferring only the part of the changed files using rsync(http://rsync.samba.org)

rsync is a replacement for scp/rcp that has many more features.

rsync uses the "rsync algorithm" which provides a very fast method for
bringing remote files into sync. It does this by sending just the
differences in the files across the link, without requiring that both
sets of files are present at one of the ends of the link beforehand.


Using rsync over ssh
Keep large directory structures in sync quickly with rsync

there is a win32 binaries which includes ssh clients at http://www.itefix.no/cwrsync/


September 27, 2005

chette said:

Thanks for the addendum joeyski. Looks pretty useful!
October 02, 2005

Write comment
quote
bold
italicize
underline
strike
url
image
quote
quote
smile
wink
laugh
grin
angry
sad
shocked
cool
tongue
kiss
cry
smaller | bigger

busy

 
< Prev   Next >
* *
Main Menu
chette's articles
photo gallery
photos on the go
.........................
bookmarks
search
about
faq
contact me
Subscribe
www.flickr.com
chette's items Go to chette's photostream
Latest Articles
*

© Copyright 1997 - 2007 Chette Soriano. All rights reserved. Contact me.

* *