Our blog
Basic Server Migration Using SSH + SCP
The scenario here is that you have access to two servers - old and new - and you want to copy a site + database from old server to new server directly.
You have root SSH access to both servers.
1. Create a TAR archive of the document root for the site on the old server.
Log into SSH on the old server.
Navigate to your vhost root (the folder just above httpdocs) then use the following command to make a tar archive of your entire httpdocs folder:
-
tar -cvvf httpdocs.tar httpdocs/
2. Gzip the TAR archive
-
gzip httpdocs
3. Transer the File to the New Server
Log into SSH on the new server
This bit may change according to your specific server setups. The way I approached this was to log into the new server at the vhost root where I want to import the old httpdocs folder. I then use the following SCP command to log into the old server, find my archive and copy it to the current location.
I am using a custom port (not the real one in the example of course) for SSH so that must be specified. Unlike SSH, you must use a capital P to specify a custom port
Note the space and full stop at the end - they are very important!
-
scp -P 1111 old_server_username@123.123.123.123:/path/to/file/on/old/server/archive.tar.gz .
4. Dump all DB's and Transfer
To dump all of the databases into one single file we can use the following mysqldump syntax. Note you can simply use the --all-databases switch but this will backup database that you probably don't want to include. Better to declare a list of all the DB's that you do want.
-
mysqldump -u SomeUser -p --databases mydb1 mydb2 mydb3> myDbs.sql
Once you have this dump file you can Gzip it and transfer it via SCP using the same kind of commands as above.
More...
SCP four new judges take oath - Pakistan News
The Sanyo SCP-2700 Phone Will Color Sprint Operator | dandygadget.com
More Reading:
One Comments
|
[...] A better method for moving the files and database dump is to use SCP to copy files directly from the old server to the new server. I have written an article explaining this technique here: Basic Server Migration Using SSH + SCP. [...] |
RSS Feed
Migrating osCommerce Sites to a New Server (also CRE Loaded, Zen Cart etc) | Edmonds Commerce Blog
October 22nd, 2009