Vagrant on Windows and access to shared folders - windows

I'm working with Vagrant to leverage development environments for my developer teams. Their host OS is Windows, the Vagrant development box is Ubuntu. But most important, our boxes will be stored on our NAS, in folder shared with samba.
My own PC runs Fedora, and my Vagrant file contains this code:
config.vm.box_url = "smb://<nas>/boxes/ubuntu-1404-64.box"
From Fedora, this works. From Windows, this doesn't with the following error:
protocol smb not supported or disabled in libcurl
I've tried on Windows with file://, but this logically doesn't work. So, here I am, looking for a good solution. I know a possible workaround is to mount the network share on each Windows PC, but I don't like this solution.
Any idea? Thanks.

I'm not sure what's the status now, but in the past you could've done it by using file:////server/path/file, not sure if its still possible.
P.S #1
box_url setting can be an array of possible URLs. So try just putting all possible combination for every OS there to create multiplatform Vagrantfile.
P.S #2
We solved this by hosting the box over local httpd and not using NFS/SMB.

Related

Does "Vagrant package" command work in vmware fusion?

I have VMWARE fusion on my macbook pro. In that I have a VM ,which was generated using vagrant. This VM has some changes and I want to create a .box file of out this VM.
I did see the post for the same in this forum. But did not find correct one.
I tried vagrant package but it is not working. I got the following error
The "package" command is not supported with VMware. We recommend
taking a look at Packer (www.packer.io) as an option for creating
VMware images
Can anyone throw some light on the same?
vagrant package currently works only for virtualbox VM as said from doc
This packages a currently running VirtualBox environment into a re-usable box. This command can only be used with other providers based on the provider implementation and if the provider supports it. A future version of Vagrant will address packaging boxes for other providers. Until then, they must be made by hand.

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 ...)

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

How can I share a local Subversion repository between a Mac workstation and a Windows virtual machine?

I would like to share a Subversion repository between my main computer running OS X Lion and a virtual machine running Windows 7 hosted in this computer (via VMware). I am unsure what is the best way to go about this.
I am thinking of setting up Apache and Subversion server on the OS X side and hopefully that would allow my virtual to access the repository from the Windows virtual using something like Tortoise SVN and accessing the repository at http://macHostName/pathToRepository. This seems feasible since the OS X side is always running.
An alternative could be setting up Apache and Subversion on the Windows virtual, which would require me to run the virtual everytime I want to access the repository from the OS X side. Perhaps Subversion can be set up in IIS? That would save some time if I don't need to install Apache.
Either way, I am unsure of the best way to go about this set up and what the caveats of each option are. I also haven't found a good walkthrough that will show how to set up a Subversion server on any OS using Apache.
Then, there is also the option of using svnserve, which I am unfamiliar with. Will a repository not served by an HTTP server like Apache be accessible for whoever is not serving it from the OS X host and the Windows virtual?
Any pointers will be appreciated.
Both Apache and svnserve are using network protocols, so the basic network setup between your host and your guest regarding routing and firewalls will be the same.
If you already have Apache installed and are familiar to it, I recommend to use it. Otherwise my recommendation is svnserve, because it is much simpler to setup and configure. The SVN-Book has a chapter for setting up svnserve both in Windows and in OSX.

Running XAMPP on Windows through VMWare Fusion on a MAC, how do I configure apache to use my shared folders (Z:) as the web root?

Environment:
Main platform: MAC OSX 10.6
Secondary platform via VMWare Fusion: Windows 7 64-bit
Background: I'm running MAMP Pro on the MAC side with a webroot at "/www". I need to test websites in IE thus requiring a Windows installation. I installed XAMPP on my Windows side and changed the apache root directory to "Z:\www", the location of my MAMP webroot which is a shared folder between MAC and Windows.
When I try to access a local site from windows (http://localhost/asite) I get a 403 Forbidden error:
Access forbidden!
You don't have permission to access the requested object. It is either read-protected or not readable by the server.
If you think this is a server error, please contact the webmaster.
Error 403
localhost
07/30/10 14:21:07
Apache/2.2.14 (Win32) DAV/2 mod_ssl/2.2.14 OpenSSL/0.9.8l mod_autoindex_color PHP/5.3.1
What other configuration changes need to be made for this to work if it will work at all?
Thanks,
Chris
Thanks to those who responded. I did a little research on the types of network connections and here's how I resolved the issue without using XAMPP at all.
To recap, I'm running Win7 on my Mac via VMWare Fusion as a virtual machine. I have MAMP running a local web server on my Mac with a webroot at /www and I want to be able to also access the web server from browsers in Windows.
In short, I want to be able to go to http://localhost/mysite from Safari (Mac) or IE (Windows).
Changed my Fusion Network Adapter to Bridged, since I am working from a home office.
Refreshed my network connections using the ipconfig commands in the command prompt.
Edited my windows hosts file to reflect: 192.168.1.102 localhost
Done and done.
I hope someone else can find this useful.
Chris
Is there any specific reason you're trying to serve your site from XAMPP, rather than just MAMP? I worked in a similar environment a couple of years ago, and I simply set the virtual machine's networking type to NAT (so that the guest has a different IP from the host), and then pointed IE at the IP address of the host running MAMP.
Maybe I didn't quite understand your problem completely, but:
"I need to test websites in IE"
you don't need to setup a Web server to do that...
Keep using Apache on your Mac host and point IE from your Windows VM to the host machine IP, as peterjmag suggested.
Also, wasn't there a Mac version of IE?
Again, my apologies if i misunderstood you - I don't want to sound arrogant;)
"Z:\www ... a shared folder between MAC and Windows"
What's this - a network share? Do you get the same error if you use a local folder in your VM (eg: C:\www)?
Try mounting /www from your VM - go to it's settings > options tab > shared folders. Select Always Enabled. Click Add and browse to your /www host folder. This should make /www accessible in your VM Windows.
Finally, just in case: check Windows permissions on the www folder.
Hope that helps!

Resources