Create a Virtual Machine easily with Vagrant - tutorial

In this post we will install vagrant , a tool to set up a development and testing environment very

quickly!!


Tools  : 


To manage VM  VirtualBox 

Vagrant


First Install Vagrant & Virtual Box in your machine then , go to your command line CMD (Widows)

create a folder called vagrant for ex :


mkdir vagrant

cd vagrant

vagrant init







edit the vagrantfile in your favorate text editor, delete all the previous content fill it with this sample

code :
ps : set the syntax to Ruby


Vagrant.configure("2") do  |o|
o.vm.box = "newbox"
o.vm.box_url = "http://tag1consulting.com/files/centos-5.9-x86-64-minimal.box"
o.vm.synced_folder "./app","/var/www/", create:true
o.vm.network :private_network ,ip: "192.168.55.55"
o.vm.provision :shell,:path => "setup.sh"
end




save the file and go and make a vagrant up in your folder - cmd - it's gone take a time

when it finished go the ip adresse. and test it :)

to connect to ssh just make a vagrant ssh


setup.sh : just for installing sofwares like php automacly after installing vagrant ex :

sudo apt-get -y update
sudo apt-get install apache2,php5,libapache2-mod-php5

sudo service apache2 restart


vagrantbox.es : for more linux distrubution for vagrant just change the line 3 of the vagrantfile

Comments

Popular posts from this blog

Twitter API with PHP

Realtime Chat Application with CakePHP and Socket.IO #1

Let's build a mobile application with Ionic Framework #3