So you are looking to develop software the right way or at least whatever that means at the point of reading this post 😂. In this post, we would explore the concept of a distributed virtualized development environment, what it means, and how we can achieve it with technology like VirtualBox and Vagrant.
Distributed virtualized development environment
The best way to think about it is like
npm, npm but for your development environment 🤷♀️. So in place of a
package.json file, you would have a
Vagrant file that would describe the operating system of choice, system config like RAM, CPU, System IP, etc. not complicated right 😹?
What is VirtualBox
Head over to the download page and select your platform packages, in this post we would focus on setup for mac users.
After downloading, click on install to follow the process bellow
What is Vagrant
Vagrant is a tool for building and managing virtual machine environments in a single workflow. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases production parity, and makes the “works on my machine” excuse a relic of the past. Read more
Just like we did before, we would head over to the download page to select the version for our OS and install it.
Install ubuntu image
mkdir dev_server cd dev_server vagrant box add ubuntu/trusty64
Updating your Vagrant file
- Box Settings – this is the server image and version for the machine.
- Provider Settings – this is where we specify how much system Memory and CPU we want for this server, in this case 2GB Memory and 4 CPUs.
- Network Settings – this is this where we specify an IP for system private_network.
Vagrant.configure("2") do |config| # Box Settings config.vm.box = "ubuntu/trusty64" # Provider Settings config.vm.provider "virtualbox" do |vb| vb.memory = 2048 vb.cpus = 4 end # Network Settings config.vm.network "private_network", ip: "192.168.33.10" end
start and provisions the vagrant environment with the command below
After the image download and provisions are complete, we would proceed to login to the new Ubuntu machine.
That was fun right?
It’s safe to say we have achieved the hardest part of this process, the ubuntu machine is functional and ready to use, but not just yet. Right now all we can do is
ssh into the machine and play around with Linux command, etc. We need a web server to make all this meaningful.
Right now you would get the error in the image below if you try to access the machine through the private_network