Wednesday, November 30, 2016

Install Laravel on Ubuntu

Here is briefly how to do a basic install of Laravel on Ubuntu. First, get the PHP language interpreter. And here is updated video on how to do the installation on Ubuntu 19.04 / 19.10, also, please enjoy the Ubuntu admin course



sudo apt-get install php
Then install and run composer which will take care of packages dependencies:
php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
php composer-setup.php
copy composer binary file into /sbin directory to be able to run composer from everywhere.
sudo mv composer.phar /usr/local/sbin/composer
or update the local path to be able to access composer vendor binaries and later be able to run laravel: export PATH = "$HOME/.config/composer/vendor/bin:$PATH" . If you would like the path change to be persistent just add the line into the .bashrc file.

install the two minimal PHP libraries required for laravel:
sudo apt-get install php-mbstring
sudo apt-get install php-xml
use composer to create a new project called learning-laravel from a package named laravel/laravel. The new directory which package would get installed will be called learning-laravel:
composer create-project laravel/laravel learning-laravel
enter into the new directory
cd learning-laravel
and start a local listening PHP server on port 8888 and address localhost(127.0.0.1). This will also make PHP interpret all the files within the subdirectory /public:
php -S localhost:8888 -t public
Open a browser on localhost:8888 Congratulations! You have installed a running Laravel project!

Subscribe To My Channel for updates