wkm
wkm

Reputation: 1762

Customize Laravel Homestead server settings?

Is it possible to use Laravel Homestead and change some of the settings of the server that is created?

For example, perhaps I want a different version of PHP,mySQL or Ubuntu.

I looked through the Homestead source but couldn't see where these were defined.

Upvotes: 0

Views: 650

Answers (1)

David Barker
David Barker

Reputation: 14620

The laravel/homestead virtual machine (hosted on the vagrant cloud) is built with all of the below pre-installed:

  • PHP 5.6
  • HHVM
  • Nginx
  • MySQL
  • Postgres
  • Node (With Bower, Grunt, and Gulp)
  • Redis
  • Memcached
  • Beanstalkd
  • Laravel Envoy
  • Blackfire Profiler

This is to stop the need for a complex and lengthy provisioning process prior the VM being usable.

You have a few options to achieve what you want:

  1. (Recommended option) Add your own bash scripts to homesteads after.sh that remove / add software as required. The downside is that this script is run on every vagrant up and you would need to check first if the package you want to install is already installed.

  2. Add your own provisioning to the Homestead vagrant file. If you follow this route, I'd recommend you fork the Homestead project on Github and use your fork for the changes. You can do anything in the provisioner that you can do in the shell of the VM. You could for example get the latest version of PHP from source and configure && make it, whilst removing the old version. Take a look in the further reading below on how to get started with vagrant if you haven't already.

  3. Build your own VM. Sometimes the homestead box isn't quite enough and I need to build a VM for my customers specific environment quickly. I use Vagrant, Chef, and/or Ansible to achieve this although the last two I wouldn't recommend until you've built a few boxes using just vagrant. The Illuminate/Homestead repository is an excellent starting point to understanding Vagrant (be prepared for a swift introduction to Ruby if you have never used it before).

The packages / provisioners mentioned here are my personal preference. There are plenty of other well known and feasible packages to provision infrastructure

Further reading

Upvotes: 1

Related Questions