Install Laravel php Framework on Ubuntu 16.04
It is about Install Laravel**. Laravel** is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model-view-controller ...
Key Architecture Takeaways
- ›Point 1: Full-stack architecture blueprint: Install Laravel php Framework on Ubuntu 16.04.
- ›Point 2: Covers MVC separation of concerns, routing pipelines, and database abstraction.
- ›Point 3: Modern ecosystems: Laravel 11/PHP 8.3, React 19, and Node.js LTS runtimes.
Modern Framework Landscape (2026)
Web engineering patterns have evolved: Laravel now utilizes PHP 8.2+ typed properties, Vite asset bundling, and strict Eloquent typing, while Node.js LTS supports native fetch and ESM modules out of the box.
It is about Install Laravel. Laravel is a free, open-source PHP web framework, created by Taylor Otwell and intended for the development of web applications following the model-view-controller (MVC) architectural pattern.
In this article, we are going to demonstrate how to up and run Laravel 5.x on Ubuntu 16.04 LTS, 15.04 LTS, 14.04 LTS, 12.04 LTS.
Prerequisites & Environment to Install Laravel
You will need to make sure your server meets the following requirements:
- A Host System(Mac, Linux, Windows) with LAMP server. - PHP >= 5.6.4 - OpenSSL PHP Extension - PDO PHP Extension - Mbstring PHP Extension - Tokenizer PHP Extension - XML PHP Extension
So let's start installing Laravel from scratch:
Step1: --- Installing LAMP Server to host
Click to view how to install LAMP and Virtual Host in detail:
- ›Installing Apache2
$ sudo apt-get update
$ sudo apt-get install python-software-properties
$ sudo apt-get install -y apache2 libapache2-mod-php- ›Installing MySQL
$ sudo apt-get install -y mysql-server php-mysql- ›Installing PHP and required Module
$ sudo apt-get install -y php php-mcrypt php-mbstring php-xml php-gdStep2: --- Installing Few Utility Tools
You need few utility tools to proceed further if you are using a minimal version of Ubuntu server otherwise you can ignore the step 2.
- ›Installing CURL, git, nano editor, unzip
$ sudo apt-get install -y curl unzip git nanoStep3: --- Installing Composer
Composer is required for installing Laravel dependencies. In order to download and install composer use below commands.
$ curl -sS https://getcomposer.org/installer | php
$ sudo mv composer.phar /usr/local/bin/composer
$ sudo chmod +x /usr/local/bin/composerStep4: --- Installing Laravel Framework:
Clone and download the latest version of Laravel. Use below command to clone master repo of laravel from GitHub.
$ cd /var/www
$ git clone https://github.com/laravel/laravel.gitAfter completing clone and download move on laravel directory and use composer to install all dependencies required for Laravel framework.
$ cd /var/www/laravel
$ sudo composer install<blockquote>
Note:
Try to avoid root user for run Composer because Certain Composer commands, including exec, install, and update allow third party code to execute on your system. This is from its "plugins" and "scripts" features. Plugins and scripts have full access to the user account which runs Composer. For this reason, it is strongly advised to avoid running Composer as super-user/root.
</blockquote> After install all dependencies, change ownership of your web dir Laravel under www directory and change following permission.
$ chown -R www-data.www-data /var/www/laravel
$ chmod -R 755 /var/www/laravel
$ chmod -R 777 /var/www/laravel/storageStep5: --- Setting Encryption Key to App:
Make sure that your present working directory is laravel (/var/www/laravel).
Before generating Key. Copy or rename the .env.example file to .env file otherwise, you will get an error while generating the key.
$ cp /var/www/laravel/.env.example /var/www/laravel/.envNow generate a 32 bit long random number encryption key, which used by the Illuminate encrypted service.
$ php artisan key:generate
Application key [base64:5zcSAFWQ+379F/TZsxxVmJMeO2R19b1FTi2aD280/Yo=] set successfully.Now it's time to put the Application Key at "app.php" file. Let's edit config/app.php configuration file and update above generated application key as followings. Also, make sure cipher is set properly. find the following at 106 no line:
'key' => env('APP_KEY', 'base64:5zcSAFWQ+379F/TZsxxVmJMeO2R19b1FTi2aD280/Yo='),
'cipher' => 'AES-256-CBC',Step6: --- Setting up Apache Virtual Host:
Now add a Virtual Host in your Apache configuration file to access Laravel framework from a web browser. Create Apache configuration file under /etc/apache2/sites-available/ directory and add below content.
$ sudo nano /etc/apache2/sites-available/laravel.example.com.confbash <VirtualHost *:80> ServerName laravel.example.com DocumentRoot /var/www/laravel/public <Directory /> Options FollowSymLinks AllowOverride None </Directory> <Directory /var/www/laravel> AllowOverride All </Directory> ErrorLog ${APACHE_LOG_DIR}/error.log LogLevel warn CustomLog ${APACHE_LOG_DIR}/access.log combined </VirtualHost>
Now enable the virtual host and reload apache service. using below command.bash $ sudo a2ensite laravel.example.com $ sudo service apache2 reload
Now you have completed the installation of Laravel 5.x successfully. To access your site follow the one more step.
## **Step7: --- View / Access Laravel: **
<hr />
We assume that you are on a test server so, to access Laravel make host file entry to access your Laravel application in the web browser. Change 127.0.0.1 with your server ip and laravel.example.com with your domain name configured in Apache to your accessing system. if you are in Linux or Mac then follow the path `/etc/hosts` and if you are accessing through windows system then follow the `C:/Windows/System32/drivers/etc/hosts` and insert the following line.
- **For Linux:**bash $ sudo echo "127.0.0.1 laravel.example.com" >> /etc/hosts
- **For Windows**bash
Copyright (c) 1993-2009 Microsoft Corp.
# # This is a sample HOSTS file used by Microsoft TCP/IP for Windows.
# # This file contains the mappings of IP addresses to host names. Each
entry should be kept on an individual line. The IP address should
be placed in the first column followed by the corresponding host name.
The IP address and the host name should be separated by at least one
space.
# # Additionally, comments (such as these) may be inserted on individual
lines or following the machine name denoted by a '#' symbol.
# # For example:
# # 102.54.94.97 rhino.acme.com
source server
38.25.63.10 x.acme.com
x client host
localhost name resolution is handled within DNS itself.
127.0.0.1 localhost
::1 localhost
#If your server on same host that you are use for access
127.0.0.1 laravel.example.com
Or
#<your Server Ip> laravel.example.com
And access **http://laravel.example.com** in your favourite web browser as below.
[](https://www.technhit.in/wp-content/uploads/2017/06/access-laravel.png)
Now build your awesome app using Laravel.
## One Step Method of Install Laravel on Ubuntu 14.04 and above:
<hr />
If you are puzzled on above code and steps then sit back and relax. we are here for you, everything will do our shell script. Execute following code on your terminal:bash $ bash <(curl -s https://www.technhit.in/wp-content/uploads/2017/06/vhostlaravel.txt) ```
Enter your website name when it asking for FQDN name for example (mylaravelapp.com). After that when it will be prompted for MySQL root password. Then you have to enter a password whichever you want to set. For your information, the following script sets your web directory at /home/<your site>/public_html/laravel. Nothing else enjoy Laravel.
- ›See On Youtube how to install Laravel:
