How to install a new Laravel project

Laravel is powerful PHP framework, it could be pretty easy to build a site using it. I’m going to give you some very short steps to install a new Laravel project, this guide is focused on a Ubuntu environment but it could be useful to other operating systems.

First, make sure that you have already installed some basic but necessary things, you need have PHP 5.6 preferably, Apache2 and MySQL running if you don’t have them you must install them before continuing.

1. Install Composer.

You need have installed Composer because it’s going to be necessary to get the Laravel dependencies, you can install it using the following commands:

$ curl -sS | php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo chmod +x /usr/local/bin/composer

2. Install the Laravel project.

Now we can clone the Laravel project using this:

$ cd /var/www
$ git clone

Then navigate to the project’s root and install the dependencies:

$ cd /var/www/laravel
$ sudo composer install

Only to make sure, we can set minimum permissions required:

$ chown -R www-data.www-data /var/www/laravel
$ chmod -R 755 /var/www/laravel
$ chmod -R 777 /var/www/laravel/app/storage

3. Setting up the encryption key.

To do that we need to be in the project’s root and if doesn't exist create the .env file, even you can copy the .env.example and rename it, now generate the random encryption key using the following command:

$ php artisan key:generate

It’s important that you update the configuration file in config/app.php add the following line there:

'cipher' => 'AES-128-CBC',

4. Create an Apache virtual host.

Now we’re going to create a new Apache host configuration file:

$ nano /etc/apache2/sites-available/

It should look like this:

<VirtualHost *:80>
       DocumentRoot /var/www/laravel/public
       <Directory />
               Options FollowSymLinks
               AllowOverride None
       <Directory /var/www/laravel>
               AllowOverride All
       ErrorLog ${APACHE_LOG_DIR}/error.log
       LogLevel warn
       CustomLog ${APACHE_LOG_DIR}/access.log combined

After that you must enable it and restart Apache:

$ a2ensite
$ sudo service apache2 reload

5. Add it to the host file.

$ sudo nano /etc/hosts

Finally, add the new host to the file /etc/hosts and then you should be able to see the Laravel site on your browser.