Link to home
Start Free TrialLog in
Avatar of Jean-François MORFIN
Jean-François MORFINFlag for France

asked on

CentOS simple remote dedicated server transfer to a Debian home machine

I wish to transfer a CentOS dedicated remote server (one perl oriented HTML site plus 100s of research-exploration µ-mediawikis) to a home Debian machine. Is there a simple and reliable typical solution to that?

Avatar of David Favor
David Favor
Flag of United States of America image

Debian != CentOS.

1) CentOS runs a very old Kernel, even most recent CentOS.

2) All your config files will be different in CentOS + Debian.

3) If you require a recent Kernel, use Ubuntu instead of CentOS.

3) And whatever you choose the simple solution... in next comment...
All Distros are roughly the same.

There are many approaches, here's how I do this.

1) Setup Ubuntu + LXD at machine level.

2) Each Site/App/API gets their own LXD container, which makes moving system trivial...

lxc move cname new-machine:new-cname

Open in new window


3) If code is fairly simple + self-contained...

a) Run mysqldump to dump all related databases into the site's DocumentRoot.

b) Then rsync the entire DocumentRoot to new machine (Ubuntu, CentOS, Alpine, whatever).

c) Restore database.

d) Setup HTTPS + HTTP2 + Brotli + bring up site.

4) If machine code has been hacked... er I mean heavily modified by developers for decades, just trying to understand what to move can be near impossible... then the result is a massively unstable or crashing new install.

To handle this type of config I use https://discuss.linuxcontainers.org/t/howto-use-lxd-p2c/3574 which is highly addictive.

The handle lxd-p2c tool clones an entire machine into an LXD container... bit for bit... producing an exact + running replica of the machine.

The only caveat using this tool is to pause any SQL daemon or any other code which maintains any memory state.

By pausing MariaDB/MySQL/Oracle/PostgreSQL/whatever prior to running lxc-p2c this flushes all memory buffers, so once the SQL daemon first restart occurs on the cloned LXD container, the database is congruent.

Missing this step almost always caused data corruption + certainly data loss.

An alternative to... production sites, which can only tolerate a few seconds of outage is to...

a) Run lxd-p2c once.

b) Pause SQL daemons on both source + target machine.

c) The rsync raw files across, for example /var/lib/mysql, for MariaDB/MySQL.

d) Then restart target machine.

In most cases this can be done so only a few seconds of outage time occurs.
ASKER CERTIFIED SOLUTION
Avatar of serialband
serialband
Flag of Ukraine image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Jean-François MORFIN

ASKER

In fact based upon your advices I am engaged into a step by step "a side" rebuild. Mail system, Apache system, MediaWiki system, etc. tuning the new server to an adequate config (config files). Then I plan to take advantage from the acquired experience to develop a "winux" management solution that will be able to carry the job next time and keep the things and my operations running. In the process I discovered the work of investigation on the "smart internet" architecture, that could help me tying together with other winuxers. I will keep this ticket posted of my endeavors.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I have no idea yet of what lxd-p2c may be, but I will learn. I never understood yet how container are actually built: this will be a good occasion of doing it !
Deep thx !
You're welcome!

lxd-p2c docs provides a starting point.

Beware though...

Using lxd-p2c can be addictive, if you have to move old/undocumented physical machines. :-)