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.

[label style=”1″]Step 1: Apache Installation[/label]

Open your terminal and type

[code style=”1″]

sudo apt-get update
sudo apt-get install apache2

[/code]

[label style=”1″]Step 2: Mysql Installation[/label]

simply type following commands.

[code style=”1″]

sudo apt-get install mysql-server libapache2-mod-auth-mysql php5-mysql

[/code]

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

[code style=”1″]$cfg[‘Servers’][$i][‘AllowNoPassword’] = TRUE;[/code]

[label style=”1″]Step 3: PHP Installation[/label]

type the following commands.

[code style=”1″]

sudo apt-get install php5 libapache2-mod-php5 php5-mcrypt

[/code]

[label style=”1″]Step 4: Some useful tools [/label]

Git

[code style=”1″]sudo apt-get install git[/code]

Curl

[code style=”1″]sudo apt-get install curl[/code]

Vim

[code style=”1″]sudo apt-get install vim[/code]

[label style=”1″]Install Composer and Node and so on [/label]

Composer

[code style=”1″]curl -sS http://getcomposer.org/installer | sudo php — –filename=composer –install-dir=/usr/local/bin[/code]

Then open ~/.bashrc file using following command.

[code style=”1″]

vim ~/.bashrc

[/code]

paste the following line

[code style=”1″]

export PATH=”$PATH:~/.composer/vendor/bin”

[/code]

then save it and type

[code style=”1]source ~/.bashrc[/code]

So that all the composer packages are executable.

Node/NPM

[code style=”1″]

sudo apt-get install nodejs npm
sudo ln -s /usr/bin/nodejs /usr/bin/node

[/code]

Bower

[code style=”1″]sudo npm install -g bower[/code]

Envoy

[code style=”1″]

sudo apt-get install php5-curl
composer global require “laravel/envoy=~1.0”

[/code]

Laravel Installer

[code style=”1″]

sudo apt-get install php5-mcrypt
composer global require “laravel/installer=~1.1”

[/code]

Creating your first empty Laravel project

Create a Development folder and enter it

[code style=”1″]

mkdir Development
cd Development

[/code]

Create a new Laravel install and give the files the correct permission

[code style=”1″]

laravel new homestead
cd homestead
chmod 755 -R storage/

[/code]

Create a homestead.conf file for apache and get into editing mode

[code style=”1″]

sudo touch /etc/apache2/sites-available/homestead.conf
sudo vim /etc/apache2/sites-available/homestead.conf

[/code]

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.

[code style=”1″]

<VirtualHost *:80>
ServerName homestead.app
DocumentRoot /home/User/Development/homestead/public

<Directory />
Require all granted
Options Indexes FollowSymLinks Includes ExecCGI
AllowOverride All
</Directory>
</VirtualHost>

[/code]

When that has been done open up

[code style=”1″]

sudo vim /etc/hosts

[/code]

and add

[code style=”1″] 127.0.0.1 homestead.app [/code]

Then you should be able to do

[code style=”1″]sudo a2ensite homestead.conf[/code]

Then simply restart apache

[code style=”1″] sudo service apache2 restart [/code]

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.

Leave a Reply

Your email address will not be published. Required fields are marked *