Linux, Programming, Web development

How to move WordPress sites between cloud servers using Ubuntu 11.10 and PHPMyAdmin

Here’s a quick howto:

I use Rackspace as my cloud service; I was moving a few sites from one server using Ubuntu 10.04 LTS (Lucid Lynx) to a new one using 11.10 (Oneiric Ocelot). I hit a few issues, so I thought I’d tell you how to export a WordPress site in its entirety and move it between two LAMP servers.

  1. Open a file manager on your local machine, and open both remote locations.
  2. Copy the root and all files of the site to your new server in the same location.
  3. Copy the sites-available virtual host file from /etc/apache2/sites-available/ directory to the same location on your new server.
  4. Create the symbolic link in sites-enabled by changing into /etc/apache2/sites-enabled/ and using this command: “sudo ln -s /etc/apache2/sites-available/yourhostfile yourhostfile”.
  5. Open PHPMyAdmin for your old server in a browser window. Login, and open the database for the site you want to move.
  6. Go to the Export tab. Assuming you’re using UTF-8 encoding (and that’s a very safe bet), all you have to do is ensure that the Add DROP TABLE / VIEW / PROCEDURE / FUNCTION / EVENT box is checked under Structure, and that all options are highlighted in the Export box. Export the uncompressed database and save to a convenient location.
  7. Open PHPMyAdmin in your new server, login, and create a new database with the same name as the one you’re importing.
  8. Import the database you exported.
  9. Create a user on that database with the same name and password.
  10. Edit the DNS zone file for your site to point to the new IP address for your new server.
  11. SSH into your server, and use this command: “sudo service apache2 restart”.

Hit Ctrl+F5 once you think the DNS records will have propagated, and ensure it worked.

 

Leave a Reply