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:
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
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:
| What | Without options | With --remove-sites |
|---|---|---|
CloudGround's services, units, binaries, its nginx, sshd, kernel, log rotation, cron and certbot hook files, the cloudground user, the panel's state | removed | removed |
nginx.conf and the distribution's default site | put back as they were | put back as they were |
the sites' files under /srv/sites | kept, nothing serves them | deleted |
the site users cg-site-<id> | kept and locked: they own the files | deleted, with their groups |
| the sites' databases and database users, MariaDB and its tuning file | kept, MariaDB keeps running | CloudGround's dropped; tuning file removed |
the sites' certificates (/etc/letsencrypt/live/<domain>) | kept | deleted |
| certificates you uploaded for a site | moved to /root/cloudground-uninstall/custom-certs | deleted |
| backups, in their repository | never touched | never 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
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:
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
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,cronand the other base tools. - MariaDB is removed only with
--remove-sites, and only when it holds no other database. Its data folder/var/lib/mysqlstays.
What is kept for you
Before removing anything, the uninstall copies to /root/cloudground-uninstall/ (root only):
| Path | Contents |
|---|---|
state/ | the panel's database and its key, as they were: a CloudGround of the same or a newer release can read them |
backup.env | the backup repository and its password: without them no backup can be read |
README.txt | what the files are, and every repository the panel used |
custom-certs/ | the certificates you uploaded, without --remove-sites |
uninstall.log | what the run did |
To list the backups with it:
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.