Drupal Dojo Session: Moving your site to a new server

ghankstef's picture
2010-10-26 12:30 - 13:30 America/New_York
Event type: 
Online meeting (eg. IRC meeting)

Learn the the steps to move your site from one server to another, copy a live site to your local machine, or copy a site you've developed locally to a production server.

We will cover:

Command line tips to make the site copy faster.
GUI alternatives for those who don't have ssh access or aren't comfortable with command line
Using drush to make it easier
Hosts files tricks to test the site on the new server.

Register to attend: https://www1.gotomeeting.com/register/568068625

Notes from session:

  1. Get you account credentials in order. You are going to need several ssh, ftp, mysql passwords. Get them all in one place before hand where you can look them up

  2. Copy files
    possible methods
    scp ftp - Can use GUI like Filezilla or Cyberduck
    rsync -avz -e ssh remoteuser@remotehost:/remote/dir /this/dir/

  3. dump database
    drush: drush sql-dump > file.sql
    mysql mysqldump -u username -p dbname > file.sql
    backup and migrate module

  4. copy db to new server (see #2)
    scp filename
    or GUI

  5. Create db on new server

  6. Load data for db dbump file and grant permissions
    mysql -u username -p


mysql cli --> mysql -u username -p dbname < file.sql

DO NOT DO THIS IT WILL CLOBBER YOUR DATABASE IMPORT FILE! mysql -u username -p dbname > file.sql

phpmyadmin or cli
GRANT ALL PRIVILEGES ON dbname.* TO 'username'@'hostname' IDENTIFIED BY 'password';

  1. Tell apache about the site and restart apache

    ServerName geoffhankerson.com
    ServerAlias gh1.themesfordrupal.com www.geoffhankerson.com

      DocumentRoot /var/www/sites/public_html
      <Directory /var/www/sites/public_html/>
              Options Indexes FollowSymLinks MultiViews
              AllowOverride All
              Order allow,deny
              allow from all
      ErrorLog /var/log/apache2/www.geoffhankerson-error.log
      # Possible values include: debug, info, notice, warn, error, crit,
      # alert, emerg.
      LogLevel warn
      CustomLog /var/log/apache2/www.geoffhankerson.com-access.log combined
      php_value error_reporting "E_ERROR"
      php_value error_log "/var/log/apache2/www.geoffhankerson.com-php.log"
  2. Edit hosts file

  3. Test

  4. Switch DNS

10A. Fix problems


eric_sea's picture

This session is available on the Drupal Dojo:

Drupal Dojo

Group organizers

Group events

Add to calendar

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds:

Hot content this week