fbpx

Category: Linux/Unix

The main goal is to reduce the chance of downtime as much as possible and the stress that comes when unexpected things come up.

The key to a successful server migration is proper planning.

It’s good to see the whole picture first and as clearly as possible.

You can’t and should not rush the migration process.

Also it’s good to think about this in advance and not when your server is due for renewal.

Some hosting providers need several weeks or a month's notice before doing the cancellation.

Also it’s good to keep the older server running for some time in case you need to get some files or if the server migration failed or didn’t complete successfully or if the new hosting provider has its own server of issues.

It’s recommended to give yourself between 1 - 4 weeks for this.

In this server migration tutorial we’ll share tips and tricks about what to consider for the migration of your linux server. We primarily use Ubuntu server so if there are any commands to be performed it will be for that platform. Some ideas may also apply for Windows Server migrations.

A server can be responsible for many things/services/apps. The more things a server is responsible for the more complicated the migration would be because everything has to be migrated over. It won’t happen automagically for you.

If you haven’t done it before it’s good to read a bit more about it, if you will do it and/or possibly hire a professional to do it for you or assist you especially if you’re a business person.

What is the server used for?

  • Static Web Site (HTML/PHP) or WordPress Hosting
  • Email Hosting
  • (S)FTP/File server
  • Blog
  • Process payments
  • Self hosted tools (Project Management, etc)

Why Migrate to another server?

  • Your site has outgrown the current server’s resources
  • You need for a cheaper hosting
  • The old server was hacked
  • The old server hardware is outdated and/or slow
  • The old provider is not that reliable
  • The old provider’s network connectivity is not that reliable or fast enough 
  • the old server has an outdated linux server version that may be vulnerable to attacks
  • Not enough disk space
  • Need to move the site closer to clients. e.g. clients are in the EU and the server is in the US or vice versa.
  • Sometimes you just need to start over
  • Maybe you picked a Linux server distribution that didn’t work or support your software
  • You just need a change :)

What’s the very first step to do?

The very first step is to start planning the migration process.

It’s good to put a notice on your site to inform your users that a scheduled migration is about to happen. It’s good to notify clients and whoever might be affected by the migration.

It’s good to pick a date and time when the site is used by fewer people.

For some businesses it’s early in the morning on the weekends.

Your traffic stats will tell you when the server is less busy and what times.

If your business is in the US, hiring a professional from the EU would be a smart move because of the time difference or vice versa.

Write down all the software versions for the follow and stats

  • php
  • MySQL / MariaDB (database)
  • nginx / apache
  • Operating system type & version (e.g. Ubuntu 18 LTS)
  • WordPress & themes & plugins
  • Other (Perl/Python etc)
  • Hardware information - number of processors or vCPUs, RAM, speed etc.
  • Current disk space usage
  • Daily visitors both guests (not logged-in) and users (logged in). This will have to do with site caching. Logged in users will need to see content that's relevant to them for this reason the page can't be fully cached

What to consider when migrating to another server

There are lots of things to consider.

  • Which Hosting Provider to pick
  • Virtual Private Server (VPS) vs Dedicated server
  • Hard drive type: SSD vs SATA
  • Server location - Server in the US or EU
  • RAM Memory
  • What to migrate? Sites, Email, FTP, SSL certificates, Database(s)

Should you pick a VPS or Dedicated server. That’s a valid and very important question. There are several differences which we’ll cover more in depth in another article as the topic is deep.

Which VPS/Dedicated hosting provider should you pick?

Should you go with Linode, DigitalOcean or Vultr?

Those are VPS server providers whose servers are usually unmanaged, which means that they don’t come with a control panel by default and you or somebody else has to keep updating the server software. Some of them allow you to pick a control panel from their marketplace. You can have somebody set it up for you. You can go without a control panel if you have somebody on your team that’s a DevOps person.

We manage about 15 servers. Some of them are dedicated servers and others are VPSs. None of them have control panels for several reasons.

  • We want to control what software the server has 
  • We want to know and control the software and what does so we can troubleshoot more efficiently
  • Apply custom configurations to each server.
  • More resources for main apps. Not using a control panel allows us to use a not so powerful server to host sites with a custom optimized setup e.g. nginx + fpm + caching.
  • Less integration - We have several SaaS apps and it’s less of a problem to worry about or integrate with.
  • No monthly fees. Some popular control panels incur fees. There are some open source ones which do not.

It seems Linode has an offering where they can manage your servers at a monthly cost which is nice.

Every business is different and it has to be evaluated individually and see what’s right for it.

There are cases when it really makes sense to have a control panel such as plesk, cpanel etc.

Virtual Private Server (VPS) vs Dedicated server

What does your app/product or site do?

Does it need a very fast processor to compress files or process videos?

server needs to be. With VPSs you can have several virtual CPU cores which are most likely slower than real CPU cores.

If you decide to go with a dedicated server do make sure you pick several drives in a RAID to make sure that the data will be safe.

How much storage do you need?

Again what does your app/product or site do?

Is the server going to be hosting a dating site which has lots of images and videos?

Then you may need lots of disk storage if that’s the case then you may have to pick a SATA hard drive. Many dedicated server providers started to offer servers with SSD or SATA drives.

Another option is to update the site/product so it processes the files and later uploads them to a remote cloud storage such as Amazon S3 or similar. 

This will require some integration with a 3rd party service provider.

Server location - Server in the US or EU

Another thing to consider is the location of the server. Where should the server be located?

EU, US or in another country?

To answer this question you need to take into account data you will be storing. 

Because of the GDPR maybe you will need to host the data in a country that’s part of the EU.

If you’re doing something for a government then you will most certainly need to host the server in that country.

RAM Memory

Again what does your app/site do?

This will determine how much memory the server needs to have.

The more the better of course if you can afford it.

If your server doesn’t have enough memory the operating system will stop some programs.

We’ve seen such a thing in the log files that it has stopped web or database servers which in turn crashed the site. If it’s the database it may even result in some or all data loss.

What to migrate? Sites, Email, FTP, SSL certificates, Database(s)

This is the perfect time to decide what you will migrate.

The way we set up our servers is that we try to make them for a specific purpose. The servers are so affordable nowadays.
One server could be responsible for the database, another one can be handling the web traffic (apache/nginx).
None of the servers handle emails. We delegate that to the companies that have lots of experience in the field and can detect spam messages from miles away.

Doing the migration

I strongly recommend that 1-3 test migrations are performed before the real migration is done. What do I mean by test migration?

A test migration would be to set up the new server and prepare it as if it were for the real migration but set it up on a subdomain. migration1.example.com which would host your site and everything. This means that all of the files have been copied and database(s) have been imported.

Make sure that you document everything and keep an eye on the error messages in the logs.

Live Migration

DNS changes

It's good to change the expiration/TTL settings in the domain about a day before starting the migration. The TTL time is in seconds and determines how long a DNS record will be cached for by servers. When you lower the TTL value, the changes you make can happen within minutes and not hours/days. This is important because you want the new server to start handling the requests as quickly as possible.

Post Migration Checklist

What should you do after the migration?

Some of you may say that the right answer is beer and that’s almost correct but not yet.

It’s good to update your SPF records which are responsible for how emails should be treated e.g. if a spammer is trying to send an email on your behalf. When you have properly set up SPF records that will help spam filters decide what to do with the email if they should put it into the spam folder right away or flag it as suspicious or allow it to go through.

Keep an eye on the resources

The better you plan the server migration the fewer headaches you’ll have.

Planning is key because there are lots of things to consider.

A server migration is very important because it will provide your customers with faster access to your site/app in the time of an impatient world.

Image credit: Chris Briggs (@cgbriggs19) on Unsplash

Join our mailing list

Get important news about cool products we release and invitations to beta test new products

Find out the Social networks we're on