Site Moving From One Server To Another - Cheat Sheet

Become root:

  • $ su

Zip up the public_html:

  • $ tar czvf iastage.tar.gz public_html/

Change owner to "user": (if pulling files)

  • $ chown user:user iastage.tar.gz

Log in to new server and copy files, or push them from the old server.

Two ways to do secure copy of files:

  1. old server → new server $ scp iastage.tar.gz user@web.rpm.hostedbyxentek.net:/home/"user"/www/domainname.tld/
  2. new server ← old server $ scp rprice@216.69.157.128:/home/"user"/filename.tar.gz ./filename.tar.gz

Untar files:

  • $ tar xvf filename.tar.gz

This creates a folder called public_html or possibly httpdocs when untarred:

Make sure public is empty:

  • $ ls public

remove public directory, rename public_html

  • $ rm -rf public
  • $ mv public_html public
  • $ chmod 755 public

Transfer MySQL Data

  • $ mysqldump -u root -p iastagedrupal > iastage_20091216.sql
  • $ gzip iastage_20091216.sql
  • $ scp iastage_20091216.sql.gz rprice@web.rpm.hostedbyxentek.net:/home/"user"/www/iastage.com/

Create Database and DB User http://drupal.org/getting-started/6/install/create-database

  • $ mysql -u "user" -p
  • $ mysql> CREATE DATABASE iastagedrupal CHARACTER SET utf8 COLLATE utf8_bin;
  • $ mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON `iastagedrupal`.* TO 'iastage'@'localhost' IDENTIFIED BY '******';
  • $ mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON `iastagedrupal`.* TO 'iastage'@'127.0.0.1' IDENTIFIED BY '******';
  • $ mysql> GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, INDEX, ALTER, CREATE TEMPORARY TABLES, LOCK TABLES ON `iastagedrupal`.* TO 'iastage'@'web.rpm.hostedbyxentek.net' IDENTIFIED BY '******';
  • $ mysql> FLUSH PRIVILEGES;
  • $ mysql> exit;

Get a list of all users

  • $ mysql> SELECT Host, User, Password FROM mysql.user;

Get a list of databases

  • $ mysql> SHOW DATABASES;

Load the zipped file in

  • $ gzip -d iastage.sql.gz
  • $ mysql -u "user" -p iastagedrupal < iastage.sql

Set up some records in the “hosts” file on your local machine:

  • windows/system/hosts

Example:

  • 174.143.255.47 iastage.com

This tricks your computer into thinking that iastage lives at the new server, before we switch nameservers.

Nameservers:

  • ns1 ns2 ns3.hostedbyxentek.net