This quick tutorial covers how to uninstall Vagrant on Ubuntu 16.04. This is useful for those who want to remove Vagrant from their machines or simply want to upgrade to the new version of Vagrant.
1. Overview
First of all, there are several ways to install Vagrant on Ubuntu such as: using apt-get or downloading and installing the Vagrant binary package from Vagrant site; therefore, we have to select the proper way to uninstall Vagrant. In this article, we will get through the uninstallation for both of above ways. You can find relevant information about install Vagrant on Ubuntu via this tutorial: Install Vagrant on Ubuntu 16.04 LTS (Xenial Xerus)
2. Uninstall Vagrant on Ubuntu 16.04
2.1. Using apt-get
This part is used for those who installed Vagrant by using apt-get command. So, we will use the apt-get command to uninstall Vagrant on Ubuntu.
2.1. To uninstall only Vagrant
1 |
sudo apt-get remove vagrant |
2.2. To uninstall Vagrant and its dependencies
1 |
sudo apt-get remove --auto-remove vagrant |
2.2. Using dpkg package manager
This way is used for those who installed Vagrant by downloading the Vagrant package from its site and install manually using dpkg, a package manager for Debian-based systems.
To uninstall Vagrant on Ubuntu, we simply need to execute the below command:
1 |
sudo dpkg -r vagrant |
3. Remove user data
Removing the user data will remove all boxes, plugin and any stored state that may be used by Vagrant. Moreover, removing user data is safe because Vagrant can regenerate any data necessary to run if we reinstall it.
To remove the user data, we can remove the ~/.vagrant.d directory as below:
1 |
rm -r ~/.vagrant.d |
4. Summary
We have gotten through 2 options to uninstall Vagrant on Ubuntu 16.04. Before proceeding the installation, just need to make sure which way is a correct way. After that is to remove the user data. Finally, there are several related articles for your references:
Install Vagrant on Ubuntu 16.04 LTS (Xenial Xerus)
Running Vagrant SSH on Windows
How to Add a Vagrant Box from Local or Remote