Migrate from (dv) to (ve) Server

Both my company an I have been using Media Temple for years now. We started on their Grid Server (shared hosting) but quickly realized we needed a much better server. That’s when we moved to their Dedicated Virtual (dv) server. We’ve been running that for the past 3 years and have had no problems at all. In fact it’s been the best hosting we’ve ever had.

Even though business is going well, we started looking at ways to save a little $$ here and there. We decided to re-evaluate our hosting platform and see how we could save money. After much consideration we decided to stick with MT since they’ve always been so good to us, but decided to switch to their (ve) server. The specs are almost the same and it’s almost half the price.

The difference? Basically with the (dv) you are not only paying for hosting but also for a Plesk license. It gives you a nice GUI for interacting with the server. Since we already work a ton with command line on our other severs we decided we didn’t need this luxury.

Ok, enough with the back story. Here’s the HOW you’ve been waiting for. Keep in mind that this info is based around migrating from a (dv) to a (ve) server BUT it will help anyone looking to get started with MT’s (ve) server.

Also, the info below is only for migrating a site to the (ve) and not how to “set it up”. If you are looking for that, I recommend this article.

 

  1. First things first, SSH into your server. (you can use any user that you’ve set up or you can even use ‘root’)

  2. Create the new site in your virtual host (replace with your domain and IP address)

[bash] sudo vi /etc/apache2/sites-available/DOMAIN.COM [/bash]

Then add the following to the file

[plain]

ServerAdmin [email protected]
ServerName DOMAIN.COM
ServerAlias www.DOMAIN.COM
DocumentRoot /var/www/DOMAIN.COM/html/
ErrorLog /var/www/DOMAIN.COM/logs/error.log
CustomLog /var/www/DOMAIN.COM/logs/access.log combined

[/plain]

You’ll also need to know how to use Vi, and can find out more HERE, but for know just know that :q will QUIT the file and :wq will WRITE it before you QUIT.

  1. Now we need to create the directories we specified above “html” and “logs”

[bash]
sudo mkdir -p /var/www/DOMAIN.COM/html
sudo mkdir -p /var/www/DOMAIN.COM/logs
[/bash]

  1. Then just add the site to Apache and reload it.

[bash]
sudo a2ensite DOMAIN.COM
sudo /etc/init.d/apache2 reload
[/bash]

  1. Make the folder writeable use either 755 or 777 (just be cautious of security)

[bash] sudo chmod 777 /var/www/DOMAIN.COM/html [/bash]

  1. Copy over your files from your (dv) to your (ve) and verify it’s all there – http://ip-address/domain.com/html/

  2. Now comes the database part. If your site is database-less then you can move on to the last step otherwise see below.

First log in to MySQL via command line (I prefer to log in with root)

[bash] mysql -u root -p [/bash]

Second, create the database and set up a user and password

[bash] create database DATABASE-NAME; grant all on DATABASE-NAME.* to ‘USERNAME’ identified by ‘PASSWORD’; [/bash]

Third, exit MySQL and import your .SQL file into the database. I personally found the easiest way to do this is to first upload your .SQL file to the root of your /html/ folder then run the following.

[bash] mysql -u root -p DATABASE-NAME < /var/www/DOMAIN.COM/html/FILENAME.SQL [/bash]

  1. Lastly, log into your OLD (dv) and remove the DNS Zone and then log into your new (ve) and add the new DNS Zone…. or you could just use MT’s built in Point to Another Server Tool.

That should be it… let me know if you have any issues or run into any problems.