Facebook Twitter Instagram
    TecAdmin
    • Home
    • Ubuntu 20.04
      • Upgrade Ubuntu
      • Install Java
      • Install Node.js
      • Install Docker
      • Install LAMP Stack
    • Tutorials
      • AWS
      • Shell Scripting
      • Docker
      • Git
      • MongoDB
    • FeedBack
    • Submit Article
    • About Us
    Facebook Twitter Instagram
    TecAdmin
    Home»General Articles»How to Install Laravel on Fedora 35/34

    How to Install Laravel on Fedora 35/34

    RahulBy RahulFebruary 19, 20203 Mins ReadUpdated:December 27, 2021

    Laravel is an open source PHP framework designed for the faster development of MVC web applications in PHP. This article will help you to install Laravel 8 PHP Framework on Fedora system.

    Suggested tutorials:

    • How to Clear Laravel Cache
    • How to Check Laravel Version
    • Remove index.php from URL in Laravel

    Step 1 – Install Packages

    PHP is required to run the Laravel applications. As a backend database, you can use the MySQL/MariaDB server. Here is a short instruction for the installation of the LAMP stack on Fedora. It’s required to run the Laravel framework on your Fedora system. You can also use this guide for the detailed instructions to setup LAMP environment on Fedora systems.

    Install Apache
    sudo dnf install httpd
    
    Install MySQL
    sudo dnf install mariadb-server
    sudo systemctl start mariadb.service
    /usr/bin/mysql_secure_installation
    
    Install PHP
    sudo dnf install php php-zip php-mysqlnd php-mcrypt php-xml php-mbstring
    
    Install Composer
    sudo dnf install composer unzip
    

    Step 2 – Install Laravel on Fedora

    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 the Laravel code directory and use the composer to install all dependencies required for the Laravel framework.

    cd /var/www/laravel
    composer install
    

    Dependency installation will take some time. After that set proper permissions on files.

    chown -R username:apache /var/www/laravel
    chmod -R 755 /var/www/laravel
    chmod -R 755 /var/www/laravel/storage
    

    SELinux enabled systems also run the below command to allow writing on the storage directory.

    chcon -R -t httpd_sys_rw_content_t /var/www/laravel/storage
    

    Step 3 – Configure Laravel Environment

    Laravel uses .env file for environment configuration. Use .env file for configuring all the environment variables for your application like the database, SMTP, security key, etc.

    cp .env.example .env
    

    Now set the 32-bit long random number encryption key, which is used by the Illuminate encrypter service.

    php artisan key:generate
    
    Application key set successfully.
    

    You can view the .env file to find the Application key is configured. In addition, you can also update the MySQL database configuration details in .env file as below.

    DB_HOST=localhost
    DB_DATABASE=laravel
    DB_USERNAME=username
    DB_PASSWORD=password
    

    Step 4 – Run Laravel with Artisan

    For the development purpose, you can run a Laravel application with Artisan command-line interface. Artisan starts a Laravel development server on your system, which you can access in a web browser.

    php artisan serve
    
    Laravel development server started: http://127.0.0.1:8000
    

    The default Artisan starts Laravel on port 8000 for localhost only. To access Laravel over the network specify your system IP with –host option or use IP 0.0.0.0 for public access.

    You can also use –port followed by the port number to use another port to serve the Laravel application. For example, use the below command.

    php artisan serve --host 0.0.0.0 --port 8000
    
    Laravel development server started: http://0.0.0.0:8000
    

    Setup Laravel Fedora PHP Artisan

    Step 5 – Setup Laravel with Apache

    Now add a Virtual Host in your Apache configuration file to access the Laravel framework in a web browser. To create an Apache configuration file /etc/httpd/conf.d/laravel.conf

    sudo vi /etc/httpd/conf.d/laravel.conf
    

    and add the following settings:

    File: /etc/httpd/conf.d/laravel.conf
    <VirtualHost *:80>
           ServerName laravel.tecadmin.net
           DocumentRoot /var/www/laravel/public
    
           <Directory /var/www/laravel>
                  AllowOverride All
           </Directory>
    </VirtualHost>
    

    Save your file and restart Apache service:

    sudo systemctl restart httpd.service
    

    Then access the Laravel website in a web browser with the specified domain name. Make sure the domain/subdomain is correctly pointed to the Laravel server in DNS.

    Laravel Fedora with Apache

    Conclusion

    In conclusion, you have configured Laravel on your Fedora system. Now, you can follow our tutorials like: Clear Laravel Cache, Check Laravel Version and Remove index.php from URL in Laravel.

    Laravel php framework
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email WhatsApp
    Previous ArticleHow to Setup Selenium with Chrome Driver on Fedora
    Next Article Recursively Count Number of Files within a Directory in Linux

    Related Posts

    How to Find Django Install Location in Linux

    Updated:April 27, 20221 Min Read

    (Resolved) – ReactJS 404 Error on Page Reload

    2 Mins Read

    Adding a New SSH Key in GitHub

    Updated:April 1, 20223 Mins Read

    13 Best Linux Terminal Emulators and Bash Editors

    8 Mins Read

    How To Install Oracle VirtualBox on Debian 11

    2 Mins Read

    10 Best Linux FTP Clients in 2022

    5 Mins Read

    Leave A Reply Cancel Reply

    Recent Posts
    • How to Enable / disable Firewall in Windows
    • How to Install JAVA on Ubuntu 22.04
    • Switching Display Manager in Ubuntu – GDM, LightDM & SDDM
    • Changing the Login Screen Background in Ubuntu 22.04 & 20.04
    • How To Install PHP (8.1, 7.4 or 5.6) on Ubuntu 22.04
    Facebook Twitter Instagram Pinterest
    © 2022 Tecadmin.net. All Rights Reserved | Terms  | Privacy Policy

    Type above and press Enter to search. Press Esc to cancel.