Laravel 5 Framework Install on Ubuntu
LAMP install
php:
$ sudo apt-get install python-software-properties $ sudo add-apt-repository ppa:ondrej/php5 $ sudo apt-get update $ sudo apt-get install -y php5 php5-mcrypt php5-gd php5-common
Install Apache2 or Nginx:
$ sudo apt-get install apache2or
$ sudo apt-get install nginx
Install Mysql:
$ sudo apt-get install mysql-server php5-mysql
Composer is required for installing Laravel dependencies. So, run the following command to get the latest Composer version:
$ curl -sS https://getcomposer.org/installer | php $ sudo mv composer.phar /usr/local/bin/composer $ sudo chmod +x /usr/local/bin/composer
First, download the Laravel installer using Composer:
$ composer global require "laravel/installer"
We want to make sure to place the ~/.composer/vendor/bin directory in our PATH so the laravel executable can be located by our system. In ~/.bashrc:
# Laravel 5 export PATH=$PATH:~/.composer/vendor/bin
Let's create a new project under our ~/Laravel:
$ laravel new test
Let's move the files and folders under the test directory to /var/www/laravel.
Then set the proper permissions necessary:
$ sudo chown -R :www-data laravel $ sudo chmod 755 -R laravel/storage
Now let's set the 32 bit long random number encryption key which will be used by the Illuminate encryptor service:
$ php artisan key:generate Application key [uvQoX9sbUSHHBYDhMADqKfsA1KZHfyYl] set successfully.
Now edit config/app.php configuration file and update above generated application key as followings. Also make sure cipher is set properly:
'key' => env('APP_KEY', 'uvQoX9sbUSHHBYDhMADqKfsA1KZHfyYl'), 'cipher' => 'AES-256-CBC',
Now add a Virtual Host in our Apache configuration file to access Laravel framework from web browser.
Create an Apache configuration file /etc/apache2/sites-available/laravel.example.com.conf and add below content:
<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>
Enable website and reload Apache:
$ sudo a2ensite laravel.example.com $ sudo service apache2 restart
Setup host file:
$ echo "127.0.0.1 laravel.example.com" | sudo tee -a /etc/hosts
Ph.D. / Golden Gate Ave, San Francisco / Seoul National Univ / Carnegie Mellon / UC Berkeley / DevOps / Deep Learning / Visualization