Debian Linux | How to remove/uninstall Gitlab completely

There are many instructions and tutorials available, providing a step-by-step guidance, on how to install Gitlab on your Linux system. But what if you completely want to remove it from your system? Let me help you out with this:

How to completely remove/uninstall Gitlab

As described by Gitlab you normally install it by extending your sources with the Gitlab repository using the provided script. This extension allows you to use apt-get to install Gitlab as any application. Furthermore this also applies for removing Gitlab. Check out this step-by-step instruction for how to uninstall Gitlab:

1 - Stop the gitlab service

If Gitlab is running you first have to stop its service to correctly remove it later. Use the Gitlab own command to stop the Gitlab service completely. Gitlab will confirm it and shut down with some console output.

Command : sudo gitlab-ctl stop

2 - Self-Uninstall using the Gitlab control script

Gitlab comes with a self-contained uninstall script removing some files, dependencies and services. It will also automatically backup your configuration files and provide them as archive in your home folder. Use the following command to self-uninstall Gitlab. Gitlab will confirm the execution with some console output.

Command : sudo gitlab-ctl uninstall

3 - Delete the package of gitlab

To fully delete Gitlab you have to use the apt-get packaging tool and remove the Gitlab package from your system. If you purge Gitlab from your system you will remove everything. This especially means your configuration files and user data.

Command to fully remove: apt-get purge gitlab-ce

Command to save-remove: apt-get remove gitlab-ce

4 - Remove the remaining files and folders

After removing the gitlab-ce package the system warns you which folder could not be deleted successfully. Normally that should be /opt/gitlab/ , /var/opt/gitlab/ and /var/log/gtitlab . To remove them you have to execute the systems remove command to recursively remove the remaining folders.

Command (may replace the path): rm -rf /org/gitlab/

5 - Remove gitlab from your sources

Gitlab creates a custom source list entry for your machine to seamlessly work with apt-get. You should consider to remove this entry after uninstalling Gitlab. I wrote a short post about this topic here: Remove apt respository sources

6 - Restart your machine

You do not have to but if your system behaves not like usual you should consider to restart. Just in case.

{{ message }}

{{ 'Comments are closed.' | trans }}