There is vagrant in laravel's guide, but after reading it for a long time, I didn't understand it very clearly.
For example, when we usually use a virtual machine (virtualbox), we have to download an operating system image to install and run virtualbox.
The creation of vagrant depends on virtualbox, so can I understand that vagrant is an operating system image management tool?
But it doesn’t seem right. For example, the official homestead provided by Laravel is only over 600 MB. Even a minimal Linux system is more than 600 MB, and it also includes mysql php nginx redis memcache and so on...
So I would like to ask, what is vagrant, and what is homestead?
VirtualBox I believe many people have used it. It is a virtualization software that is used to virtualize a computer on our computer. It is the same type of thing as VMware Workstation, kvm, xen, etc. (the professional term is called Hypervisor). However, it provides an easy-to-use interface (VMware also has it), supports various platforms (Linux, Win, Mac), is very lightweight, and the most important thing is free, so it is very widely used.
The most common situation when we usually use VirtualBox is that our computer is Win and we want to run Linux, or our computer is Linux and we want to run Win online banking, QQ or something like win only. Although there are things like wine, You can run software under win under Linux, but wouldn't it be more stable if you have a win system? And with the current computer configuration, you don't have to worry about the virtual machine consuming memory and CPU. It would be a waste if you don't use it, not to mention that VirtualBox is so Lightweight. Personal experience, running QQ on an . .
For hard-working programmers who code every day, VirtualBox cannot be used simply by hanging a Q ->_->
What programmers do most is coding. They may do many projects. They may work on java or php in the company. Then they can play python or something by themselves at home. They want to experience the new version of mongodb or nginx, Emacs or vim. It’s configured. I’m not sure which project the database of the previous version is mysql, and the next version uses postgresql. With so many things put together and installed on a computer, you will definitely be confused by the various configuration environments. , extremely annoying.
What should I do? It is best to have a clean development environment for each project, just for this project. However, it is impossible for us to allocate a computer to each project. With a virtual machine, we can allocate a virtual machine to each project. machine, when developing A, start A's virtual machine, so that each development environment is independent of each other and clean. There is another question. Our project has multiple developers. How do we ensure that everyone has the same development environment? We cannot just click the mouse one by one, fill in the configuration parameters, and then install the software one by one after it is built. This It's too cumbersome and not geeky. What we want is that the environment only needs to be configured once, and then the environment can be packaged and delivered to others. After others get it, they can start it directly and use it. Is there such a thing? There must be, Vagrant, it is used for this.
Vagrant is a command line version of a virtual machine management program that operates virtual machine programs such as VirtualBox/VMware by integrating commands to operate the operating system. Homestead is the virtual operating system of the official integrated environment and can run directly on VirtualBox / VMware. I don’t know what a Linux minimal system you are talking about is, but an Ubuntu Server is only 570M, so 600M should be normal.
vagrant is a virtual machine management software. It allows you to quickly deploy and replicate one or more virtual machines. It is a good choice for multi-environment development. Especially if you are on the win platform and want to build a Linux virtual machine environment at the minimum cost, vagrant is a good choice.
Homestead is the vagrant box officially provided by laravel. The so-called vagrant box is actually a Linux or other OS environment that has been configured and packaged by others. You only need a few simple lines of code such as:
vagrant add box homestead;
vagrant up;
to deploy the os environment officially recommended by laravel to the virtual machine for use.