To install Laravel you must have install LAMP stack (Linux, Apache2, MySql, and PHP) on your Ubuntu system
Install LAMP: If not installed LAMP
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install mysql-server
sudo apt-get install php5-mysql
Install PHP extensions
Some PHP extensions are necessary to install before installing Laravel
1. unzip used for the unzip laravel
sudo apt-get install unzip
2. Use Composer (which needs CURL)
sudo apt-get install curl
3. Use Composer (which downloads via HTTPS, usable only with install Openssl)
sudo apt-get install openssl
4. Use Laravel 4 (which needs mcrypt)
sudo apt-get install php5-mcrypt
Install Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Activate mod_rewrite
sudo a2enmod rewrite
sudo service apache2 restart
Open the default vhost config file:
sudo nano /etc/apache2/sites-available/default
Now search for "AllowOverride None" then change to "AllowOverride All"
System Requirement for Laravel
Install Laravel
Goto your web root directory
cd /var/www
Method 1: Install via laravel installer
composer global require "laravel/installer=~1.1"
Note: Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal.
To set PATH use following command
export PATH="~/.composer/vendor/bin:$PATH"
Then create new laravel project using laravel new {project-name} command
for example: laravel new blog. It will create a new laravel project directory in your web root directory.
Method 2: Install laravel using composer create-project command in your terminal
composer create-project laravel/laravel {directory} {laravel version} --prefer-dist
for example: composer create-project laravel/laravel blog 4.2 --prefer-dist
Note: Mention version number to install specific Laravel version. If you don't mention it then it will automatically install the latest version. The latest version of laravel is 5.
If you don't mention dirctory then it will install in "laravel" by default.
Method 3: Install via download
Download the Laravel framework and extract the content into your web root directory.
Next, in the root of your Laravel application, run the php composer.phar install (or composer install ) command to install all of the framework's dependencies. This process requires Git to be installed on the server to successfully complete the installation.
Final Step : If you are using LAMP or MAMP, you need to give permission to storage folder (i.e. for Laravel v5.x, folder path is /storage, permission command is $sudo chmod -R 777 storage)
After setting permission run project either use laravel CLI tool (Artisan) or set virtual host.
1. By CLI tool type in console $php artisan serve
2. For setting virtual host refer this link http://tecadmin.net/install-laravel-framework-on-ubuntu/
Install LAMP: If not installed LAMP
sudo apt-get install apache2
sudo apt-get install php5
sudo apt-get install mysql-server
sudo apt-get install php5-mysql
Install PHP extensions
Some PHP extensions are necessary to install before installing Laravel
1. unzip used for the unzip laravel
sudo apt-get install unzip
2. Use Composer (which needs CURL)
sudo apt-get install curl
3. Use Composer (which downloads via HTTPS, usable only with install Openssl)
sudo apt-get install openssl
4. Use Laravel 4 (which needs mcrypt)
sudo apt-get install php5-mcrypt
Install Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
Activate mod_rewrite
sudo a2enmod rewrite
sudo service apache2 restart
Open the default vhost config file:
sudo nano /etc/apache2/sites-available/default
Now search for "AllowOverride None" then change to "AllowOverride All"
System Requirement for Laravel
- PHP >=5.4 for Laravel 5 and PHP >=5.3 for Laravel 4
- mcrypt PHP extension
Install Laravel
Goto your web root directory
cd /var/www
Method 1: Install via laravel installer
composer global require "laravel/installer=~1.1"
Note: Make sure to place the ~/.composer/vendor/bin directory in your PATH so the laravel executable is found when you run the laravel command in your terminal.
To set PATH use following command
export PATH="~/.composer/vendor/bin:$PATH"
Then create new laravel project using laravel new {project-name} command
for example: laravel new blog. It will create a new laravel project directory in your web root directory.
Method 2: Install laravel using composer create-project command in your terminal
composer create-project laravel/laravel {directory} {laravel version} --prefer-dist
for example: composer create-project laravel/laravel blog 4.2 --prefer-dist
Note: Mention version number to install specific Laravel version. If you don't mention it then it will automatically install the latest version. The latest version of laravel is 5.
If you don't mention dirctory then it will install in "laravel" by default.
Method 3: Install via download
Download the Laravel framework and extract the content into your web root directory.
Next, in the root of your Laravel application, run the php composer.phar install (or composer install ) command to install all of the framework's dependencies. This process requires Git to be installed on the server to successfully complete the installation.
Final Step : If you are using LAMP or MAMP, you need to give permission to storage folder (i.e. for Laravel v5.x, folder path is /storage, permission command is $sudo chmod -R 777 storage)
After setting permission run project either use laravel CLI tool (Artisan) or set virtual host.
1. By CLI tool type in console $php artisan serve
2. For setting virtual host refer this link http://tecadmin.net/install-laravel-framework-on-ubuntu/
Comments
Post a Comment