From time to time I want to transfer a site from one host to another.  I am not saying this is the best way, but it works for me.  Some FTP/SCP clients allow you to drag and drop from window to window, but I haven't had success with that method.  Assuming I have SSH and SCP, heres what I do:

  1. tar the public_html dir.  ex:  go to the public_html dir and type tar -cvf website.tar ./
  2. ssh to the new host and go to the target path
  3. scp root@<host>:<path to file, incl. filename> ./  ex:  scp Denne email adresse bliver beskyttet mod spambots. Du skal have JavaScript aktiveret for at vise den. :/home/site/public_html/website.tar ./  (it will prompt for password)
  4. Untar.  ex:  tar -xvf website.tar
  5. Fix group and ownership.  Ex:  chown -R owner.group ./
  6. Next, you got to transfer databases. 
  7. For this, I simply export from one side, then import at the other.  Fix configs and connection strings if necessary.

For large databases:

  1. mysqldump databasename -u username -pPassword | gzip >databasename.sql.gz
  2. from new host, scp root@<host>:<path to file, incl. filename> ./  (will be prompted for password)
  3. gzip -d databasename.sql.gz
  4. login to mysql - mysql -u username -p
  5. use <databasename>;
  6. source <name of .sql file>;
  7. test.

 

Kategori: Programming

Search My Site