Vagrant is an open source software product for creating and managing portable virtual software development environments. For example: VirtualBox, KVM, Hyper-V, Docker Containers, VMware, Parallels, and AWS. In addition, it attempts to simplify software configuration management for virtualization to increase development productivity. Vagrant is written in the Ruby language, but its ecosystem supports development in several other languages.Similar to Docker images, there are pre-built Vagrant boxes for various use case’s. Furthermore you can also create a basic box and add your own configurations as required. This guide will show you how to install Vagrant on your Ubuntu 20.04 system.
- 99RDP Dedicated Server(running ubuntu 20.04)
- Access To Terminal
Steps To Install Vagrant On Ubuntu 20.04
Let’s get started by updating the current software packages and repo list using the given command.
# apt upgrade && apt upgrade -y
After the update is finished, we need to install Virtualbox in order to manage our virtual operating system. Virtualbox is a piece of software that allows you to run an operating system within an operating system. In this case we will use VirtualBox, which uses Vagrant to provision virtual machines. To start the Virtualbox installation run the given command in terminal.
# apt install virtualbox -y
Once the installation is finished, head to Vagrant’s official download page and copy the link to the latest version and download it in your Ubuntu system using the wget command.
# wget http://archive.ubuntu.com/ubuntu/pool/universe/v/vagrant/vagrant_2.2.6+dfsg-2ubuntu1_all.deb
After downloading the package we can install it using the apt command.
# apt-get install vagrant
This will start the installation process, once it is finished we can verify the installation using the version command.
# vagrant –version
The output will display the installed version of Vagrant.
Deploying Vagrant On Ubuntu 20.04
After successfully installing the package we can start creating our first virtual environment. Lets make a directory test for our virtual enviroment.
# mkdir test
# cd test
Next, we will initialize a new Vagrantfile by specifying the box to use with the vagrant init command. A box is a packaging format for the Vagrant environment and is vendor-specific. See the Vagrant Box catalog page for a list of publicly available Vagrant boxes. In this guide we will use a CentOs 7 box.
# vagrant init centos/7
[email protected]:~/test# vagrant init centos/7 A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant.
This will create a vagrant file which will setup a centOs 7 vagrant box. A Vagrantfile is a Ruby file that describes how to configure and deploy a virtual machine. You can open the Vagrantfile, read the comments, and adjust as needed. Following this run the Vagrant up command to create and configure the virtual machine as specified in the Vagrantfile:
# vagrant up
[email protected]:~/test# vagrant up Bringing machine 'default' up with 'virtualbox' provider... ==> default: Box 'centos/7' could not be found. Attempting to find and install... default: Box Provider: virtualbox default: Box Version: >= 0 ==> default: Loading metadata for box 'centos/7' default: URL: https://vagrantcloud.com/centos/7 ==> default: Adding box 'centos/7' (v2004.01) for provider: virtualbox default: Downloading: https://vagrantcloud.com/centos/boxes/7/versions/2004.01/providers/virtualbox.box default: Download redirected to host: cloud.centos.org default: Progress: 12% (Rate: 1174k/s, Estimated time remaining: 0:03:38)
The given command will start creating your virtual operating system by downloading the centos 7 box. You can check the progress of the download at the bottom of the output. Once it is finished you can ssh to your virtual machine by running the given command.
# vagrant ssh
At anytime run the given command to stop the virtual machine.
# vagrant halt
To destroy the virtual machine, run the given command.
# vagrant destroy
In this guide we explained how to install vagrant on ubuntu 20.04. We also learned how to deploy your first virtual machine. Now you can take a step further and start creating your own Vagrant project. Thank You for the time.
Build Vagrant Project With 99RDP Dedicated Server @ $89/m Only.