Download as pdf
Download as pdf
You are on page 1of 6
1210812028 08:12 ‘Concept: Using Vagrant on your personal computer |ALX Arica Intranet Using Vagrant on your personal computer Why use Virtual Machines? And why Vagrant? We're glad that you're adapting to the Framework! Always ask why! Itis important to ask yoursef: “Why am I not just developing on my computer? | have all the tools I need!”. My machine vs. virtual environments Your computer's environment - whether i's Windows, MacOS or a Linux distribution - will change a lot over time, with or without you noticing. You will install applications, games, tools, ... that will require and install different dependencies and at the end of the day you can end up having completely different behaviors or even have something not work because of software conflicts. We wor'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, atc. Using virtual environments prevents developers from saying “I don’t understand, it works on my machine -~.". Here at School, 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 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 school: 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 too! 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). Just like VirtualBox, we choose to use Vagrant because itis 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 school 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 its to isolate your development environment from any host machine, whether it's hitpssiniranetalxswe.comiconcepts/#1 18 1210812028 08:12 ‘Concept: Using Vagrant on your personal computer |ALX Arica Intranet + The VMWare products © VMWare is one of the biggest virtualization company in the industry. «© Itis safe to say that their tools are among the most reliable. © Onthe other hands, most of their tools come for a price. + Docker © Containerization is a very good and efficient alternative to VMs for development environments © Containers are much mare 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, itis not possible to run a Linux or Windows container. (Docker makes it work using VMs) + More info here: Conclusion VirtualBox and Vagrant together allow you to manage and ship isolated development environments. Those isolated environments in the context of the school (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 itis the only means to achieve virtualization, and other tools exist with their pros and cons. How to install Vagrant on your personal computer: Mac OSx Download VirtualBox from this link Install VirtualBox Download Vagrant from this link Install Vagrant Open the Terminal application: ‘© Now you will execute command line in your Terminal (each of them start with $ ) © Add the Ubuntu 20.04 (Focal) image to your box list: $ vagrant box add ountu/focaisé Warning: this step can take time © Many other images are available here + Create your first virtual machine: © $ vagrant init ubuntu/focalea -> it will generate a Vagrantfile with base = “ubuntu/focalsa” you don't have to execute this command line everyday, only once, to create a hitpssiniranetalxswe.comiconcepts/#1 216 1210812028 08:12 ‘Concept: Using Vagrant on your personal computer |ALX Arica Intranet ° > it will start your virtual machine hitpssiniranetalxswe.comiconcepts/#1 1210812028 08:12 ‘Concept: Using Vagrant on your personal computer |ALX Arica Intranet Windows Download VirtualBox from this link Install VirtualBox Download Vagrant from this link Install Vagrant Open the command prompt ‘Add the Ubuntu 20.04 (Focal) image to your box list: © C:\Users\julien> vagrant box add ubuntu/focalsa Warning: this step can take time © Many other images are available here + Create your first virtual machine: © C:\Users\julien> vagrant init ubuntu/focalsé -> itwill generate a Vagrantfile with base = “ubuntu/focalsa” -you don't have to execute this command line everyday, only once, to create a now virtual machine © C:\Users\julien> vagrant plugin install vagrant-vbguest -> fo avoid issue with the last version of Vagrant (2.2.4 or latest) hitpssiniranatalxswecor 1270612028 08: ‘Concept: Using Vagrant on your personal computer |ALX Arica Intranet Vagrant ssh > now you afe inside your virtual machine. Ubuntu ‘+ Open the Terminal application ‘©. Now you will execute command line in your Terminal (each of them start with $ ) + Install VirtualBox: 0 virtualbox + Install Vagrant: $ intranet alswe.com/concepts/® 1210812028 08:12 ‘Concept: Using Vagrant on your personal computer |ALX Arica Intranet = Twy ade in gee ore erveRaoN Tere + Create your first virtual machine: © $ vagrant init ubuntu/focaléa -> it will generate a Vagrantfile with base = “ubuntu/focalsa" - you don't have to execute this command line everyday, only once, to create a new virtual machine © $ vagrant up +> itwill start your virtual machine © $ vagrant ssh => now you are inside your virtual machine, hitpssiniranetalxswe.comiconcepts/#1 6

You might also like