Configuring PHPStorm with Vagrant - vagrant

This is JetBrain Documentation
states that Vagrant installation will create these shell files ( vagrant.bat / vagrant.sh ), which will be linked to by PHPStorm. However these files do not exist in my system.
Should I reinstall Vagrant or link PHPStorm to a different file?

use terminal $ which vagrant
to find the programs root. Use this file directory to direct PHPStorm to Vagrant's executable.

Related

Vagrant - Bash: Command not found

Looking for some assistance with Vagrant, for what I believe is a Server Variable issue.
I have been trying all weekend to get any kind of Vagrant install up and running. I have followed:
Laravel Homestead installation guide, and
Sitepoint Homestead Vagrant VM guide.
I am using the default folders for install. Whatever I do, after installing Vagrant, I am unable to run 'vagrant up' or vagrant init' because the command 'vagrant' cannot be found (bash: vagrant: command not found). I am trying to execute from the folder with Vagrantfile in it, as suggested by Sitepoint.
I found this Stack Overflow article: Vagrant Command Stopped Working: Command not Found on Windows, but with the current version doesn't work as that bin folder is empty (note that the 'embedded' folder beside it is full, with several 'bin' folders down within the subfolder structure).
I am not familiar enough with Vagrant to know to which folder I should set the server variable, if indeed that is the right answer. It has to be simple, as no sites address this particular issue anywhere. Any assistance will be greatly appreciated.
Win 7, Vagrant 2.1.2, Virtualbox 5.2.14
At the time of writing, Vagrant v2.1.2 is missing vagrant.exe in the i686.msi file.
There are two parts to this answer.
In GitBash, run commands with .\ preceeding the filename(ie .\vagrant up). See earlier comments for the credit for this answer.
Missing executable has been raised as an issue on Github. Without the executable, it, of course, was throwing a command not found error. https://github.com/hashicorp/vagrant/issues/10026?_pjax=%23js-repo-pjax-container
Thanks for your support Rohit.

vagrant is not a recognised internal/external command

I have cloned a repository from Github following a course on Udacity. It contains a vagrant file and according to the tutorial I shoulld use vagrant up command to get the virtual machine started. But it says that vagrant is not a recognized internal/external command. How can I fix this?
Install Vagrant for Windows, if your machine OS is windows.
https://www.vagrantup.com/downloads.html
Restart computer.
Install Virtualbox from Virtualbox SDK
https://www.virtualbox.org/wiki/Downloads
VirtualBox 5.2.6 platform packages. The binaries are released under the terms of the GPL version 2.
Windows hosts
Once Virtual box is installed, run the command on the cmd prompt.
vagrant up --provision
I'm in the same course on Udacity and I think the issue you are having can be resolved by adding C:\Hashicorp\Vagrant\bin to your system variables path.
Instructions for editing your path can be found here: Where can I set path to make.exe on Windows?
This fixed the error for me.

Laravel Homestead: Adding an additional virtual machine using vagrant box

There has been a recent change lately when attempting to clone the laravel/homestead package from GitHub. I haven't had trouble in the past trying to add additional virtual machines to my system but now I'm running into a problem.
If you go into GitHub to look at the latest repository for Laravel Homestead you will see that the 'homestead.yaml' file is not in the root directory any longer and has now been replaced by the file 'homestead'.
In the past, I have used the steps below for creating additional virtual machines in my command prompt:
1) Create a new directory (Code2) from within the root directory where VirtualBox and VagrantBox are installed
2) Go into 'cmd' and change to 'Code2' directory
3) Type in 'vagrant box add laravel/homestead --force'
4) Type in 'git clone https://github.com/laravel/homestead.git Homestead_temp'
5) Go into the newly created 'Homestead_temp' directory, copy and paste the files from inside that directory into your 'Code2' root directory.
6) Edit 'src/stubs/homestead.yaml' so that it contains the correct paths for your 'Code2' directory.
7) Go back into 'cmd' and type in 'vagrant up'. When I try to do this, I keep getting a 'read: No such file or directory C:/Users/Jeff/.homestead/Homestead.yaml'
I haven't had trouble in the past adding additional virtual machines but now I am prevented from doing so. Any help is greatly appreciated.
I'm not really sure if this answers my question or not, I'll have to do some research on it but for anybody that is curious about the recent Laravel Homestead changes, check out this article for Laravel 2.0
Hope this information helps!

Vagrant: how to edit files on the Vagrant server?

I'm following these instructions for setting up a Django app on Vagrant.
I have successfully completed them and started Django, but: how can I now edit the Django files within my usual text editor, TextMate?
I guess I can ssh and use vi to edit them from the command line, but I thought the point of Vagrant was to be able to use my usual editing tools.
I'm just not sure where the Django files are physically located.
Apologies if this question is off-topic, I'll happily post it elsewhere, if editors can let me know where is best.
That web site is exactly the same place I started a few months ago.
Since I've learned more about Vagrant since then, I've created my own GitHub repo. You can download it here:
https://github.com/FlipperPA/djangovagrant
The way it is setup:
git clone the repo to a local directory on your machine
cd into that directory
run "vagrant up"
the directory you run "vagrant up" in is mapped to /vagrant on the guest virtual machine
Here is a working example of the way one might do it:
cd $home
git clone https://github.com/FlipperPA/djangovagrant.git
cd djangovagrant
vagrant up
vagrant ssh djangovm
cd /vagrant
django-admin.py startproject django_project
cd django_project
python manage.py runserver [::]:8000
You will then see the Django Project build on your local machine in the "djangovagrant" folder you created by the clone command above. You can you Textmate, Sublime, or any text editor you like to edit the files locally, and they'll be mapped to the guest VM.
I hope this helps - good luck.
Vagrant always synchronizes the files in the project you set up with your PC.
So whenever you ssh into the vagrant, (usually) in /vagrant directory you can see all the files you have in the root folder of your project (directory where Vagrantfile ruby script is)
Now you can use your text editor and save the file in a folder you want (for convenience, always save new files inside the project directory). now mirroring your directory structure around the /vagrant directory you can see the file being saved in the appropriate folder in your guest machine.
For e.g if you created and saved a file in your project root folder then you can see it appear in /vagrant directory.

Developing on Windows -> Deploying on a Virtual Machine?

Is there an easy way to integrate with VirtualBox such that I could develop under the host, Windows, and deploy and run scripts via a mounted folder in a guest linux system?
I'm looking to develop for Linux under Windows, kind of.
You can use VirtualBox's Shared Folders feature to enable your Ubuntu virtual machine to mount a directory of your Windows host. However, you're likey to be deal with some impedance mismatches like different line endings. I hope that is the least of your worries.
You might want to check out vagrant http://vagrantup.com/
It provides a nice and easy system to create a VM from a template in Virtual Box, and will automatically mount the project folder in the guest VM. The config can also easily be included in your project so others can use it.
I develop in PHP. And I use Debian as guest OS, and Win7 as host OS.
You can done automaticly mount share folder by:
new a file in /etc/init.d/ named mnt_win_sf, than you edit it:
It must has the same info head with /etc/init.d/apache2. And you need just one line of command:
mount -t vboxsf share_folder_name mount_point
We also need to excute this script before apache2, so we edit /etc/init.d/apache2. In the Require Start line, add mnt_win_sf
update them by:
sudo update-rc.d mnt_win_sf defaults
sudo update-rc.d apache2 defaults

Resources