Migrate to a new server

CentOS Oct 28, 2018
Please note, that the following will handle native server installations. To keep changes documented, persistent and reproducible, introduce a configuration management tool. You might also take a look into containerized environments.

In this article I want to give a checklist for a server switch. Please BACKUP your whole system to prevent data loss.

Checklist

  • At your Domain Registrar you have to provide the address/domain of your DNS-Server. The DNS-Server stores your DNS domain information (including which IP is serving the content for a domain). Every entry contains a TTL (time to live) value. This is the amount of seconds until a client will request the DNS-Server again. Otherwise it will use the cached information. Decrease this time to be able to switch your IP for your domain nearly immediately.
  • If you are running a LAMP/LEMP software stack, the setup should be migrated. This contains the webserver (Apache/Nginx), the database (MySQL) and the binaries of the programming language PHP.
  • After installing the database management system MySQL, it is time to configure it. One important step could be to set the default collection to general_ci and avoid large binary files.
    Don't forget to import all data to your new system. If you are running a service with high data change rate your are not able to export and import without data loss and downtime. One option is to create a replicated system.
  • Check all of your open ports on your VPS. All ports should be opened on your new system as well. At this point, you can check if every port is really needed. If not, close it to prevent attacks.
  • If you are protecting your system with Fail2Ban (or something similar), copy your rules and register it as a service to let it run automatically on start up.
  • A log file contains interactions with your applications. This file can get very large and unhandy. It is a best practice to rotate these files. To configure the integrated Logrotation daemon, you can read my article: https://readfromfile.com/change-http-log-rotation/. Your configuration files should be copied to the new system.
  • Another frequently used daemon is the crontab. This executes every commands on a configured time. List all your cron jobs and transfer these to your new VPS.
  • The opt folder contains installed third-party applications you installed. Install and configure the required applications on your new system.
  • Before deleting your data, have a look to your PATH variable. This should be considered as well.
  • Install certbot and configure all domain certificates. If this is set, you now should be able to change the DNS entry and point to the new VPS. If everything works, the TTL can be increased again.

Credits:

Tags

Stefan

Howdy! I'm Stefan and I am the main author of this blog. If you want know more, you can check out the 'About me' page.

Impressum | Data Privacy Policy | Disclaimer
Copyright: The content is copyrighted and may not be reproduced on other websites without permission.