What vagrant really is - vagrant

I'm puzzled by vagrant because I can't understand what it really is.
As we all know, if we want to run another system in our current system, we must install virtualbox and the mirror of that system such as CentOS.
When I installed vagrant it required virtualbox, so it can't be another virtualbox.
I thought it may be a system management just like bower but the vagrant box homestead which contains mysql, nginx, redis, php and memcache is just over 600M which is less than the smallest Linux system..
So I'm very confused. Could you tell me what the vagrant really is?

From the Vagrant website:
Vagrant is a tool for building complete development environments. With an easy-to-use workflow and focus on automation, Vagrant lowers development environment setup time, increases development/production parity, and makes the "works on my machine" excuse a relic of the past.
Basically Vagrant allows you to easily set up a virtual development environment. Everybody can build and configure pre-packaged environments called boxes and publish them for others to use. One of those boxes being homestead.
Here's an article that explains it more in-depth: What is Vagrant and Why should I care?

From the Vagrant website
Create and configure lightweight, reproducible, and portable development environments.
Instead of just installing your software requirements, Vagrant installs a whole development environment with similar hardware and software setup. So you never have to bother with your software not working on some other hardware during development.

Related

"No usable default provider could be found for your system" with VirtualBox

When trying to init a Vagrant box with VirtualBox, I keep getting this error:
No usable default provider could be found for your system.
Vagrant relies on interactions with 3rd party systems, known as
"providers", to provide Vagrant with resources to run development
environments. Examples are VirtualBox, VMware, Hyper-V.
The easiest solution to this message is to install VirtualBox, which
is available for free on all major platforms.
If you believe you already have a provider available, make sure it is
properly installed and configured. You can see more details about why
a particular provider isn't working by forcing usage with vagrant up
--provider=PROVIDER, which should give you a more specific error message for that particular provider.
After some searching it seems that Vagrant has compability issues with particular versions of VirtualBox. I'm running Vagrant 2.0 together with VirtualBox 5.2 on MacOS High Sierra. Is this simply not possible, or is there a workaround?
Update: It is a compatibility issue between Vagrant and VirtualBox – tried installing VirtualBox 5.1.14 instead and it works with Vagrant 2.0.
You can also use it with VirtualBox 5.2 with this patch:
https://gist.github.com/roktas/ec34960d2e5d74c3cc4f35bc78bc676d

What we install in Virtualbox using Vagrant?

I just started learning Vagrant and succeeded in using it. I went through this vagrantbox.es where we "download" the "templates".
I have some doubts and would be great if anyone can explain me:
1) Vagrant --> My understanding is t hat it helps in automating installing the Virtual machines in Virtualization software like Virtualbox. Is this correct?
2) Now, as per the instructions that I followed in one of the video tutorials, we need to 'download' the VM, from this link.
My doubt is what are we downloading from the link in point #2? Using Vagrant, are we downloading a VM (and which gets installed into Virtualbox, for example?). Can't we use any .iso image and let vagrant install it? I am bit confused here.
Can anyone who has used vagrant explain what exactly are we downloading?
2) Now, as per the instructions that I followed in one of the video tutorials, we need to 'download' the VM, from this link.
Must be a bit dated tutorials, even though it is still a good reference, nowadays people will download boxes from https://atlas.hashicorp.com/boxes/search. The platform is officially supported by hashicorp but everyone can upload boxes into the platform, and you can directly reference boxes from atlas such as ubuntu/trusty64 in your vagrantfile and vagrant will know how to download the box and install it for you so it saves you some steps.
My doubt is what are we downloading from the link in point #2? Using Vagrant, are we downloading a VM (and which gets installed into Virtualbox, for example?). Can't we use any .iso image and let vagrant install it? I am bit confused here.
There are some 'official' box supported by hashicorp. Some organization like laravel pushes their own official boxes (like laravel/homestead and they support virtual box and vmware provider). It will be up to you to review the box you reference and make sure about its source.
you can create your own box from the OS iso using tool such as packer you will find plenty of available packer templates on github to create boxes for different OS flavors
And finally, are these images "full" OS plus the tools (e.g. tomcat, php as you described)
This will depend - in the case of Laravel they would provide a box with OS + the stack but generally the boxes are minimal (and you want to keep it this way). You will provision this using a tool of your choice (shell, ansible, puppet ...)

Vagrant: dealing with requirements for a particular version of Ruby etc?

I am installing a Vagrant machine from a client.
It says that it needs a particular version of Vagrant, Virtualbox, and Ruby, all of which are different from the particular versions of Vagrant, Virtualbox and Ruby required to run another vagrant machine from another client.
What can I do about this?
I would like to be able to run both VMs on my machine, but it's going to be very difficult if I have to install different versions of Vagrant/Virtualbox/Ruby each time I want to spin the VM up.
Best Option: Work with your clients to make each Vagrant project compatible with the latest versions of each tool. For Vagrant at least, I don't know of too many compatibility issues from version to version, as long as the Vagrantfile is written to be somewhat "future proof". The key to Vagrant is the controlled version environment inside the virtual machine. That's the key benefit which lets these environments be shared among developers and on different platforms.
Alternative: Different Ruby versions is pretty easy with RVM. Different Vagrant/Virtualbox versions would be much trickier, but you might be able to install multiple versions and then wrap everything with some scripts. Vagrant under the hood calls the Virtualbox command-line utilities like VBoxManage, so it would just need to know where those are.

Symfony2 +Vagrant performance - running slow - speeding up?

I have started using vagrant with Symfony2.* to develop Web projects. I am using Windows, performance is very slow, because nfs mount isn't supported.
I've put cache into memory, which gave exotic boost, disabled xdebug (as posted here). However page still loads in more than 14 seconds in dev enviroment on windows machines. Any help would be appreciated.
Symfony >=2.3, PHP >= 5.4, Windows 7, Dell Precission m6700 quad-core i7/16GB/SSD
I've had the same performance problems, although with developing Drupal sites (also PHP based). Lately I've had quite some success by using the new rsync folder feature, which was introduced in Vagrant 1.5.
If you're working with a large number of files (10.000 - 100.000), I experienced that the built-in rsync-auto feature had a hard time keeping up. Switching to this neat little plugin saved my day. Just as the vagrant rsync folder feature, the gatling rsync plugin also only provides a one way sync (host -> guest). Since a lot of Drupal tools and compass generate files on guest, this plugin will help to sync the changes from guest to host.
If you're looking for a comparison: here you can find a recent benchmark blog post on rsync vs NFS.
Under Windows you absolutely need to use NFS OR RSYNC for sharing
folder with Vagrant.
RSYNC is an good solution when automatic mode is activated but it's
not bidirectional.
Try this config.yaml (make with PuPHPet): https://github.com/comexpertise/PuPHPet-config-lamp-webdev
Optimized for Windows: use NFS shares OR RSYNC.
Very speed but not free: Swith VirtualBox to VMWare with the Vagrant VMWare plugin (and use NFS or RSYNC sharing types).
Another solution (best performances): need to disable Vagrant sharing folders for use local file system of VM, and configure your favorite IDE/FTP for use SFTP and simply upload modified files (Netbeans can automatically upload new created/modified files)
Edit: Read my comment #2 before about newest versions of Vagrant. You need more speed? Try VMware + Vagrant VMware plugin, it's the best (y)
there is a great plugin enabling NFS on windows for Vagrant: vagrant-winnfsd
$ vagrant plugin install vagrant-winnfsd
https://github.com/GM-Alex/vagrant-winnfsd

I have a windows pc, can I develop with LAMP?

I have a pc running windows but I want to use a linux server. Is there a way for me to develop my website on my computer before I rent space on a server? Also its probably important to note that I have no linux experience. Should I just stick with wamp?
Unless you specifically and purposely use .NET features in your PHP Application, then an application developed in WAMP will work fine on a LAMP Server as long as you have included all the same PHP plugins.
PHP is independent from Linux or Windows. 99.9% of the time you have to knowingly use features from the host OS.
You should try ubuntu in a virtualbox, there are lots of well written guides that'll get you up and running.
For best performance, use coLinux. Install a linux distro like ubuntu (easier for beginners) and you should be ok.
Yes. I have developed and maintained a website like this before. My development environment was WAMP and the server was a LAMP shared server. Shouldn't be a problem till your site is using fairly basic libraries and they are available both for windows/linux.
However as others mentioned, its wiser to have the development environment as close possible to the production environment. You don't hit any surprises that way. And hey its not difficult and involves no cost:
You can use dual boot to have linux as other operating system.
Depending on your machine, you can just install VirtualBox and install a Linux VM.

Resources