How To Install python-vagrant on Debian 9

In this tutorial we learn how to install python-vagrant on Debian 9. python-vagrant is Python 2.7 bindings for interacting with Vagrant virtual machines

Introduction

In this tutorial we learn how to install python-vagrant on Debian 9.

What is python-vagrant

python-vagrant is:

python-vagrant is a Python module that provides a thin wrapper around the vagrant command line executable, allowing programmatic control of Vagrant virtual machines (boxes). This project began to create Python bindings for Vagrant to programmatically access vagrant boxes using Fabric. This module is useful for:

  • Starting a Vagrant virtual machine (VM) (up)
  • Terminating a Vagrant VM (destroy)
  • Halting a Vagrant VM without destroying it (halt)
  • Querying the status of a VM or VMs (status)
  • Getting ssh configuration information useful for SSHing into the VM (host, port, …)
  • Running vagrant commands in a multi-VM environment (http://vagrantup.com/v1/docs/multivm.html) by using vm_name parameter
  • Initializing the VM based on a named base box, using init().
  • Adding, Removing, and Listing boxes (box add, box remove, box list)
  • Provisioning VMs - up() accepts options like no_provision, provision, and provision_with, and there is a provision() method
  • Using sandbox mode from the Sahara gem: https://github.com/jedi4ever/sahara

This package is beta and its API is not guaranteed to be stable. The API attempts to be congruent with the vagrant API terminology, to facilitate knowledge transfer for users already familiar with Vagrant. Over time, the python-vagrant API has changed to better match the underling vagrant CLI and to evolve with the changes in that CLI.

The package version numbering is in the form 0.X.Y. The initial 0 reflects the beta nature of this project. The number X is incremented when backwards-incompatible changes occur. The number Y is incremented when backwards-compatible features or bug fixes are added.

This package provides the Python 2.7 module.

There are three methods to install python-vagrant on Debian 9. We can use apt-get, apt and aptitude. In the following sections we will describe each method. You can choose one of them.

Install python-vagrant Using apt-get

Update apt database with apt-get using the following command.

sudo apt-get update

After updating apt database, We can install python-vagrant using apt-get by running the following command:

sudo apt-get -y install python-vagrant

Install python-vagrant Using apt

Update apt database with apt using the following command.

sudo apt update

After updating apt database, We can install python-vagrant using apt by running the following command:

sudo apt -y install python-vagrant

Install python-vagrant Using aptitude

If you want to follow this method, you might need to install aptitude first since aptitude is usually not installed by default on Debian. Update apt database with aptitude using the following command.

sudo aptitude update

After updating apt database, We can install python-vagrant using aptitude by running the following command:

sudo aptitude -y install python-vagrant

How To Uninstall python-vagrant on Debian 9

To uninstall only the python-vagrant package we can use the following command:

sudo apt-get remove python-vagrant

Uninstall python-vagrant And Its Dependencies

To uninstall python-vagrant and its dependencies that are no longer needed by Debian 9, we can use the command below:

sudo apt-get -y autoremove python-vagrant

Remove python-vagrant Configurations and Data

To remove python-vagrant configuration and data from Debian 9 we can use the following command:

sudo apt-get -y purge python-vagrant

Remove python-vagrant configuration, data, and all of its dependencies

We can use the following command to remove python-vagrant configurations, data and all of its dependencies, we can use the following command:

sudo apt-get -y autoremove --purge python-vagrant

Dependencies

python-vagrant have the following dependencies:

References

Summary

In this tutorial we learn how to install python-vagrant package on Debian 9 using different package management tools: apt, apt-get and aptitude.