Laravel Setup in Linux machine
Laravel setup in Linux machine ? yea its good to use Linux for framwork like Laravel, Symfony or Zend. It doesn’t means Win/Mac not good but linux is best in my concern.
I’m using Linux mint for developing Laravel app. so the basic configuration set up will explain step by step. Hope you are in Linux environment other wise this article doesn’t suit for your requirement.
First make sure you have latest PHP version installed, If you need Apache installation help, look at below.
Step 1: Apache InstallationOpen your terminal and type
sudo apt-get update
sudo apt-get install apache2
Step 2: Mysql Installation
simply type following commands.
sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql
during the installation mysql ask for root password if you don’t want to create a password for default user root means like to access mysql without password. simply follow the steps. you have to install phpmyadmin for linux debain
in the following path /etc/phpmyadmin/config.inc.php.
uncomment this line
$cfg['Servers'][$i]['AllowNoPassword'] = TRUE;
Step 3: PHP Installation
type the following commands.
sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt
Step 4: Some useful tools
Git
sudo apt-get install git
Curl
sudo apt-get install curl
Vim
sudo apt-get install vim
Install Composer and Node and so on
Composer
curl -sS http://getcomposer.org/installer | sudo php -- --filename=composer --install-dir=/usr/local/bin
Then open ~/.bashrc file using following command.
vim ~/.bashrc
paste the following line
export PATH="$PATH:~/.composer/vendor/bin"
then save it and type
source ~/.bashrc
So that all the composer packages are executable.
Node/NPM
sudo apt-get install nodejs npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
Bower
sudo npm install -g bower
Envoy
sudo apt-get install php5-curl
composer global require "laravel/envoy=~1.0"
Laravel Installer
sudo apt-get install php5-mcrypt
composer global require "laravel/installer=~1.1"
Creating your first empty Laravel project
Create a Development folder and enter it
mkdir Development
cd Development
Create a new Laravel install and give the files the correct permission
laravel new homestead
cd homestead
chmod 755 -R storage/
Create a homestead.conf file for apache and get into editing mode
sudo touch /etc/apache2/sites-available/homestead.conf
sudo vim /etc/apache2/sites-available/homestead.conf
While in the file paste whats next then type “:wq” of course do not forget to replace “User” with the linux user you are using.
<VirtualHost *:80>
ServerName homestead.app
DocumentRoot /home/User/Development/homestead/public
<Directory />
Require all granted
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
</Directory>
</VirtualHost>
When that has been done open up
sudo vim /etc/hosts
and add
127.0.0.1 homestead.app
Then you should be able to do
sudo a2ensite homestead.conf
Then simply restart apache
sudo service apache2 restart
then navigate to homestead.app in a browser.
All done! you setup your first Laravel project!.
Its quite simple and easy right ? more Laravel related article will coming soon.