Monday, March 28, 2016

Vagrant : An amazing tool to manage VMs

Vagrant is an amazing tool for managing VMs. Why it is so amazing is because of the convenience it adds in the aspect of managing VMs. It can work with VirtualBox which makes it possible to get the advantage of vagrant for free.
If you have installed Vagrant and VirtualBox starting a vagrant and spawning up a virtual machine is super simple. You just need to enter 2 commands below.

vagrant init hashicorp/precise64
vagrant up

First command creates a configuration file in your current directory with the name "Vagrantfile" and this file can be used to configure the VMs as required. The second command will create and start the VM with the name "default". With these two commands, you will have your VM up and running in VirtualBox.

But most of the time we may need to start several VMs and manage them. The Vagrantfile can be used to support that. Given below is a sample Vagrantfile (without comments) that was used to spawn up 3 VMs: vm1, vm2 and vm3 with the specified IPs. The memory of each VM, number of cpus, etc can be configured in the Vagrantfile as required.

Vagrant.configure(2) do |config|
  config.vm.box = "hashicorp/precise64"
  config.vm.provider "virtualbox" do |vb|
  vb.memory = "3072"
  vb.cpus = 2
end

config.hostmanager.enabled = true
config.hostmanager.manage_host = false
config.hostmanager.ignore_private_ip = false
config.hostmanager.include_offline = true

  config.vm.define "vm1" do |vm1|
    vm1.vm.hostname = 'vm1-hostname'
    vm1.vm.network "private_network", ip: "172.28.128.5"
  end

  config.vm.define "vm2" do |vm2|
    vm2.vm.hostname = 'vm2-hostname'
    vm2.vm.network "private_network", ip: "172.28.128.6"
  end

  config.vm.define "vm3" do |vm3|
    vm3.vm.hostname = 'vm3-hostname'
    vm3.vm.network "private_network", ip: "172.28.128.7"
  end
end


Below are some useful commands that are be required to manage these VMs.
  • vagrant up vm1 (create vm1 if not created and start the vm1)
  • vagrant ssh vm1 (ssh into vm1)
  • vagrant halt vm1 (gracefully shutdown vm1)
  • vagrant destroy vm1 (destroy vm1)
  • vagrant status (shows status of the VMs created in current directory)
  • vagrant global-status (shows status of all the VMs in your host)

And one another useful feature is the easiness of copying the files to your VM. You can simply copy whatever the files you need to the same directory where the Vagrantfile is and those files will be available in /vagrant directory in your VM.
Give it a try when you need to work with VMs.

42 comments:


  1. Everything is fine, am happy about your blog. Thanks admin for sharing the unique content, you have done a great job I appreciate your effort and I hope you will get more positive comments from the web users.


    SAP training in Chennai

    ReplyDelete
  2. Wow amazing i saw the article with execution models you had posted. It was such informative. Really its a wonderful article. Thank you for sharing and please keep update like this type of article because i want to learn more relevant to this topic.

    SEO Company in Chennai

    ReplyDelete
  3. It’s really amazing that we can record what our visitors do on our site. Thanks for sharing this awesome guide. I’m happy that I came across with your site this article is on point,thanks again and have a great day. Keep update more information..

    Online Training in Chennai

    ReplyDelete
  4. This content creates a new hope and inspiration with in me. Thanks for sharing article like this. The way you have stated everything above is quite awesome. Keep blogging like this. Thanks.
    SMO Services Chennai

    ReplyDelete
    Replies
    1. I have read your blog its very attractive and impressive. I like it your blog.


      SEO Services in India SEO Company in India SEO Company in India SEO Services in India

      SEO Company in India SEO Services in India

      Delete
  5. Wowwww... really great information. Having interesting topic. The pictorial representation helps me to easy understanding of this. Have a great idea. Thank you.
    PPC Services Chennai

    ReplyDelete
  6. This idea is mind blowing. I think everyone should know such information like you have described on this post. Thank you for sharing this explanation.
    Your final conclusion was good. We are sowing seeds and need to be patiently wait till it blossoms.

    Informatica Training in Chennai

    ReplyDelete
  7. Thank you for sharing such a nice and interesting blog with us. Hope it might be much useful for us. keep on updating...!!
    seo company in india
    digital marketing company in india
    seo company in chennai
    digital marketing company in chennai

    ReplyDelete
  8. It’s really amazing that we can record what our visitors do on our site. Thanks for sharing this awesome guide. I’m happy that I came across with your site this article is on point,thanks again and have a great day. Keep update more information..

    MSBI Training in Chennai

    Informatica Training in Chennai

    ReplyDelete
  9. Hello, I will Provied SEO Niche Blog Comment Service . All comment relevant with your blog. I know every tips of niche blog comment . This service bring you lots of traffic . We Just say the post be real. That showing your personality is much more important than showing off your knowledge in the niche.

    ReplyDelete
  10. Really it was an awesome article...very interesting to read..You have provided an nice article....Thanks for sharing..
    Android Training in Chennai
    Ios Training in Chennai

    ReplyDelete
  11. This blog is very helpful for beginners and experts also, thanks for sharing it. Keep share content on MSBI Online Training Bangalore


    ReplyDelete
  12. This is very good blog for learners, Thanks for sharing valuable content on MSBI Online Training

    ReplyDelete
  13. What a fantabulous post this has been. Never seen this kind of useful post. I am grateful to you and expect more number of posts like these. Thank you very much. Managed IT Services Provider

    ReplyDelete
  14. This comment has been removed by the author.

    ReplyDelete
  15. It's getting late now and the job is far from finished! You sure wish that you had your tools well organized.best mechanic tool set

    ReplyDelete
  16. Hello, this weekend is good for me, since this time i am reading this enormous informative article here at my home. it support calgary

    ReplyDelete
  17. Thank you for your information that you've shared. It's really helpful for me.
    - USPS Tracking

    ReplyDelete
  18. Whoa! I’m enjoying the template/theme of this website. It’s simple, yet effective. A lot of times it’s very hard to get that “perfect balance” between superb usability and visual appeal. I must say you’ve done a very good job with this.
    AWS Training in Bangalore |Best AWS Training Institute in Bangalore BTM, Marathahalli
    AWS Training in Chennai | AWS Training Institute in Chennai Velachery, Tambaram, OMR

    ReplyDelete
  19. Superb. I really enjoyed very much with this article here. Really it is an amazing article I had ever read. I hope it will help a lot for all. Thank you so much for this amazing posts and please keep update like this excellent article. thank you for sharing such a great blog with us.
    best rpa training in bangalore
    rpa training in pune | rpa course in bangalore
    RPA training in bangalore
    rpa training in chennai

    ReplyDelete
  20. I believe there are many more pleasurable opportunities ahead for individuals that looked at your site.
    Best Devops Training in pune
    Microsoft azure training in Bangalore
    Power bi training in Chennai

    ReplyDelete
  21. Excellant post!!!. The strategy you have posted on this technology helped me to get into the next level and had lot of information in it.
    python Online training in chennai
    python training institute in marathahalli
    python training institute in btm
    Python training course in Chennai

    ReplyDelete
  22. A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. pbn link service

    ReplyDelete
  23. I feel really happy to have seen your webpage and look forward to so many more entertaining times reading here. Thanks once more for all the details. organic ghee

    ReplyDelete
  24. It's very useful blog post with informative and insightful content and i had good experience with this information. We, at the CRS info solutions ,help candidates in acquiring certificates, master interview questions, and prepare brilliant resumes.Find top Salesforce admin interview questions in 2020.
    These Salesforce developer interview questions are highly helpful in 2020. You can read these Salesforce lightning interview questions and Salesforce integration interview questions which are prepared by industry experts.

    ReplyDelete
  25. Crypto-currency as a modern form of the digital asset has received a worldwide acclaim for easy and faster financial transactions and its awareness among people have allowed them to take more interest in the field thus opening up new and advanced ways of making payments. Crypto.com Referral Code the growing demand of this global phenomenon more,new traders and business owners are now willing to invest in this currency platform despite its fluctuating prices however it is quite difficult to choose the best one when the market is full. In the list of crypto-currencies bit-coins is one of the oldest and more popular Crypto.com Referral Code for the last few years. It is basically used for trading goods and services and has become the part of the so-called computerized block-chain system allowing anyone to use it thus increasing the craze among the public, Crypto.com Referral Code.

    Common people who are willing to purchase BTC can use an online wallet system for buying them safely in exchange of cash or credit cards and in a comfortable way from the thousands of BTC foundations around the world and keep them as assets for the future. Due to its popularity, many corporate investors are now accepting them as cross-border payments and the rise is unstoppable. With the advent of the internet and mobile devices,information gathering has become quite easy as a result the BTC financial transactions are accessible and its price is set in accordance with people’s choice and preferences thus leading to a profitable investment with Crypto.com Referral Code. Recent surveys have also proved that instability is good for BTC exchange as if there is instability and political unrest in the country due to which banks suffer then investing in BTC can surely be a better option. Again bit-coin transaction fees are pretty cheaper and a more convenient technology for making contracts thus attracting the crowd. The BTC can also be converted into different fiat currencies and is used for trading of securities, for land titles, document stamping, public rewards and vice versa.

    Another advanced block-chain project is Ethereumor the ETH which has served much more than just a digital form of crypto-currency Crypto.com Referral Code and its popularity in the last few decades have allowed billions of people to hold wallets for them. With the ease of the online world,the ETH have allowed the retailers and business organizations to accept them for trading purposes, therefore, can serve as the future of the financial system.

    ReplyDelete
  26. Our full Lace Front Wigs are all hand made with a lace cap. They are manufactured with thin lace sewn on top of the cap. Individual hairs are then sewn onto the thin lace. Each lace wig has lace all around the unit which will need to be cut prior to securing the wig to your head. You will need to cut along the hairline around your entire head. By doing so, you will be able to wear your hair anyway you like. You can even style ponytails, up-dos, etc. Once the Lace Wigs is successfully applied, it will appear that all the hair is growing directly from your head!

    Lace front wigs are hand-made with lace front cap & machine weft at back. Lace Front Wigs are manufactured with a thin lace that extends from ear to ear across the hairline. When you receive the wig, the lace will be quite long in the front. Cut and style according to your preference, as you will need to apply adhesive along the front of the wig. Once the wig is applied, you will still have Lace Wigs with a very natural appearance.
    TeamWigz Provide the Best Lace Front Wigs and Lace Wigs in Johannesburg and South Africa.

    ReplyDelete
  27. ExcelR is the best institute for digital marketing certification course in Singapore known for the highest placements in top companies across the world. data science course syllabus

    ReplyDelete