This is the installation guide for my custom development environment for Laravel applications on FreeBSD. The resulting Vagrant box has the following features:
If that sounds appealing to you keep reading. In the examples below I have three default "applications" that will be used as stand-ins for your application.
Tested operating systems:
git clone "https://github.com/marblenix/Homestead-on-FreeBSD" cd Homestead-on-FreeBSD
cp Vagrant.yaml ~/.config/Vagrant.yaml $EDITOR ~/.config/Vagrant.yaml
Windows users do the following:
cd %HOMEDRIVE%%HOMEPATH%\path\to\the\folder\Homestead-on-FreeBSD mkdir %HOMEDRIVE%%HOMEPATH%\.config copy Vagrant-Windows.yaml %HOMEDRIVE%%HOMEPATH%\.config\Vagrant.yaml notepad.exe %HOMEDRIVE%%HOMEPATH%\.config\Vagrant.yaml
While I did keep the .yaml options as close as possible to the official Homestead release, only a subset of the options available were implemented.
vagrant sshfrom the project folder and use those settings for PuTTY. You'll need to convert the private_key to the ppk format first using PuTTYGen.
scss-lint. If you have these on your host machine and prefer to run those commands there feel free to skip this step.
This must be done before the initial `vagrant up`. If you have already initialized the environment you'll need to run `vagrant provision` in order for your changes to be reflected.
Windows users: The first time you run vagrant up Vagrant will complain that FreeBSD doesn't have the capability to mount SMB shares. I have worked around this for the time being in the Vagrantfile. You can safely ignore this and manually run vagrant provision after the first vagrant up.
There are a number of changes you should consider making to your host machine to make life a bit more tolerable.
C:\Windows\System32\Drivers\etc\hostsfor Windows) to include the hostnames of your application(s). This should be the same hostnames you set for the Config/Includes/*.conf files. To continue with the example applications here is what the hosts file should contain:
192.168.10.10 a-simple-blog.app 192.168.10.10 cool-crm.app
You'll notice I didn't add cool-crm-admin.app. That's because it's going to piggy-back off the cool-crm.app hostname, much like a real-world application would.
vagrant upmultiple times without entering your users password. Run
sudo visudoand append the following to the end of the file:
Cmnd_Alias VAGRANT_EXPORTS_ADD = /usr/bin/tee -a /etc/exports Cmnd_Alias VAGRANT_NFSD = /sbin/nfsd restart Cmnd_Alias VAGRANT_EXPORTS_REMOVE = /usr/bin/sed -E -e /*/ d -ibak /etc/exports %admin ALL=(root) NOPASSWD: VAGRANT_EXPORTS_ADD, VAGRANT_NFSD, VAGRANT_EXPORTS_REMOVE
See the Vagrant docs for more information.
This requires that you be apart of the admin group. You can check which groups you belong to with this command: `dscl . search /Groups GroupMembership $(whoami)`. If you are not apart of the admin group you can change the last line to say `%AGroupYouBelongTo` instead of `%admin`.
vagrant up(should take ~15 minutes)
vagrant reload(should take ~1 minute).
Double check /etc/exports (Network > MachineName on Windows) to make sure that Vagrant properly created the shares you declared in ~/.config/Vagrant.yaml.
You should now be able to connect to any SQL databases you've setup in the ~/.config/Vagrant.yaml file. Point your favorite SQL application at 192.168.10.10 with the username and password you setup and you should be able to connect and restore from a backup.
Clear up any composer mischief. Get into your new box with
vagrant ssh. You'll see that you have your projects waiting for you in the
$HOME directory. Run the following commands to help clear out any cached objects.
vagrant ssh cd cool-crm composer install php artisan clear-compiled php artisan optimize
Repeat the above for each project directory you have. I have also included
scss-lint in the box for you to be able to build your static assets.
You should now be able to reach a-simple-blog.app, cool-crm.app, and cool-crm.app/admin from a browser. For this example I just had all project folders include a simple index.php file containing only
Projects/ ├── a-simple-blog │ └── public │ └── index.php ├── cool-crm │ └── public │ └── index.php └── cool-crm-admin └── public └── index.php
If you would like to take a closer look at the Vagrantfile I go through it line by line in another post here: Homestead but on FreeBSD - A Closer Look
View Comments | Back to Blog | Back to Home