Vagrant is a tool to create development environment quickly. Suppose if your application need an environment which contains web, app, db, lb tiers, so creating virtual systems manually will take more time. Since vagrant keeps its configuration you can create these environments quickly.
for more details what it does, go through the documents when ever you get time. But I think we can jump to some practice .
1. Download Vagrant from : https://www.vagrantup.com/downloads.html
2. Download putty and putty keygen ( if you are trying out in windows) http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
3. Oracle Virtualbox .
To start with we need a box. Box is nothing but the package for vagrant to create environment. ie if you want to create an Ubuntu VM , you need to get one Ubuntu box image. You can find it in
https://atlas.hashicorp.com/boxes/search
example: ubuntu/trusty64
Now the tools and other stuffs are ready with us. Install above listed 3 items. If your system ask for restart , obey it no other way :)
Once you set it up we can go for next step
vagrant is the command using to manage the boxes . if you simply type vagrant in command prompt and type enter you will get the options and parameters.
>vagrant
Usage: vagrant [options] []
-v, --version Print the version and exit.
-h, --help Print this help.
Common commands:
box manages boxes: installation, removal, etc.
connect connect to a remotely shared Vagrant environment
destroy stops and deletes all traces of the vagrant machine
global-status outputs status Vagrant environments for this user
halt stops the vagrant machine
help shows the help for a subcommand
init initializes a new Vagrant environment by creating a Vagrant file
login log in to HashiCorp's Atlas
package packages a running vagrant environment into a box
plugin manages plugins: install, uninstall, update, etc.
port displays information about guest port mappings
powershell connects to machine via powershell remoting
provision provisions the vagrant machine
push deploys code in this environment to a configured destination
rdp connects to machine via RDP
reload restarts vagrant machine, loads new Vagrantfile configuration
resume resume a suspended vagrant machine
share share your Vagrant environment with anyone in the world
snapshot manages snapshots: saving, restoring, etc.
ssh connects to machine via SSH
ssh-config outputs OpenSSH valid configuration to connect to the machine
status outputs status of the vagrant machine
suspend suspends the machine
up starts and provisions the vagrant environment
version prints current and latest Vagrant version
For help on any individual command run `vagrant COMMAND -h`
Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.
Now we can use option box
>vagrant box
Usage: vagrant box []
Available subcommands:
add
list
outdated
remove
repackage
update
For help on any individual subcommand run `vagrant box -h`
Now it is expecting a box image name
>vagrant box add ubuntu/trusty64
The above command will download a box image and will cache in your system.
Now you can create a new VM configuration with this box image by
>vagrant init ubuntu/trusty64
This will create a Vagrant configuration file in the local directory with this ubuntu/trusty64 box image
>vagrant up
the above command will start VM with the configuration which created in above steps
>vagrant list
will list out the boxes running presently
you can ssh to the started VM though port 2222 ( if you run multiple boxes it will change, see the logs while you starting the VM)
for more details what it does, go through the documents when ever you get time. But I think we can jump to some practice .
1. Download Vagrant from : https://www.vagrantup.com/downloads.html
2. Download putty and putty keygen ( if you are trying out in windows) http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
3. Oracle Virtualbox .
To start with we need a box. Box is nothing but the package for vagrant to create environment. ie if you want to create an Ubuntu VM , you need to get one Ubuntu box image. You can find it in
https://atlas.hashicorp.com/boxes/search
example: ubuntu/trusty64
Now the tools and other stuffs are ready with us. Install above listed 3 items. If your system ask for restart , obey it no other way :)
Once you set it up we can go for next step
vagrant is the command using to manage the boxes . if you simply type vagrant in command prompt and type enter you will get the options and parameters.
>vagrant
Usage: vagrant [options]
-v, --version Print the version and exit.
-h, --help Print this help.
Common commands:
box manages boxes: installation, removal, etc.
connect connect to a remotely shared Vagrant environment
destroy stops and deletes all traces of the vagrant machine
global-status outputs status Vagrant environments for this user
halt stops the vagrant machine
help shows the help for a subcommand
init initializes a new Vagrant environment by creating a Vagrant file
login log in to HashiCorp's Atlas
package packages a running vagrant environment into a box
plugin manages plugins: install, uninstall, update, etc.
port displays information about guest port mappings
powershell connects to machine via powershell remoting
provision provisions the vagrant machine
push deploys code in this environment to a configured destination
rdp connects to machine via RDP
reload restarts vagrant machine, loads new Vagrantfile configuration
resume resume a suspended vagrant machine
share share your Vagrant environment with anyone in the world
snapshot manages snapshots: saving, restoring, etc.
ssh connects to machine via SSH
ssh-config outputs OpenSSH valid configuration to connect to the machine
status outputs status of the vagrant machine
suspend suspends the machine
up starts and provisions the vagrant environment
version prints current and latest Vagrant version
For help on any individual command run `vagrant COMMAND -h`
Additional subcommands are available, but are either more advanced
or not commonly used. To see all subcommands, run the command
`vagrant list-commands`.
Now we can use option box
>vagrant box
Usage: vagrant box
Available subcommands:
add
list
outdated
remove
repackage
update
For help on any individual subcommand run `vagrant box
Now it is expecting a box image name
>vagrant box add ubuntu/trusty64
The above command will download a box image and will cache in your system.
Now you can create a new VM configuration with this box image by
>vagrant init ubuntu/trusty64
This will create a Vagrant configuration file in the local directory with this ubuntu/trusty64 box image
>vagrant up
the above command will start VM with the configuration which created in above steps
>vagrant list
will list out the boxes running presently
you can ssh to the started VM though port 2222 ( if you run multiple boxes it will change, see the logs while you starting the VM)
No comments:
Post a Comment