Migrating WordPress to Linode

Moving a WordPress site is a task that can be challenging. With a quick Google search, one can see the numerous resources available to assist site owners. Plugins that promise to make the process easier, companies that will transfer WordPress installations for a fee, instructional YouTube videos, and many how-to guides. I have found that moving WordPress to a new provider may seem overwhelming but isn’t too difficult. Here is how I moved a small site of mine from HostGator to Linode

Why move from HostGator to Linode?

I’ve been an off and on again customer of HostGator for the past ten years. They have been my go-to company if I needed cheap and reliable web hosting. Recently however I have been thinking about moving all of my sites to a VPS (Virtual Private Server). I’m a geek, and I like to tinker with things, shared hosting accounts don’t allow for that. VPS solutions fall in-between shared web hosting and dedicated servers. It’s exactly what it sounds like, a virtual private server. You get root access to your VPS just like a dedicated server, so you have full control. The difference is the server is virtual so the physical machine housing your VPS is also housing many other virtual servers. This allows for a lower cost to the consumer when compared to a dedicated solution. So I started the hunt for VPS provider. I was looking for a company that met the following criteria.

  • Competitively priced
  • Excellent (and professional) customer support
  • Easily scaleable
  • Outstanding uptime
  • Included cPanel or at least supported it

Enter Linode Cloud Hosting. Wait, you just said you wanted a VPS solution. What is Cloud Hosting? This is a great question and if you asked 10 different people to define cloud hosting, you may end up with 12 different explanations. I’m not going to add a 13th but will summarize with this. Linode Cloud Hosting provides VPS solutions in the cloud. Cloud hosting comes with two important benefits, scalability, and reliability. These are two of the five criteria in my quest for a new hosting provider. Leaving three left, pricing, cPanel support, and customer service.

With HostGator, I was paying $7.99/month for their smallest shared hosting package. This package allowed for only one domain but had “unlimited” storage space and bandwidth. Unlimited storage and bandwidth when it comes to web hosting is a marketing gimmick, in my opinion. I would prefer to know exactly what my available resources are. Since I’ve decided I want a VPS hosting solution lets compare VPS pricing of the smallest VPS package from HostGator and Linode.

table
Clearly, there is a bit of a price difference. To use cPanel with Linode I am going to need to purchase a license which is $13.00/month (more on this later). So really the total monthly cost to switch to Linode with backups is $25.50. The big question I had to ask myself was “Can I manage my own VPS, or do I need my provider to manage it for me?” For the few small sites I have, I think I can self-manage my VPS. Depending on your technical ability you may need a managed VPS solution. If I was consulting with a client that had a business site, I would recommend a managed solution. If you think you needed a managed VPS solution check out Site5 or HostGator VPS. For the most part, this WordPress migration guide will apply to any provider.

Preparing to migrate WordPress to Linode

This by far is the most important step when transferring WordPress from one host to another. I cannot stress this enough, back up your current WordPress installation. My preference is to update WordPress to the latest version and update all of my plugins before moving to a new provider. Because of this I actually do two backups.

Backup #1 = A current copy of my website
Backup #2 = A backup of my website after all updates have been applied

If you do not wish to upgrade to the latest version of WordPress be sure to install the same version on your Linode server. If you are already running the latest version, there is no need for two backups.

The site I am going to be moving today is http://www.easyslowcook.com. I am a huge fan of slow cooking and sometimes I will share a good recipe. So let’s get started.

1. Turn off PermalinksUnder “Settings” find “Permalinks” and select the Default option and save the changes.

permalinks
2. Back up content files

You will need a FTP program to do this. I highly recommend FireZilla and it works on all major platforms. Point your browser to https://filezilla-project.org and click “Download FileZilla Client”. Once the download finishes double-click the installation file and follow the onscreen instructions to complete the installation.

Launch FileZilla and you should see a window that looks similar to this.

filezilla
**Tip: The left side or local site is the file browser for your computer. The right side or remote site is the file browser for the server you are connected to.

As you can see I created a new directory called Migration. This is where I will store all files for the site migration.  Use the file browser on the left side of the screen and locate a logical place to create your own directory. Once you have found where you want to create the directory, right click and select “Create Directory”.

Now let’s start downloading some files. Enter your FTP login credentials at the top and click quick connect. If you successfully connect you should see the file manager of the remote site populate with directories and files. Locate the directory public_html, this is the directory that houses everything that is accessible on your website.

filezilla2

Generally speaking, people have one of two setups for WordPress.

Example 1: http://www.mydomain.com – Opening this address for your domain brings you right to your WordPress installation.

Example 2: http://www.mydomain.com/blog – Opening this address brings you to your WordPress installation. Here you have installed WordPress in a directory under your top level directory.

If your setup resembles Example 1, right click on public_html and select download. If your setup resembles Example 2, left click on public_html and navigate until you find the directory housing your WordPress files. Once you find it, right-click and download that directory. Once the download completes rename the directory with a naming convention that makes sense to you. I usually go with domain.com-provider-backup#.

filezilla3

3. Backup the WordPress database

Now lets backup that ever so important database. Log into cPanel and look for the phpMyAdmin icon, click it.

cpanel

In phpMyAdmin click Databases.

phpadmin

Select the Database for your WordPress installation.

phpadmin2

Now click Export (1), Go (2), and your database backup will download (3).

phpadmin3

Once the download is complete, move the database backup file to the migration project directory we downloaded the previous files to. If you are not updating WordPress or any plugins you can head on down to the next step.

Now update your WordPress installation and all plugins that have an update available. WordPress 2.7 introduced one-click updates, which made upgrading extremely easy. So I’m not going to go into details on how to upgrade WordPress. If you are not familiar with the process head over to wpbeginner, they have a good tutorial.

After updating WordPress do another backup, this is the backup we will be using for the migration. Your migration directory should look like this if you did two backups.

finder

easyslow_wordpress1.sql = Database backup prior to WordPress & WordPress plugin update
easyslow_wordpress2.sql = Database backup after WordPress & WordPress plugin update

easyslowcook.com-hostgator-backup1 = Backup of public_html directory prior to WordPress & WordPress plugin update
easyslowcook.com-hostgator-backup2 = Backup of public_html directory after WordPress & WordPress plugin update

Now that we have everything backed up lets start the fun part of the process.

Signing up For Linode

Head over to Linode by clicking here. In the upper right-hand corner of the page click Sign Up. Proceed in creating your Linode account. You will also need to verify your e-mail address and create a billing profile. When creating your billing profile you will be asked to preload your account. Preloading your account with $20 will cover the expense of the Linode 1GB plan for two months. Now you will need to select your plan and the location for your VPS.

pricing

You probably have an idea of what size Linode your site requires. If not, take a guess. You can easily upgrade/downgrade your account later. As for location, pick one that makes geographic sense to your user base. Example, if 75% of your visitors are from Europe it would be best picking the London, UK option. I am running my Linode from their Dallas, TX location and the uptime and speed has been outstanding.

Initializing your Linode

Your Linode manager should look similar to this.

linode
If you plan to use the Linode backup system, now would be a good time to enable that option. Remember there is an additional cost for using Linode Backups, which is explained after you click Enable.

Now click Dashboard and you will be brought to the control center for your new Linode. Click “Deploy a Linux Distribution”.

dashboard1
Select CentOS 6.5 for the distribution and Deployment Disk Size and Swap Disk should populate with default values, leave them as is. Type in your root password and click Deploy.

**Tip: Write down your root password. Save yourself the hassle of resetting it in case you forget it.

dashboard2

Now you have your Linode initialized. Time to boot it up and install some software.

Purchasing WHM/cPanel License

WHM/cPanel makes it fairly easy to manage a VPS. You will need to purchase a license before continuing. You can purchase directly from cPanel($20/month) or buy from a reseller. After doing some research I decided to buy my license from buycpanel.com. They sell the cPanel/WHM VPS Optimized license for $14.95/month. With a coupon code applied at checkout, it comes to $13.00/month and comes with a few freebies.

Coupon Code: whtvps13 Price: $13.00/month

Includes a FREE WHMxtra License!
Includes a FREE Attracta SEO tools License!
Includes a FREE Resource Monitor License!
Includes a FREE Spam Scan License!

When purchasing your cPanel license you are going to need the server hostname and IP address. You can find this in your Linode manager under the Remote Access tab.

remote1

#1 is your server hostname
#2 is your server IP address

Within a few minutes of placing your order, you will receive your license confirmation e-mail from buycpanel.com. In the mean time you can proceed with the installation of WHM/cPanel.

Installing WHM/cPanel

Log into your Linode Manager, click on your Linode which should bring you to the Dashboard view. Click Boot.

boot
Now log into your server with Terminal. Click the Remote Access tab in your Linode Manager. Next to SSH Access you should see the command you paste right into terminal.

ssh root@YOURSERVERIP

*On your first log in you will be prompted about the authenticity of the host and if you would like to continue, type yes.

Once you are logged in switch to the home directory.

cd ../home

Now fetch the latest installation files from the cpanel servers.

wget -N http://httpupdate.cpanel.net/latest

Now start the installation by running the following command (installation takes around 60 minutes).

sh latest

**Tip If you receive an error about not having a fully qualified domain name this is an easy fix and you can change it later.

hostname [enter hostname found in screenshot above]

Example:

hostname li836-64.members.linode.com

When complete you should see a screen similar to this.

terminal
Once you receive an e-mail from buycpanel.com notifying you that your order is complete you should run this command in terminal.

/usr/local/cpanel/cpkeyclt

You can then go to http://verify.cpanel.net/ to confirm your WHM/cPanel installation is licensed correctly.

Enter your VPS IP address and you should see output similar to this.

vps

Let’s test your WHM installation. Open up https://YOURIP:2087/ in your favorite browser. You should be prompted for a username and password. Enter root for the username and the password you set earlier in the process.

whm
Now you will be guided through the WHM Initial Setup. I am not going to go into great detail here. Linode has a thorough document on this process which can be found here.
Step 1 Agreement – Click I Agree
Step 2(a) Networking Enter your e-mail address and any additional ways you wanted to be contacted.
Step 2(b) NetworkingServer hostname – This must be set to a valid fully qualified domain. This is found in the Linode Manager under Remote Access (#1).

 

networkaccess
Step 2(b) NetworkingResolvers – These can also be found on the Remote Access tab (#2)
Step 2(b) NetworkingMain Network/Ethernet Device = eth0
Step 3 IP Addresses – You will see your IP listed under Current IP Addresses. You can click “Skip This Step and Use Default Settings”
Step 4 NameserversI prefer to use the nameservers provided by Linode. Click disabled. Below enter the following nameservers.

[well]ns1.linode.com
ns2.linode.com
ns3.linode.com
ns4.linode.com[/well]

After entering those click “Save & Go to Step 5”

Step 5(a) Services – Linode recommends disabling FTP, I went with Pure-FTPD as I need to read up on SFTP before making the switch.
Step 5(b) Mail – Dovecot is the recommended option. Leave Convert Mailbox Format Checked
Step 5(c) cPHulk – Enabled with Extend account lockout time upon additional authentication failures checked.

Click “Save and Go To Step 6”

Step 6 QuotasI enabled using file system quotas. If you have no need to track disk usage on a per-user basis you can disable this.

Click Finish

On the next screen you will be prompted for additional options and add-ons. Read them over and select the ones you want.

Congratulations! You now have your Linode VPS server setup with WHM/cPanel successfully installed. 🙂

You are going to want to read up on all of the options available in WHM. cPanel has a pretty good collection of documentation found here. But for now lets setup your first site.

Setting up your WordPress site in WHM

In WHM scroll down on the left until you see “Create a New Account”

Fill in the Domain Information

domain
Under Package

Check “Select Options Manually”A window “Manual Resource Options” will appear. Feel free to leave the defaults or set limits.Leave defaults under “Settings”Under DNS Settings leave everything unchecked. Mail Routing Settings Select “Local Mail Exchanger”

Hit Create and you should see output and at the bottom “Account Creation Complete!!!”

You now have your account created on your new Linode VPS.

Update Domain Nameserver Information

This will be different for everyone, depending on your registrar.  Ultimately you want to find the Nameserver settings for your domain. Your new nameservers are:

[well]NS1.LINODE.COM
NS2.LINODE.COM
NS3.LINODE.COM
NS4.LINODE.COM[/well]

Submit these changes. It may take hours for these changes to propogate.

Adding DNS Zone in Linode DNS Manager

Log back into the Linode Manager. In case you forgot here you go.

Click “DNS Manager” Click “Add a domain zone”

domain2
Enter your domain and enter your contact e-mail address and click “Add a Master Zone”

You will now see the zone information or your domain. Linode has included a few of the defaults like www and mail for example. If you set up your server with FTP you will need to add that. So let’s do that now.

Scroll down until you see the A/AAAA Records

domain3
Copy and paste the IPv4 and IPv6 addresses to Notepad. You are going to need them in a minute. After you do that click “Add a new A record”.

Enter ftp into Hostname and the IPv4 address you copied a moment ago. Click Save. Repeat the process for the IPv6 address.

ftp

That’s it, now your domain is ready on your new Linode server.

Installing WordPress on your new Linode Server

I’m going to assume everyone reading this knows how to install WordPress. If not here is a quick overview.

1. Download the latest version of WordPress (or the version you were using on your old host if you chose not to upgrade)

2. FTP to your Linode server. You will probably need to use the IP address since the DNS changes may not have propagated yet. You will find the IP address, domain username, and domain password in the account creation e-mail you received a bit ago.

3. Upload the WordPress files to the root directory (or subdirectory) on your Linode server. Again this depends on how you previously had your WordPress setup.  Ex. My WordPress site is www.easyslowcook.com so I upload wordpress files directly to public_html.  Ex. My WordPress site is www.easyslowcook.com/blog so I create a directory “blog” under public_html and upload the files there.

4. Log into cPanel and find MySQL Database Wizard

dbs

5. Follow the MySQL Database Wizard and create a new user, password and database. Write this information down you will need it later. When you get to the privileges screen select all privileges. You should see a screen similar to this when you are done.

dbs2

6. Now install WordPress. Open your browser to http://IPADDRESS/~username/  and you should see the WordPress installation screen. Like this.

install
Continue with the WordPress installation screens. When you reach the Database Settings fill it in with the information you created in step 5.

install2

You should see one more screen, fill in the information required.

welcome

Click Install and your WordPress installation has now been completed on your Linode Server. One last step!

Restore previous database and content files

Remember that Migration directory you created on your local machine? Now you are going to need it. Open up FileZilla and connect to your Linode server. Browse until you see the wp-content directory on the left (local) side of FileZilla. On the right (remote) side of FileZilla do the same thing.

upload1
Drag the wp-content folder from the left side to the right side. You will get prompted “Target file already exists.” To avoid seeing this for each file select Overwrite, Always use this action, and Apply to current queue only and click okay.

upload2

While your content files are being uploaded. Let’s restore that database.

Log back into cPanel on your Linode server and access phpMyAdmin.

Select the Database you created a few minutes ago, select “Check All” and in the drop down menu select Drop.

padmin1
You will get asking if you really want to execute this command? Click Yes.

Now we are going to Import your old database. Click Import at the top and browse to your Migration directory and select the database file you saved at the start of the migration. Click Go.

padmin2

Depending on the size of your database this may take a while.

By now your DNS changes should have propagated. You can check this by opening terminal and pinging your site.

In terminal

ping www.yourdomain.com

If it returns your Linode IP you are good to go. If it returns the IP from your old host you have to wait a bit. Once you start seeing your Linode IP time to finish the last step!Log into administration section of your wordpress site.

http://www.yourdomain.com/wp-admin/

Click Settings (left menu)
Click Permalinks -> Restore Permalinks to previous setting.

All done!

Final Thoughts / Resources

Now that you are managing your own VPS it would be advisable to read up on WHM/Cpanel documentation.

Documentation: https://documentation.cpanel.net/pages/viewpage.action?pageId=360752

Forums: http://forums.cpanel.net/

Linode also has good documentation and forums.

Documentation: https://www.linode.com/docs

Forums: https://forum.linode.com/

If you have any questions please feel free to leave them in the comments. Or contact me on twitter @zachgeek or via e-mail.

This post contains referral links. I am still paying off those student loans.

2 comments On Migrating WordPress to Linode

Leave a reply:

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Site Footer