How to uninstall Gitlab completly (Tested on Ubuntu 20)

In fact, the following is not in the Gitlab Docs: How to uninstall Gitlab. After some back and forth searching and desperately trying to delete Gitlab via apt purge (which is not a good idea and leaves some processes active) I found an answer I want to share here.

First: If you already tried to delete Gitlab via apt remove or apt prune, just reinstall it and work through those commands.

# Shutdown Gitlab
sudo gitlab-ctl stop

# Remove Gitlab services
sudo gitlab-ctl uninstall

# Clean any data generated by usage of the package
sudo gitlab-ctl cleanse

# Remove any Gitlab accounts on your system
sudo gitlab-ctl remove-accounts

# Then remove the package using
sudo dpkg -P gitlab-ee

# Remove all Gitlab paths
sudo rm -rf /opt/gitlab
sudo rm -rf /etc/gitlab
sudo rm -rf /var/opt/gitlab

# You can also delete the entries from your apt sources
sudo rm /etc/apt/sources.list.d/runner_gitlab-runner.list*
sudo rm /etc/apt/sources.list.d/gitlab_gitlab-ee.list*
sudo rm /etc/apt/sources.list.d/gitlab_gitlab-ce.list*

# Refresh the package sources
apt update

# Restart your system
sudo shutdown -r now

After that you should not see any Gitlab processes anymore. You can use top or htop to view processes of your Ubuntu instance. If you are interested in installing Gitlab, you might be interested in my guide.


Leave a Reply

Your email address will not be published.