Installing Elgg on Homestead

Homestead is an excellent Vagrant box tailored for PHP development made by the developers of Laravel. It allows you to set up an Ubuntu virtual machine in a matter of minutes, saving time installing and configuring an Apache server and all the other tools necessary for local development and testing.

1. Install Homestead

Install one of the preferred virtual machine providers, Vagrant and Homestead following the instructions at https://laravel.com/docs/5.4/homestead

If you have the virtual machine and Vagrant installed, you can use the following commands

vagrant box add laravel/homestead

# navigate to the directory that will hold your Homestead installation, e.g. your home directory
cd ~
git clone https://github.com/laravel/homestead.git Homestead
cd Homestead
# checkout the latest stable release
git checkout <tagged release version>
bash init.sh

Advertencia

On Windows, make sure to run your command line tool as an Administrator.

2. Configure Homestead

Edit Homestead.yaml to include the details of your new Elgg project(s). In the following example, we will set up two Elgg apps - one from git source and one using the starter project. Note that when configuring sites, you can use the «elgg» site type, which will automatically bootstrap nginx vhosts, using the shell config script

---
ip: "192.168.10.10"
memory: 2048
cpus: 1
provider: virtualbox

authorize: ~/.ssh/id_rsa.pub

keys:
    - ~/.ssh/id_rsa

folders:
    - map: ~/apps/elgg-starter
      to: /home/vagrant/Code/elgg-starter
      type: "nfs"

    - map: ~/apps/elgg-git
      to: /home/vagrant/Code/elgg-git
      type: "nfs"

sites:
    - map: elgg-starter.app
      to: /home/vagrant/Code/elgg-starter/public
      type: elgg

    - map: elgg-git.app
      to: /home/vagrant/Code/elgg-git/public
      type: elgg

databases:
    - elgg-sandbox
    - elgg-git

NFS is not supported on Windows, but you can try WinNFSd plugin

3. Update hosts

Update your hosts file to point domains configured in Homestead to the Vagrant box IP address. This will allow yout to access your sites by domain name from the browser

4.a Install Elgg using starter-project

4.b Install Elgg from source

Now we can install our second git project, which we can use to contribute code back to core.

5. Other