23.9 C
Guru Unix /Linux and GNU supporter

Install Vagrant in Ubuntu 18/Mint 19

Vagrant is an very strong open source command line tool for building and managing virtual machine environments. Vagrant can provision machines on top of VirtualBox, Hyper-V and Docker. Vagrna propose paid plugin solution for Libvirt (KVM), VMware and AWS. i wish to  show  in this tutorial how to use Vagrant with Virtualbox.

1- Install  Virtualbox in Ubuntu 18 of Mint 19

there is an easy way to install virtualbox without adding new PPA repos of adding new sources to source.lis file

just do

apt install virtualbox
- Advertisement -

For GUI  interface to manage the guests do

apt install virtualbox-qt


You can reboot and check if everything is Ok.

2-Install   Vagrant

2-1-Check Vagrant installed version

root@osradar-mint:~# vagrant --version
Vagrant 2.0.2

3-Lets  Start with Vagrant .

We can create an separated directory for projects like /home/projects

mkdir /home/projects
cd  /home/projects

Here is the link to discover all  Vagrant Boxes

4-Vagrant  options

To see  all about Vagrant  options. just type vagrant comand.

For CentOS
# vagrant init centos/7
For Ubuntu
# vagrant init ubuntu/bionic64
For Archlinux
#vagrant init archlinux/archlinux

5-Let’s try archlinux 


create project under /home/projects/archlnux 
mkdir /home/projects/archlinux; cd /home/projects/archlinux
root@osradar-mint:/home/projects/archlinux# vagrant init archlinux/archlinux
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 download the condif  file to  /home/projects/archlinux called  Vagrantfile . you can edit the file for a specific  settings   . else  just   start  the with standard configuration

root@osradar-mint:/home/projects# vagrant up
Bringing machine 'default' up with 'virtualbox' provider...
==> default: Box 'archlinux/archlinux' could not be found. Attempting to find and install...
default: Box Provider: virtualbox
default: Box Version: >= 0
==> default: Loading metadata for box 'archlinux/archlinux'
default: URL: https://vagrantcloud.com/archlinux/archlinux
==> default: Adding box 'archlinux/archlinux' (v2018.12.05) for provider: virtualbox
default: Downloading: https://vagrantcloud.com/archlinux/boxes/archlinux/versions/2018.12.05/providers/virtualbox.box
==> default: Successfully added box 'archlinux/archlinux' (v2018.12.05) for 'virtualbox'!
==> default: Importing base box 'archlinux/archlinux'...
Progress: 20%

Connect to Vagrant Virtual Machine

because of the  ssh generated  keys, you can login to the vagrant box  without password, just do :

#vagrant ssh

To Stop the virtual machine

#vagrant halt

Destro the Virtual machine  with vagrant destroy

root@osradar-mint:/home/projects/archlinux# vagrant destroy
default: Are you sure you want to destroy the 'default' VM? [y/N] y
==> default: Destroying VM and associated drives...

Please   Share

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
"The best Linux newsletter on the web"


Please enter your comment!
Please enter your name here

Latest article