How to install Laravel in Ubuntu for Beginners Step by Step

Install Composer in your Machine
Laravel utilizes Composer to manage its dependencies. So, before you Install Laravel, make sure you have Composer installed on your Development machine.

curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo chmod +x /usr/local/bin/composer

After the Composer is installed, check the installation by typing following Command.

composer

To download latest version of Laravel, Use below command to clone master repo of laravel from github.

cd /var/www
git clone https://github.com/laravel/laravel.git

Navigate to Laravel code directory and use composer to install all dependencies required for Laravel framework.

cd /var/www/laravel
sudo composer install

composer to install all Dependencies will take more time. After that process set proper permissions on folders.

sudo chown -R www-data.www-data /var/www/laravel
sudo chmod -R 755 /var/www/laravel

Goto Installed Laravel Directory and rename .env.example to .env

The next thing you should do after installing Laravel is set your application key to a random string. Typically, this string should be 32 characters long. The key can be set in the .env environment file.

php artisan key:generate

Use the php artisan serve command.

Now you can point your browser to http://localhost:8000  or http://127.0.0.1:8000/ and see your application.

Press Ctrl-C to stop the server.

You May Also Like

Leave a Reply

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