How to Install Laravel in Debian
To Install Laravel in Debian
Laravel is a PHP framework used to develop PHP based applications in Linux systems. Laravel is especially designed for easy development of web applications. It supports multi-platform and allows the users to develop the MVC web applications. Installation of Laravel Framework in Ubuntu is discussed in this manual.
Installation of Laravel
Before the start installation process, you need to configure the LAMP with the following link.
https://www.linuxhelp.com/how-to-install-lamp-setup-in-ubuntu-15-10/
Install the curl by using the apt-get install command.
root@linuxhelp:~# apt-get install curl
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following extra packages will be installed:
libcurl3
The following NEW packages will be installed:
curl libcurl3
0 upgraded, 2 newly installed, 0 to remove and 27 not upgraded.
Need to get 460 kB of archives.
After this operation, 933 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://security.debian.org/ jessie/updates/main libcurl3 amd64 7.38.0-4+deb8u5 [259 kB]
Get:2 http://security.debian.org/ jessie/updates/main curl amd64 7.38.0-4+deb8u5 [200 kB]
.
.
.
Unpacking libcurl3:amd64 (7.38.0-4+deb8u5) ...
Selecting previously unselected package curl.
Preparing to unpack .../curl_7.38.0-4+deb8u5_amd64.deb ...
Unpacking curl (7.38.0-4+deb8u5) ...
Processing triggers for man-db (2.7.0.2-5) ...
Setting up libcurl3:amd64 (7.38.0-4+deb8u5) ...
Setting up curl (7.38.0-4+deb8u5) ...
Processing triggers for libc-bin (2.19-18+deb8u6) ...
root@linuxhelp:~#
next download the composer installer by using curl command
root@linuxhelp:~# curl -sS https://getcomposer.org/installer | php
All settings correct for using Composer
Downloading 1.2.2...
Composer successfully installed to: /root/composer.phar
Use it: php composer.phar
Move the composer.phar file to the ' /usr/local/bin/composer' .
root@linuxhelp:~# mv composer.phar /usr/local/bin/composer
Set permission to execute that composer.
root@linuxhelp:~# chmod +x /usr/local/bin/composer
Now move to html directory to install git.
root@linuxhelp:~# cd /var/www/html
Run the following command to install the git.
root@linuxhelp:/var/www/html# apt-get install git Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: git-man liberror-perl rsync Suggested packages: git-daemon-run git-daemon-sysvinit git-doc git-el git-email git-gui gitk gitweb git-arch git-cvs git-mediawiki git-svn openssh-server The following NEW packages will be installed: git git-man liberror-perl rsync 0 upgraded, 4 newly installed, 0 to remove and 27 not upgraded. Need to get 4,942 kB of archives. After this operation, 24.3 MB of additional disk space will be used. Do you want to continue? [Y/n] y Get:1 http://ftp.debian.org/debian/ stable/main liberror-perl all 0.17-1.1 [22.4 kB] Get:2 http://security.debian.org/ jessie/updates/main git-man all 1:2.1.4-2.1+deb8u2 [1,267 kB] Get:3 http://ftp.debian.org/debian/ stable/main rsync amd64 3.1.1-3 [390 kB] Get:4 http://security.debian.org/ jessie/updates/main git amd64 1:2.1.4-2.1+deb8u2 [3,262 kB] Fetched 4,942 kB in 20s (244 kB/s) Selecting previously unselected package liberror-perl. (Reading database ... 145620 files and directories currently installed.) Preparing to unpack .../liberror-perl_0.17-1.1_all.deb ... Unpacking liberror-perl (0.17-1.1) ... Selecting previously unselected package git-man. Preparing to unpack .../git-man_1%3a2.1.4-2.1+deb8u2_all.deb ... Unpacking git-man (1:2.1.4-2.1+deb8u2) ... Selecting previously unselected package git. Preparing to unpack .../git_1%3a2.1.4-2.1+deb8u2_amd64.deb ... Unpacking git (1:2.1.4-2.1+deb8u2) ... Selecting previously unselected package rsync. Preparing to unpack .../rsync_3.1.1-3_amd64.deb ... Unpacking rsync (3.1.1-3) ... Processing triggers for man-db (2.7.0.2-5) ... Processing triggers for systemd (215-17+deb8u5) ... Setting up liberror-perl (0.17-1.1) ... Setting up git-man (1:2.1.4-2.1+deb8u2) ... Setting up git (1:2.1.4-2.1+deb8u2) ... Setting up rsync (3.1.1-3) ... Processing triggers for systemd (215-17+deb8u5) ... root@linuxhelp:/var/www/html# Now its time to download the Laravel with the ' git clone' command. root@linuxhelp:/var/www/html# git clone https://github.com/laravel/laravel.git Cloning into ' laravel' ... remote: Counting objects: 27618, done. remote: Total 27618 (delta 0), reused 0 (delta 0), pack-reused 27618 Receiving objects: 100% (27618/27618), 7.79 MiB | 147.00 KiB/s, done. Resolving deltas: 100% (16770/16770), done. Checking connectivity... done.
Once the git clone is installed, move to the Laravel directory.
root@linuxhelp:/var/www/html# cd laravel/
Run the composer install command to install composer.
root@linuxhelp:/var/www/html/laravel# composer install
Do not run Composer as root/super user! See https://getcomposer.org/root for details
Loading composer repositories with package information
Updating dependencies (including require-dev)
- Installing vlucas/phpdotenv (v2.4.0)
Downloading: 100%
- Installing symfony/polyfill-mbstring (v1.3.0)
Downloading: 100%
- Installing symfony/var-dumper (v3.1.7)
Downloading: 100%
- Installing symfony/translation (v3.1.7)
Downloading: 100%
- Installing symfony/routing (v3.1.7)
Downloading: 100%
- Installing symfony/process (v3.1.7)
Downloading: 100%
- Installing psr/log (1.0.2)
Downloading: 100%
.
.
.
laravel/framework suggests installing predis/predis (Required to use the redis cache and queue drivers (~1.0).)
laravel/framework suggests installing pusher/pusher-php-server (Required to use the Pusher broadcast driver (~2.0).)
laravel/framework suggests installing symfony/psr-http-message-bridge (Required to use psr7 bridging features (0.2.*).)
sebastian/global-state suggests installing ext-uopz (*)
phpunit/php-code-coverage suggests installing ext-xdebug (> =2.4.0)
phpunit/phpunit suggests installing phpunit/php-invoker (~1.1)
phpunit/phpunit suggests installing ext-xdebug (*)
Writing lock file
Generating autoload files
> IlluminateFoundationComposerScripts::postUpdate
> php artisan optimize
Generating optimized class loader
Compiling common classes
root@linuxhelp:/var/www/html/laravel#
Immediately, change the owner permission to that Laravel directory.
root@linuxhelp:/var/www/html/laravel# chown -R www-data.www-data /var/www/html/laravel
Set permission to execute that laravel directory.
root@linuxhelp:/var/www/html/laravel# chmod -R 755 /var/www/html/laravel
Rename or copy the .env.example file to .env file.
root@linuxhelp:/var/www/html/laravel# cp .env.example .env
root@linuxhelp:/var/www/html/laravel# chown -R www-data.www-data .env
Create the key file with the php artisan command.
root@linuxhelp:/var/www/html/laravel# php artisan key:generate
Application key [base64:EFk4kXxStK9MYj3W+q/oF7hPnHm6loK5nsmfOMWd/qg=] set successfully.
Restart the Apache service to take effect.
root@linuxhelp:/var/www/html# service apache2 restart
Once the above process is completed, open the browser with IP address to access it.
"composer could not find a composer.json file in /root" during Laravel setup?
# apt-get install php-cli php-gd php-mbstring php-mcrypt php-zip php-opcache php-xml.
//require_once __DIR__.'/public/index.php';
and make it as
require_once __DIR__.'/index.php';
Now your URL should look like www.linuxhelp.com