Moving Drupal from one host to another
You've got a Drupal site running and now want to move it to another server which is bare-bones. This server is luckily running Ubuntu, which makes installing the rest of the LAMP (Linux, Apache, MySQL and PHP) stack a one-line operation:sudo tasksel install lamp-server
The install process will stop at one point to ask for the password of the root user for MySQL. Once the install completes, use the MySQL command-line client to add in the same database (an empty one) and user that Drupal uses.
Use mysqldump
to dump out the Drupal database data into an sql file. Load it in the new database, populating it. You'll want to tar up the whole directory where the Drupal files reside (not forgetting the .htaccess) and expand it out in the same location within the new machine. You may (not) need to edit sites/default/settings.php
or .htaccess
for any host information changes. settings.php
is also where you edit the database login information, if you decide to use different ones.
With Apache running, you should be able to hit the new Drupal site. It looks to be running but there are a few gotchas. If you are (most likely) running Clean URLs, the links don't work anymore. You'll need to disable it to get navigation working at http://hostname/?q=admin/settings/clean-urls
, maybe going through http://hostname/?q=user
to log in first. To set up Clean URLs again, you need to run this line:sudo a2enmod rewrite
And edit /etc/apache2/sites-available/default
, changing the AllowOverride None
to AllowOverride All
inside the directory with the path /var/www
, or where the Drupal files live. Restart the server and you find that you can enable Clean URLs now.
The other gotcha is that the status report is complaining it can't find the PHP GD library. Apparently PHP library is installed but not configured so you run these lines:sudo apt-get install php5
(optional?)sudo apt-get install php5-gd
Lastly, cron needs to be set up to update the Drupal site. I use curl
so the lines are:sudo apt-get install curl
crontab -e
0 * * * * curl --silent --compressed http://localhost/cron.php
The last line is done inside the vi
editor so after that, save and quit.
Congratulations! Your Drupal site is now running fine on the new machine.
0 comments:
Post a Comment