Table of Contents

How to migrate a (web) server

This guide explains the steps to take when migrating a web server to a new machine and/or a new platform. Most of it will also apply to any other type of server.

Prerequisites

User home directory

  1. Copy folders and files from Pandora
    $ ccalypso /home/user/folder-or-file /home/user/
  2. If the UID on both machines are the same you don't need to update folder and file ownership
  3. You can use the same way for any other folder or file you want to transfer from the old to the new server

Apache 2.4

  1. Install Apache 2.4 and PHP 7/8 on Calypso
  2. Rename folders on Calypso
    $ sudo mv /etc/apache2/conf-available /etc/apache2/conf-available-debian
    $ sudo mv /etc/apache2/conf-enabled /etc/apache2/conf-enabled-debian
    $ sudo mv /etc/apache2/sites-available /etc/apache2/sites-available-debian
    $ sudo mv /etc/apache2/sites-enabled /etc/apache2/sites-enabled-debian
  3. Copy folders from Pandora
    $ ccalypso /etc/apache2/conf-available /etc/apache2/
    $ ccalypso /etc/apache2/conf-enabled /etc/apache2/
    $ ccalypso /etc/apache2/sites-available /etc/apache2/
    $ ccalypso /etc/apache2/sites-enabled /etc/apache2/
  4. On Calypso check and copy selected files back from the debian installed folder to the folder copied from Pandora
  5. If the UID on both machines are the same you don't need to update folder and file ownership
  6. If you have reverse proxies don't forget to update your firewall settings

MariaDB

  1. Install MariaDB 10.5 on Calypso
  2. On Calypso, dump the contents of the mysql database
    $ mysqldump -u user -p --opt mysql > mysql.sql
  3. Stop the mysql service on both machines
    $ sudo service mysql stop
  4. On Calypso, rename the db folder
    $ sudo mv /var/lib/mysql /var/lib/mysql_debian
  5. On Pandora, copy the db folder to Calypso
    $ ccalypso /var/lib/mysql /var/lib/
  6. On Calypso, remove the following folders and files
    $ sudo rm -R /var/lib/mysql/mysql
    $ sudo rm -R /var/lib/mysql/phpmyadmin
    $ sudo rm -R /var/lib/mysql/debian-10.1.flag
  7. On Calypso move the following folders and files back from the mysql_debian folder to the mysql folder copied from Pandora
    $ sudo mv /var/lib/mysql_debian/mysql /var/lib/mysql
    $ sudo mv /var/lib/mysql_debian/aria_log00000001 /var/lib/mysql
    $ sudo mv /var/lib/mysql_debian/aria_log_control /var/lib/mysql
    $ sudo mv /var/lib/mysql_debian/debian-10.5.flag /var/lib/mysql
    $ sudo mv /var/lib/mysql_debian/multi-master.info /var/lib/mysql
    $ sudo mv /var/lib/mysql_debian/mysql_upgrade_info /var/lib/mysql
  8. Remove folder /var/lib/mysql_debian
  9. If the UID on both machines are the same you don't need to update folder and file ownership

System

  1. Check and adjust crontab for all users and root
  2. Check and adjust the sudoers file and all files in /etc/sudoers.d/
  3. Check other machines which depend on the webserver, for example a mail server using Let's Encrypt certificates managed by the web server