Set up Laravel Environment on Elementary OS

Install Apache, PHP, MySQL

You can probably skip this part if you’re going to only use Homestead. Just skip down to Install Composer.


Add Apache respository

sudo add-apt-repository ppa:ondrej/apache2

Install Apache

sudo apt-get update
sudo apt-get install apache2

PHP 5.6

Add repository

sudo add-apt-repository ppa:ondrej/php5-5.6

Install PHP

sudo apt-get update
sudo apt-get install php5-cli php5-json php5-curl php5-mcrypt


MySQL 5.6

Add repository

sudo add-apt-repository ppa:ondrej/mysql-5.6

Install MySQL 5.6

sudo apt-get update
sudo apt-get install mysql-server

Now, if all went well, you should see the Apache2 default page when you visit http://localhost. To test that things are working, create a new file in /var/www/html/ called info.php (or whatever you want to call it) with the phpinfo function in it:


Then go to that file at http://localhost/info.php and you should see the php info page. (Remember to add your opening php tag at the top of the file. I couldn’t include it here in the code block because the php tag got stripped.)

Install Composer

curl -sS | php

You should get a message saying that composer was successfully installed to: /home/username/composer.phar. Move it to `/usr/local/bin` so you can just type “composer” to use it.

sudo mv /home/username/composer.phar /usr/local/bin/composer

Now, you should be able to just type “composer” and get the list of commands.

Install Git

Just install Git through the software center. Then set it up.

git config --global "John Doe"
git config --global ""

If you want to see your settings type

git config --list

Generate your SSH public key if you don’t already have one.


When prompted where to save, just hit enter to accept the default. You can leave the passphrase empty if you don’t want to type a password when you use the key.

Create a Test Laravel Project

Create a folder where you want your project to live. I will create a Code folder in my home folder. Then cd into that directory and create a new laravel project with Composer.

composer create-project laravel/laravel name-of-project

Once that has installed, you can test it by booting up the php server.

php -S localhost:8888 -t public

Visit http://localhost:8888 in your browser and you should see the default Laravel start page.

Install Homestead

First, install VirtualBox through the Software Center or download it from the website. I installed it from Software Center but probably should have just downloaded it since I think you get a newer version that way. Next you install Vagrant. I tried installing it from Software Center but I got an old version and wasn’t able to pull in the Laravel box. So then I went to the Vagrant website and just downloaded the Linux Debian 64-bit version and opened it from the Downloads folder. Software Center took over from there and offered an upgrade. Then I was able to pull in the laravel box.

vagrant box add laravel/homestead

Now, install Homestead with Composer.

composer global require "laravel/homestead=~2.0"

Next, you’ll need to add “~/.composer/vendor/bin” to your PATH so you can use the “homestead” executable.

sudo vi ~/.bashrc

Append the following to this file and save it.

export PATH="~/.composer/vendor/bin:$PATH"

Then reload.

source ~/.bashrc

Then check to see if it’s been added correctly.

echo $PATH


Now you should be able to run the `homestead` command. Now, run `homestead init` to create the Homestead.yaml file. Then run `homestead edit` to edit this file and configure Homestead. I actually haven’t been able to get `homestead edit` to work so I just do `sudo vim /home/username/.homestead/Homestead.yaml`

I had a lot of issues getting Homestead up and running so just follow the Laravel docs because I don’t have good instructions for this. Eventually you should be able to do `homestead up` and then `homestead ssh` and be there. If you configured your Homestead.yaml file correctly, you should be able to view the start page of your project in the browser now. Oh, and also edit the hosts file so you can go to ‘’ or whatever url you want to use.

Install Chrome Browser

Download this from the Chrome website and open it from Downloads. It should install when you click on it.

Install PHPStorm

Then download PhpStorm from the website and uncompress where you want it to be installed and follow the instructions in the Install-Linux-tar.txt file. Once it’s installed you can open it from the terminal with `pstorm`.

Leave a Reply

Your email address will not be published. Required fields are marked *