Monday, October 10, 2016

How to install and use Vagrant on Lubuntu

Vagrant is tool for creating virtual development environment, basically vagrant is a wrapper around virtual machine such as virtual box, VMware, KVM, AWS, Docker, etc.

If you are a devops or someone who responsible in operation of software development, you need to learn about vagrant, and this tutorial is about installing and learning vagrant.

Installing vagrant on lubuntu
Alright, let's start with installing vagrant on lubuntu, installing vagrant on lubuntu is pretty easy, you just run command apt-get install vagrant, and you are good to go.

sudo apt-get install vagrant

Vagrant is a wrapper around virtual machine, therefore we need to have virtual machine as well on our lubuntu, my recommendation is virtual box, since it's support natively by vagrant.

sudo apt-get install virtualbox

How to use vagrant on lubuntu
Now that we have everything we need for running vagrant, let's create a directory for storing the vagrant file, let's called it 'my_first_vagrant'.

mkdir my_first_vagrant
cd my_first_vagrant

Next, we need to create a vagrant file, by running vagrant init command, it will create a vargant file which you can configure however you want. You can also specify what operating system you wish to use, for example let's just create a ubuntu trusty 64 bit.

vagrant init ubuntu/trusty64

The command above will create a Vagrantfile which you can take a look what's inside, basically it's a configuration file for your vagrant box, at this point the virtual machine is not created yet, we need to run command vagrant up.

vagrant up

Vagrant up will look for vagrant box, if not found it will download from the server, in this case it will download ubuntu trusty 64 bit. After the download finish, you can see the information about where you can connect to the virtual machine via ssh.

Some vagrant commands that you should know:
vagrant up
vagrant reload
vagrant halt
vagrant status
vagrant suspend
vagrant resume

No comments:

Post a Comment