Skip to main content
06 / How-to · Server · 6.7

Uninstall CloudGround

Remove CloudGround from a server with cgctl uninstall, keeping the sites and their databases, or deleting them too.

Type
How-to guide
Needs
Root on the server · No backup, restore or task that cannot resume running
Version
v0.1.0
Last verified
Unverified

cgctl uninstall removes CloudGround from the server. By default it keeps the sites' files, their databases and every backup; options delete the sites too and remove the packages the installer brought. There is no uninstall from the panel.

See what it would do​

On the server, as root:

bash
cgctl uninstall --plan

It prints every action, one per line, then what will be kept, and changes nothing. Add the same options you will use (--remove-sites, --purge-packages) to see their actions too.

Uninstall and keep the sites​

bash
cgctl uninstall

It lists what it keeps and asks Remove CloudGround? [y/N]. Type y. With --yes it does not ask.

What happens to each part:

WhatWithout optionsWith --remove-sites
CloudGround's services, units, binaries, its nginx, sshd, kernel, log rotation, cron and certbot hook files, the cloudground user, the panel's stateremovedremoved
nginx.conf and the distribution's default siteput back as they wereput back as they were
the sites' files under /srv/siteskept, nothing serves themdeleted
the site users cg-site-<id>kept and locked: they own the filesdeleted, with their groups
the sites' databases and database users, MariaDB and its tuning filekept, MariaDB keeps runningCloudGround's dropped; tuning file removed
the sites' certificates (/etc/letsencrypt/live/<domain>)keptdeleted
certificates you uploaded for a sitemoved to /root/cloudground-uninstall/custom-certsdeleted
backups, in their repositorynever touchednever touched

The kept certificates stop renewing: their renewal used CloudGround's web folder for certificate challenges, which is gone. At the end the uninstall lists them, with the commands to renew one with another web server (certbot certonly --webroot -w <root> --cert-name <domain> -d <domain>) or to remove it (certbot delete --cert-name <domain>).

Uninstall and delete the sites​

bash
cgctl uninstall --remove-sites

It says how many sites and databases it deletes and asks you to type the server's hostname. --yes is not enough here; to confirm without the question, pass the hostname:

bash
cgctl uninstall --remove-sites --confirm <hostname>

<hostname> is what the hostname command prints on the server. A different name changes nothing.

Also remove the packages​

bash
cgctl uninstall --remove-sites --purge-packages

--purge-packages removes, last, the packages the installer installed because they were missing: nginx, certbot and PHP, then the dependencies only they needed (apt's autoremove rule; a package you put on hold stays). It also removes the ondrej/php repository it added and the restic, wp-cli and composer it put in /usr/local/bin, and unloads the AppArmor profiles of the packages it purged.

  • A package that was already on the server before the install is never removed, nor are curl, git, cron and the other base tools.
  • MariaDB is removed only with --remove-sites, and only when it holds no other database. Its data folder /var/lib/mysql stays.

What is kept for you​

Before removing anything, the uninstall copies to /root/cloudground-uninstall/ (root only):

PathContents
state/the panel's database and its key, as they were: a CloudGround of the same or a newer release can read them
backup.envthe backup repository and its password: without them no backup can be read
README.txtwhat the files are, and every repository the panel used
custom-certs/the certificates you uploaded, without --remove-sites
uninstall.logwhat the run did

To list the backups with it:

bash
cd /root/cloudground-uninstall && set -a && . ./backup.env && set +a && restic snapshots

If you uninstall again later, what an earlier uninstall kept is moved into earlier-<date>/, never overwritten.

If it stops half way​

A failing action is reported and the others go on; the command ends with exit 1 and the failures. Fix the cause and run cgctl uninstall again: every action can run again. On a server with nothing of CloudGround's left it says CloudGround is not installed here: nothing to remove.

Next step​

To install CloudGround again, follow the installation tutorial.

Was this page useful?
Edit this page ↗