http://tutsnare.com/how-to-install-laravel-on-ubuntu-lamp/
How to install laravel on ubuntu lamp (via laravel installer, composer)
Now time of frameworks in php like laravel, codeigniter etc and easy to install php frameworks on local server like lamp, xampp etc. Below we will see installation steps of a php framework laravel on ubuntu lamp. Let’s see How to install laravel on ubuntu lamp via laravel installer and via composer. for this we need some server requirements, some of software installation. Really a fast and handy installation of this new php framework. you will get this in few minutes. In this article (How to install laravel on ubuntu lamp) we are discussing all laravel installation different method need to give some hands and got installed.
We need some system requirements to install laravel framework :
PHP >= 5.4
Mcrypt PHP Extension
OpenSSL PHP Extension
Mbstring PHP Extension
Below are the steps of installing laravel on ubuntu lamp using composer and laravel installer :- first we need to install latest update and upgrade of unbuntu server. so for this run below command at your terminal
sudo apt-get update sudo apt-get upgrade
After update we need to install php, apche, mysql (if not already installed)
Install php mysql and apache
sudo apt-get install apache2 sudo apt-get install php5 sudo apt-get install mysql-server sudo apt-get install php5-mysql
Now we need to install some of require extension (json, curl, mcrypt etc.) to run and download laravel framework. and then restart apache server to setup all extension.
#installing json extension sudo apt-get install php5-json #installing unzip extension sudo apt-get install unzip #installing curl extension sudo apt-get install curl #installing openssl extension sudo apt-get install openssl #installing mcrypt extension sudo apt-get install php5-mcrypt #enable mcrypt extension sudo php5enmod mcrypt #installing git sudo apt-get install -y git-core #enable mod rewrite extension sudo a2enmod rewrite #restarting apache sudo service apache2 restart
After successfully configure all php setup and require extension we need to install composer to download laravel from remote server. for this first command will be for download composer using curl then second one move composer to local user directory for make composer globally use.
# installing composer curl -sS https://getcomposer.org/installer | php # move composer globally sudo mv composer.phar /usr/local/bin/composer # check composer working sudo composer
Now we composer installed successfully on our ubuntu. and then there are two method to install laravel on ubuntu lamp.
1. Via Laravel Installer
2. Via composer
a. create project command.
b. manually download and install(via commands)
I am sharing steps below with terminal command run screenshots that how to install laravel on unbuntu lamp.
1. Via Laravel Installer :-
laravel installer is a new method to install added for laravel 5. it’s much faster method than installing via Composer.
# download installer sudo composer global require "laravel/installer=~1.1" #setting up path export PATH="~/.composer/vendor/bin:$PATH" # change dir where to install sudo cd /var/www/html/ # download and installing sudo laravel new laravelnew # giving permission sudo chmod -R 777 laravelnew
2. Via Composer :-
A. create project command :-
after install composer you can directly install laravel by create-project command and give your destination path where you want to install laravel.
# checking composer is successfully installed sudo composer # downloading and install via composer #composer create-project laravel/laravel --prefer-dist sudo composer create-project laravel/laravel /var/www/html/laravel3 # setting up writable permission sudo chmod -R 777 /var/www/html/laravel3
B. manually download and install(via commands) :-
this is a long method to install laravel in this method we need to download laravel files then extract then move then apply permission and then we need composer install command.
# change directory to /var/www/html/(where i want to create laravel project) sudo cd /var/www/html/ # downloading from github sudo wget https://github.com/laravel/laravel/archive/master.zip # unzip downloaded zip sudo unzip master.zip # giving a new name to extract directrory sudo mv /var/www/html/laravel-master /var/www/html/laravel2 # giving writable permission sudo chmod -R 777 laravel2 # removing zip file sudo rm master.zip # getting project directory where i need to install project sudo cd laravel2 # installing using composer sudo composer install
Now you are done with how to install laravel on ubuntu lamp. and open url on
http://localhost/yourlaravel and bam.
Now you can enjoy today’s fast php framework. you can get more about this on official site of laravel and see how fast and how many features you are getting. you will really enjoy this php framework.
转载于:https://blog.51cto.com/caochun/1700121