3CX cloud/appliance/debian reinstall

Sometimes you may need to reinstall 3CX, but don't want to just recreate a new full machine. You want to re-use the current base machine.
Here is how to reinstall 3CX from scratch:

-Make sure your current 3cx is updated to the latest version.
-Make a full settings backup from within 3cx (if you are changing the licence key, you will need to choose the option to un-include this from the backup or it won't restore while using a new licence). Note: Move the backup, make a copy elsewhere as the current version (15) of 3CX DELETES the default backup folder when it is removed!!
-If you have an FQDN with you 3CX instance and are changing the licence key you will need to log into your 3cx account (customers.3cx.com) and 'release' the FQDN from the current licence key.

Now we are ready to do the uninstall.

SSH to your instance of 3CX, logging in with the user name 'debian'.
I was using OVH and so followed this technote: https://www.3cx.com/docs/connect-ovh-putty/

Now run the following commands:
sudo apt-get purge 3cxpbx
sudo apt-get update
sudo apt-get autoremove

it will Clear everything and you can make any changes you want then

sudo apt-get install 3cxpbx

Once installation has taken place you will get a option in the SSH console to either; configure with web browser, or continue using the CLI.

I choose the Web option.
You will be given a URL to connect to (eg. http://10.x.x.x:5015?V=2)

Choose to restore using the backup from earlier.
Once the backup is choosen, you may need to click 'Previous' if the ilcence key option doesn't pop up, it should then take you back to the licence key entry page.

Continue to finish installing 3CX.

https://www.3cx.com/docs/manual/configuring-your-pbx/