I just finished migrating my webserver and this forum over to a new home and I thought I’d share a quick guide on the steps needed for those doing the same. I wasn’t able to find a thorough guide anywhere online so I thought I’d share the full process of what you need to do.
This will be written with the programs I’m using in mind; Nginx, MariaDB, and Flarum.
If using a different webserver like Apache or a different SQL database other than MariaDB, there may be slight changes, but overall the process should be very similar.
Step 1: Put all your server and config files on a removable storage device.
- Get a flash drive or sd card, whatever you have, and copy all of your config files and server folders to it. I recommend structuring them into the same folders where they are supposed to go so that you don’t forget. This makes it much easier once you’re on the new PC to get everything in the right place, especially if you’re working from a command-line like I was.
Most of your config files should be located in /etc/
ddclient
- /etc/ddclient/ddclient.conf
nginx
- /etc/nginx/… (I copied the entire nginx directory over)
mysql (MariaDB)
- /etc/my.cnf.d/… & /etc/my.cnf (first one is a directory, second one is a separate config file that is loose inside /etc/)
- More importantly for your sql server, you need to migrate your database. This is where all your forum information exists; (discussions, users, settings, etc…). You’ll need to export your database information into an sql file that will later be imported into the new database on the new system. To do this run:
mariadb-dump -u root -p DATABASE_NAME > /path/to/dumpfile.sql
This will export your database into a importable file.
Instead of mariadb-dump
you can also usemysqldump
but this is a deprecated command, so use at your own risk.
php-fpm
- Go to /etc/php/php.ini and write down which Extensions you have uncommented.
Nginx
Lastly, you’ll need to copy your webserver files. Mine are stored in /var/www/…
You should know where these are, just copy the directories over.
Step 2: Get your services running on the new system.
- install and start/enable ddclient (ddclient.service)
- install and start/enable nginx (nginx.service)
- install php and php-fpm and start/enable php-fpm.service
- install and start/enable mariadb (mariadb.service)
Step 3: Update your config and server files.
- Insert your flash drive or sd card and copy over your configuration files:
/etc/ddclient/ddclient.conf
/etc/my.cnf.d/
/etc/my.cnf
/etc/php/php.ini (uncomment those extensions you wrote down earlier)
/etc/nginx/
/var/www/…. (or wherever you want your nginx webserver root directory to be)
Step 4: Clone your Flarum database.
You first need to create a database in MariaDB that you will import your data into. I recommend making the database name and the user/password the same as you had them before, so that you don’t have to update Flarum’s config.php
CREATE DATABASE database-name
GRANT ALL PRIVILEGES on database-name.* to 'username'@'host' IDENTIFIED BY 'password';
Import the data file:
mariadb -u root -p database_name < /path/to/dumpfile.sql
Again, you can substitute mariadb
with mysql
but this is deprecated.
Step 5: Restart your services to reload their configurations
- ddclient.service, php-fpm.service, mariadb.service, nginx.service
- Use
systemctl status
to check them and make sure they are all running properly
Step 6: Open your http and https ports so that your webserver is accessible on the new system
- And don’t forget to disable/stop all those services on the old system if it’s still being used!
- Lastly, if you’re using Flarum, make sure you install
composer
so you can add extensions and update later on.