Setting up Vagrant development environment, project wrap-up
Categories:
[school],
[linux-project]
Tags:
[linux],
[puppet],
[vagrant],
[ubuntu],
[linux-project-course],
[virtualization],
[ssh]
First I installed Vagrant on the testing server:
sudo apt-get update
sudo apt-get install vagrant
Then I created a project directory to test the environment and initiated a Vagrantfile to it:
mkdir -p ~/projects/linuxtest
vagrant init
I added the following text to the Vagrantfile:
Vagrant::Config.run do |config|
config.vm.define :web1 do |apache_config|
apache_config.vm.box = "precise64"
apache_config.vm.box_url = "http://files.vagrantup.com/precise64.box"
apache_config.vm.host_name = "web1"
apache_config.vm.network :bridged, :bridge => 'eth1'
end
config.vm.define :db1 do |mysql_config|
mysql_config.vm.box = "precise64"
mysql_config.vm.box_url = "http://files.vagrantup.com/precise64.box"
mysql_config.vm.host_name = "db1"
mysql_config.vm.network :bridged, :bridge => 'eth1'
end
end
WARNING! If you configure your virtual machines in bridged mode, please make sure that you define a good password for the vagrant user!
The Vagrantfile defines the creation of two VMs. One machine for Apache and another for databases. I defined the network to be in bridged mode on the eth1 interface. The host_name line defines a hostname automatically for both machines.
Then I created the VMs:
vagrant up
After Vagrant created the machines, I installed avahi-utils and apache2 on the web1 VM:
sudo apt-get install avahi-utils apache2
I installed Avahi for easy name resolving, as I don’t have a working DNS server on my network. I tested that both of them installed correctly and is working:
Project wrap-up
We started our project by listing a few of the virtualization platforms and we selected three of them for testing the most suitable system to replace the ESXi server platform. After we tested the three systems we selected two of them, Vagrant and VirtualBox, for the final solution. Vagrant will be used on projects involving Linux-based VMs and GUI-version of VirtualBox is used to deploy and test Windows VMs.
In the future we will be using Puppet for automating the installation of needed programs for Vagrant VMs, as this was not a task in this project.
Sources
- Vagrant Docs for version 1.0.1 (http://docs-v1.vagrantup.com/v1/docs/index.html)