Concept Page - Using Vagrant On Your Personal Computer - Holberton Intranet PDF
Concept Page - Using Vagrant On Your Personal Computer - Holberton Intranet PDF
(/)
You are currently observing these locations: CAL, BAR
Change
Edit (/concepts/81/edit)
We won’t go into the details of Virtual Machines, but as their name tells, they are Virtual “Computers” that will
emulate everything from the CPU to the RAM and Disk. Virtual Machines in the context of development are a
means to isolate and maintain a stable environment that will basically run the same way on any host (any
computer). This way, you can have any software installed on your Windows, MacOS, or whatever Linux
distribution; your Virtual Machine will run its own environment, have its own programs, with their own versions,
etc.
Using virtual environments prevents developers from saying “I don’t understand, it works on my machine …”.
Here at Holberton, we want to make sure that you have access to the same environment that will be used to
correct your work (the Checker).
The tools
https://intranet.hbtn.io/concepts/81 1/7
9/4/2020 Concept page: Using Vagrant on your personal computer | Holberton Intranet
There are multiple tools out there that can help you create and manage virtual environments (notice that we
use the term “virtual environment” here, as such environemnt is not necessarily a VM. Technologies using
containerization allow one to manage virtual environments as well).
We are using two tools at Holberton: VirtualBox and Vagrant.
VirtualBox is a Virtual Machine provider. The virtual machines themselves will be spawned using VirtualBox.
VirtualBox is free and lightweight, which make it a perfect choice for us.
Vagrant is a tool that sits on top of a VM provider. Again, we chose to use VirtualBox as a provider, but other
providers exist out there and Vagrant offers the possibilty to use dfferent providers (More info here
(/rltoken/NE5_Totzx3-CcQwy4rAcWw)). Just like VirtualBox, we choose to use Vagrant because it is free,
reliable and well maintained. Keep in mind that the purpose here is to use Virtual environments, and both
VirtualBox and Vagrant are just means to achieve this purpose.
Alternatives
As mentioned previously, using VirtualBox and Vagrant at Holberton doesn’t mean that all companies are going
to work exactly the same way. Different tools are used, as well as different development workflows. We want
you to understand how important it is to isolate your development environment from any host machine,
whether it’s your personal computer or one of the school’s computers.
Here are some examples of other softwares out there that are widely used to manage virtual environments:
Containerization is a very good and efficient alternative to VMs for development environments
Containers are much more lightweight than VMs, thus much faster to start and stop.
The inconvinience of containers is that they sit on top of your OS. Unlike virtual machines, they
don’t emulate the hardware, but rather share your machine’s hardware. We won’t go into the
details of how containerization works, but to keep it simple, that means that if you run MacOS, it is
not possible to run a Linux or Windows container. (Docker makes it work using VMs).
More info here (/rltoken/FuuPyzv_RLg8FMBlxgttqg)
Conclusion
VirtualBox and Vagrant together allow you to manage and ship isolated development environments. Those
isolated environments in the context of Holberton (and in the future, in the context of a company) allow you to
match the environment we use to automatically check your work.
Although both VirtualBox and Vagrant are widely used in the industry, it doesn’t mean it is the only means to
achieve virtualization, and other tools exist with their pros and cons.
Mac OSx
Download VirtualBox from this link (/rltoken/Z2roTuyhhdPF0CnohrZQIw)
Install VirtualBox
Download Vagrant from this link (/rltoken/0WSgWVLsNmTFDTgwy1Xg1Q)
Install Vagrant
Open the Terminal application:
Now you will execute command line in your Terminal (each of them start with $ )
Add the Ubuntu 14.04 (Trusty) image to your box list: $ vagrant box add ubuntu/trusty64
Warning: this step can take time
Many other images are available here (/rltoken/N_ri6jJCX0OOBF-xaKjrgw)
Create your first virtual machine:
$ vagrant init ubuntu/trusty64 -> it will generate a Vagrantfile with base = "ubuntu/trusty64"
- you don’t have to execute this command line everyday, only once, to create a new virtual
machine
https://intranet.hbtn.io/concepts/81 3/7
9/4/2020 Concept page: Using Vagrant on your personal computer | Holberton Intranet
$ vagrant ssh -> now you are inside your virtual machine.
Windows
https://intranet.hbtn.io/concepts/81 4/7
9/4/2020 Concept page: Using Vagrant on your personal computer | Holberton Intranet
C:\Users\julien> vagrant box add ubuntu/trusty64 Warning: this step can take time
Many other images are available here (/rltoken/N_ri6jJCX0OOBF-xaKjrgw)
C:\Users\julien> vagrant init ubuntu/trusty64 -> it will generate a Vagrantfile with base =
"ubuntu/trusty64" -you don’t have to execute this command line everyday, only once, to create a
new virtual machine
https://intranet.hbtn.io/concepts/81 5/7
9/4/2020 Concept page: Using Vagrant on your personal computer | Holberton Intranet
C:\Users\julien> vagrant ssh -> now you are inside your virtual machine.
Ubuntu 16.04
Open the Terminal application:
Now you will execute command line in your Terminal (each of them start with $ )
Install VirtualBox: $ sudo apt-get install virtualbox
Install Vagrant: ` $ sudo apt-get install vagrant
Add the Ubuntu 16.04 (Xenial) image to your box list: $ vagrant box add ubuntu/xenialy64 Warning:
this step can take time
$ vagrant init ubuntu/xenial64 -> it will generate a Vagrantfile with base = "ubuntu/xenial64"
- you don’t have to execute this command line everyday, only once, to create a new virtual
machine
$ vagrant up -> it will start your virtual machine
$ vagrant ssh -> now you are inside your virtual machine.
Ubuntu 14.04
Open the Terminal application:
Now you will execute command line in your Terminal (each of them start with $ )
Install VirtualBox: $ sudo apt-get install virtualbox
Install Vagrant: $ sudo apt-get install vagrant
Add the Ubuntu 14.04 (Trusty) image to your box list: $ vagrant box add ubuntu/trusty64
https://atlas.hashicorp.com/ubuntu/boxes/trusty64/versions/14.04/providers/virtualbox.box
Warning: this step can take time
https://intranet.hbtn.io/concepts/81 6/7
9/4/2020 Concept page: Using Vagrant on your personal computer | Holberton Intranet
$ vagrant init ubuntu/trusty64 -> it will generate a Vagrantfile with base = "ubuntu/trusty64"
- you don’t have to execute this command line everyday, only once, to create a new virtual
machine
$ vagrant up -> it will start your virtual machine
$ vagrant ssh -> now you are inside your virtual machine.
Admin corner
Edit (/concepts/81/edit)
https://intranet.hbtn.io/concepts/81 7/7