How to install Laravel in Ubuntu and Linux step by step

step 1:
-------

sudo apt-get update 
sudo apt-get upgrade


step 1:
-------
sudo add-apt-repository ppa:ondrej/php
sudo apt-get update
sudo apt-get install apache2 libapache2-mod-php7.2 php7.2 php7.2-xml php7.2-gd php7.2-opcache php7.2-mbstring

installing laravel:
-------------------
cd /tmp
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer


Next:
----
cd /var/www/html
sudo composer create-project laravel/laravel your-project --prefer-dist

Configure Apache:
------------------

sudo chgrp -R www-data /var/www/html/your-project
sudo chmod -R 775 /var/www/html/your-project/storage

Next:
---------
cd /etc/apache2/sites-available
sudo nano laravel.conf


Now add the following content to the file and close it after saving. Replace yourdomain.tld with the domain name of your website inside the file.

<virtualhost>
    ServerName yourdomain.tld

    ServerAdmin webmaster@localhost
    DocumentRoot /var/www/html/your-project/public

    <directory html="" var="" www="" your-project="">
        AllowOverride All
    </directory>

    ErrorLog ${APACHE_LOG_DIR}/error.log
    CustomLog ${APACHE_LOG_DIR}/access.log combined
</virtualhost>



Now we have to enable this newly created .conf file and disable the default .conf file that is installed with the default Apache install. Also, we need to enable mod_rewrite so that permalinks can function properly.

sudo a2dissite 000-default.conf
sudo a2ensite laravel.conf
sudo a2enmod rewrite
sudo service apache2 restart



finally completed installation of Laravel in Your system .



credits : Uppunuthula Prashanth

Comments