Setting up Laravel 4 on Linux Mint 16
I’ve been curious about Laravel and wanted to set up a virtual machine to get an environment for it. I will go over what I used and how I managed to finally get the environment working. Here is a list of what I will be using. I am including the version numbers just to add more detail. These are the versions I used at the time of writing this post. Terminal will be used to type the command and is assumed you are at your home directory.
- Virtualbox 4.3.8
- Linux Mint 16 (Cinnamon)
I will be installing LAMP on Linux Mint by using
This will install the following.
- Apache 2.4.6
- PHP 5.5.3
- MySQL 5.5.35
You can install phpmyadmin if you want but those are the 3 main components. Next, head on over to the quick start guide http://laravel.com/docs/quick. You might ask, why I’m posting this when Laravel already has a tutuorial. Well, I ran into many issues and I wanted to take note of them and the solutions I found. So I’ll be referring to their guide.
First thing we’ll need to do is install composer. To install composer, you will use curl. If curl is not installed, then use the following command.
You will also need json extension for PHP.
If you have curl installed, then download composer with this command.
Once download is completed, it will tell you where it downloaded and how to use it. We will move and rename composer.phar to composer and move it to /usr/local/bin
.
You can check to see if it’s working by typing the following.
It should give you the description of composer. Now that you have composer installed, we can install Laravel. According to their guide, you need to download it from http://laravel.com/laravel.phar. We’re going to use terminal to download it, then just like composer, we’re going to move it to /usr/local/bin
.
wget http://laravel.com/laravel.phar
sudo mv laravel.phar /usr/local/bin/laravel
Update: 2015-04-22: The file laravel.phar is no longer available. Essentially, you don’t need it. Composer is all you need. Thanks to @rohantapiyawala for giving me a heads up.
I will be storing my projects in the ~/Sites folder. For this tutorial, I will call the project apple. So this will sit in ~/Sites/apple.
You may get an error regarding the mcrypt PHP extension. The error looks like this.
Install the extension.
Check if it is enabled.
If it’s not enabled/present then do the following.
Delete the apple project and use composer to create it. This time you shouldn’t get the mcrypt error. I found the solution at http://stackoverflow.com/questions/19775012/my-composer-wont-update-completely-with-laravel-4-it-gets-stuck-with-artisan.
If you look inside the ~/Sites/apple directory
, you will see public. This is the “public_html” of the project. Just set Apache virtualhost for that folder and you’re done. My file is located at /etc/apache2/sites-available/apple.conf
and it looks like this…
<Directory /home/sherwin/Sites/apple>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ServerName apple.local
ServerAdmin webmaster@localhost
DocumentRoot /home/sherwin/Sites/apple/public
ErrorLog /home/sherwin/Sites/apple/error.log
CustomLog /home/sherwin/Sites/apple/access.log combined
Next you need to enable the new site and restart Apache.
If you get a blank screen, you may need to give app/storage different permissions. The article athttp://stackoverflow.com/questions/20678360/laravel-blank-white-screen explains more.
You should now be able to load http://apple.local
. If it works, you will get the Laravel logo and “You have arrived.” text. Coming from Codeigniter, I felt there is a lot more tasks just to get Laravel to work. It somewhat discourages me to continue experimenting but I’ll give it another chance. It’s my curiosity that drives it.
I’m trying to set Linux Mint as my main dev environment and was stumped on the set up.Thank you, this is was exactly what I was looking for!
great! i was in the same boat. i had to gather information from several different websites and was getting frustrated. i figured i gather all the info and put it in one place. glad it worked out for you.
You need to update this article… “laravel.phar” does not exist. also if you could provide support for linux mint, it would be appreciated
thanks for the heads up. i have updated the article. just waiting on the cache to clear. it should update by tomorrow. i’m not sure what you mean by support for linux mint. the article was written with Linux Mint as the OS i used. should still work in version 17. are you having other issues?
You need to update this article… “laravel.phar” does not exist. also if you could provide support for linux mint, it would be appreciated
thanks for the heads up. i have updated the article. just waiting on the cache to clear. it should update by tomorrow. i’m not sure what you mean by support for linux mint. the article was written with Linux Mint as the OS i used. should still work in version 17. are you having other issues?