Overview

Need Ruby, Java, Docker etc. installed in your Laravel Homestead?

Why

At some point, you might need to use some tools/software in your application that did not come by default with standard Homestead box. Like for example, Ruby. You usually have to manually install it yourself (tedious) or need to have it installed in your host machine (terrible).

As more and more tools is needed, you have to do a lot of googling on how to install this X tool, which will be very tedious to re-setup each time you need to put up a fresh Homestead box.

Homestead installers is a set of curated bash scripts that provides an easy way for you to install softwares inside your Homestead box, with minimal effort in your end.

For example, to install Ruby, it is as easy as logging into your homestead box via ssh and then typing

setup_ruby

Ain't that is easy? The script will do the heavy lifting for you. The good thing about this is, even if all the quirky details of installing Ruby had changed, the above command will not change, saving you all the headache of constantly googling the "best way to install ruby in ubuntu"

Most of the time, it is very easy to predict the command to install a particular tool, since all of them is prefixed with setup_.like for example, to install Java, just hit setup_java, to install Docker, type setup_docker and so on.

Installation

It is easy to install this tool once you already have Homestead installed in your machine. If you haven't installed it yet, go ahead and install it. Once Homestead is installed (assuming you have it installed it in ~/Homestead folder), you just need to go to that folder and clone the homestead-installers repository

cd ~/Homestead
https://github.com/buonzz/homestead-installers.git

Configuration

After the repository is clone, let us make it hooked into Homestead provisioning script by editing the after.sh file in ~/.homestead folder

vi ~/.homestead/after.sh

Add the following code in a new line

sudo bash /vagrant/homestead-installers/init.sh

Provision the Homestead box for the change to take effect.

cd ~/Homestead
vagrant provision

Once this is completed, several setup_* scripts is now available globally in your Homestead machine. See the Usage section for more details.

Updating

There might be new software installer available added in the repository, or there might be new methods of installing a particular tool. For this reason, it might be a good idea to keep your homestead-installers copy sync with the remote repo. To do this:

cd ~/Homestead/homestead-installers
git pull origin master

Make sure you re-provision the Homestead box for the changes to take effect.