Migrate: Media Temple Grid Server to Dedicated Virtual
The migration from Media Temple’s Grid Server to the Dedicated Virtual web hosting solution was surprisingly easy. With initial pointers from Paul, I was well on my way to successfully migrating four hosted sites from the "Grid" to the DV. Media Temple’s Dedicated Virtual hosting plans provide a considerable amount of flexibility – including root access – which is ideal for users who want complete control of their own or client(s) websites.
Unfortunately, the (mt) Knowledge Base is a little thin and may not be of much help for those that may feel disoriented or overwhelmed by the task of moving from the Grid Server to a Dedicated Virtual. I know I was. Fortunately, with a little trial and error, reading, and a successful migration, the following was documented in hopes of helping others who plan on making the move. Much praise for Plesk – the control panel software of choice provided for Media Temple customers.
For the following example, we’ll move an entire WordPress driven site from the Grid to the DV. We’ll take this opportunity to install a fresh new install of WordPress. The beauty of moving to a completely different server is that a) you have an opportunity to start afresh, and b) you can tweak and prepare your site before DNS changes are made (any and all improvements that you’ve pushed back due to procrastination or sheer laziness can finally be completed).
The general intent of this tutorial is to serve as a reference for any website owners anticipating a move from a current hosting solution to a second, third, or fourth.
Check-list: What do I need to do?
- Export your WordPress database using phpMyAdmin [#]
- Download important files and directories – .htaccess, wp-config.php, /wp-content/uploads, /wp-content/plugins, and /wp-content/themes [#]
- Upload a new WordPress installation into your new server httpdocs directory [#]
- Create database to match wp-config.php settings or start new [#]
- Upload important files and directories – .htaccess, wp-config.php, /wp-content/uploads, /wp-content/plugins, and /wp-content/themes [#]
- Import old WordPress database via SSH [#]
- Double-check website before requesting DNS change [#]
- If everything checks out as it should, decide what hours generate the least amount of traffic and request DNS change to match [#]
Export your WordPress database
In order to successfully move your WordPress posts, comments, and configuration settings, you’ll need to export your existing database (SQL). This can be done using the phpMyAdmin interface accessed via the Grid Server Account Server WebControl > MySQL Admin.
Once inside phpMyAdmin, locate the Database drop down menu and select the associated WordPress database for export. In the following view, find the ‘Export’ tab.
Within the ‘View dump (schema) of database’ view, ensure that the following parameters match:
- Export – If this database is used for nothing other than your WordPress installation, click the ‘Select All’ option which will highlight all WordPress related tables preceded with “wp_”. Ensure that the SQL radio button is ticked.
- SQL Options > Structure – Ensure that the following and nothing else are selected: ‘Structure’, ‘Add DROP TABLE’, ‘Add AUTO_INCREMENT value’, and ‘Enclose table and field names with backquotes’.
- SQL Options > Date – Ensure that the ‘Data’ box is checked. Also check ‘Complete Inserts’ and ‘Use hexidecimal for binary fields’.
- Scroll down and check the ‘Save as file’ box. Leave the default file name template and compression settings and click the ‘Go’ button. phpMyAdmin will then prompt you to save a backup of your database. Do so and move to SQL file to a safe directory on your computer.
You have successfully backed-up your entire WordPress “core” – settings, configurations, users, categories, links, posts, and comments. For future reference, repeat the above steps in order to backup your installation of WordPress on a regular schedule.
Download important files and directories
Unless you have spent a considerable amount of time customizing core WordPress files, I think it is [generally] a good idea to take this opportunity (of moving to a new server) to install the latest distributions. Considering it is safe to assume that you have uploaded countless images and files for sharing to your exhsiting server, it would only make sense to move specific files or folders to the new. In order to do so, you’ll need to fire up your favorite FTP utility in order to download files locally to your computer.
Aside from whatever personal files or directories you have created that you wish to bring with you, I recommend that users quadruple check that they’ve saved the following:
- .htaccess – This file is hidden by default. In order to copy the contents of this file – rewrite or redirect rules – you’ll need to show invisible files. Most FTP utilities offer the option under their ‘View’ menu option.
- wp-config.php – This file contains the important bits of your installation including your database name, location, username, and password. If you plan on creating your new database to match the settings found in this file, save a local copy of this file to upload back into your WordPress directory.
- /wp-content/uploads – Extremely important directory! Any files or images that you have uploaded using the WordPress uploading interface (post editor) are stored in this directory. Forget to move this and you’ll discover all your images for posts (after database import) will be missing.
- /wp-content/plugins – Personally, I download my entire plugins folder to re-upload. If my site is working as it should with the existing plugins, why leave them out of the download / re-upload workflow when moving to a new host? Once you’ve imported yoru backup database, your WordPress install will look as it did on the previous host. If plugins are missing from the new installation, your site might not function as it should from the get-go.
- /wp-content/themes – The presentations folder for WordPress containing all the themes you’ve amassed over the years.
Upload a new WordPress installation
Download the latest release of WordPress from the Download page. The current release as of this posting is version 2.1 which offers a handful of updates from previous versions. Check out the release notes here.
Remember when we downloaded all the important files and folders from the previous step? Drop them back into this new WordPress download in preparation for upload. Ensure that wp-config.php remains in the root directory while plugins, uploads, and themes are placed in the wp-content directory. Once all the files are where they should be, open your FTP utility and upload the files and directories to your new server.
Create your WordPress database
The first few minutes after logging into Plesk may be somewhat overwhelming. Worry not as Plesk is far simpler to navigate and use than you would ever imagine. By moving forward with the creation of your new WordPress database, we’re going to assume that you’ve familiarized yourself enough to understand the relationship of “Clients” and associated “Domains”. Moving forward, open the domain for which WordPress is to be installed. You’ll want to look for the “Services” section of the page.
Within the Services pane, select Databases. In the next view, select Add New Database. You will then provide the Database Name, ensure that type is MySQL, and make sure that Database Server is Local MySQL Server. Click OK. After the database is created, you’ll need to create an associated username and password. The database name, username, and password will then need to be referenced in the wp-config.php file located in your WordPress root directory to be uploaded to the new server.
Upload important files and directories
All of the previously downloaded files & directories including the newly edited wp-config.php file should then be uploaded to your new server. Take note to ensure that the original WordPress file directories are as they should be /wp-content/uploads, /wp-content/plugins, and /wp-content/themes.
Import old database via SSH
Chances are high that your database backup exceeds the 2MB upload limitation of phpMyAdmin. Fortunately, the database can still be upload – with a bit more finger work. You’ll need to complete the import via SSH (Secure Shell). In order to do this, your backup must be on your server. Upload your database into the root directory of your domain and open a command line utility. OS X users can open Terminal. Type the following to open an SSH session and hit [enter]. You will be prompted to enter your SSH/FTP password:
$ ssh email@example.com
Where username is your SSH username and domain is the associated domain that you wish to import an existing database into. Most likely will need to be an IP due to your domain not receiving the DNS change. Once logged in, you’ll need to navigate to the directory where the backup database was uploaded. In this scenario, your root HTML directory. If you are unsure of the correct path, simply type the following followed by [enter]:
ls is an abbreviation of list segments. Entering ls followed by [enter] will present you with a list of directories & files on your server. In the case of Dedicated Virtual users, cd or change directory where the backup exists:
$ cd httpdocs
Now that you are in the correct directory, you can import your WordPress backup into an existing [empty] database on your server:
$ mysql -u username -p databasename < backup.sql
Enter the string above and hit [enter] after which you will be prompted for the password for the existing database. Username refers to the username associated with the database, databasename the name of the existing database, and backup.sql being the backup uploaded via FTP from the old server. [More Info] Once the import is complete, logout and delete the backup from your HTML directory.
Double-check your website before requesting DNS change
Now is the time to double-check your import and installation to ensure that everything is in working order. Because your domain is not yet pointing towards your new host, you’ll need to navigate using the IP or by selecting the ‘Site Preview’ in Plesk. Now is also a great time to create your Mail aliases or accounts for forwarding or setup via Plesk in order to ensure that no emails are lost during the DNS change.
The best time to request a DNS change?
The best time of day to request an official DNS change from your host depends on your readership. Reference your statistics tracking package for a better idea of what hours net the least number of readers. Doing so will ensure that any downtime as your DNS resolves will not result in disoriented and / or confused readers. Recommended time for a DNS change would be between the hours of 2AM and 5AM. Your results may vary.