So, what is the Vagrant ?
Why we use it?
How to install the Vagrant ?
Step 2. After that Download Virtual box from here ....and choose your OS.
Step 3. After downloading the virtual box install them. and follow the following commands !!!
Go to terminal and fire this commands ..
$ vagrant init
this commands will initialize the Vagrant file into your locationThen open the vagrant file and and write this sysntax...
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network :forwarded_port, guest: 80, host: 8080, auto_correct:true # Nginx HTTP
config.vm.network :forwarded_port, guest: 443, host: 8443, auto_correct:true # Nginx HTTPS
end
IN this syntax the "ubutu/trusty6" is the vagrant box name and 'Vagrant.configure ("2") is the version name .....
and if you want to automate the task in the vagrant box ,then you need to write some Bash shell script and attach to the vagrant file... like this .
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network :forwarded_port, guest: 80, host: 8080, auto_correct:true # Nginx HTTP
config.vm.network :forwarded_port, guest: 443, host: 8443, auto_correct:true # Nginx HTTPS
config.vm.network :forwarded_port, guest: 5000, host: 5000 # Flask debug server
config.vm.provision "shell" do |s|
s.path ="provision.sh"
end
end
s.path ="provision.sh"
it describes the shell script path...
and you can write the shell script like this...given below
#!/bin/bash
echo "hello "
#update and upgrade the machine ..
sudo apt-get update
sudo apt-get upgrade
#and do whatever you want to install in vagrant box .....
Step: 4
$ vagrant init
Then , this command will run your entire Bash script and downlaod the ubuntu os into this vagrant virtual machine ......and you can operate them as a operating system.......after that run ' vagrant ssh ' command and this command will let you in the vagrant box....
$ vagrant ssh
And Thats Done..!!! and if you want to know more vagrant commands Go to the vagrant documentation
0 on: "What is Vagrant ?"