How to install Laravel 5 on Fedora 29?

0
724
Laravel
Laravel

Normally to ensure the quality of web applications are developed using a Framework. Laravel is one of the best frameworks for it. So, In this article, I will show you how to install Laravel in Fedora 29.

Laravel is a PHP framework that offers the possibility of developing applications quickly, agile and with a readable source code. So, many developers use it to make their most popular applications.

In short, this is a nice framework to develop web applications very quickly with a beautiful source code.

So, let’s install Laravel on Fedora 29.

1. Install Apache web server

Laravel is compatible with several web servers, but in that case, I will use the Apache web server, because it is the simplest one. Open a Terminal and run this command:

:~$ sudo dnf install httpd
1.- Install apache web server
1.- Install Apache web server

Next, enable and start the service:

:~$ sudo systemctl enable httpd
:~$ sudo systemctl start httpd

Finally, check the service status.

:~$ sudo systemctl status httpd
2.- Enabling, starting and checking the httpd service
2.- Enabling, starting and checking the httpd service

Now, Apache web server is installed and running correctly.

2. Install MariaDB

Again, Larevel is compatible with several database managers, such as PostgreSQL or SQLite, however, for this post, I will use MariaDB.

:~$ sudo dnf install mariadb-server
3.- Installing MariaDB
3.- Installing MariaDB

Then, enable and start the MariaDB service.

:~$ sudo systemctl enable mariadb
:~$ sudo systemctl start mariadb

Next, set the root password with mysql_secure_installation script.

:~$ sudo mysql_secure_installation
4.- Using the mysql_secure_installation
4.- Using the mysql_secure_installation

As you can see, there are a few questions. I answered Y, N, Y, Y. All depends on you.

MariaDB is correctly installed.

3. Install PHP

Since it is a PHP framework it is obvious that you must install PHP. So let’s go for it.

:~$ sudo dnf install php php-common php-cli php-pdo php-mbstring php-zip php-xml php-cli php-json
5.- Installing PHP
5.- Installing PHP

Next, restart apache web server.

:~$ sudo systemctl restart httpd

4. Install Composer

Composer is a dependencies manager for PHP. So, it is very useful to manage libraries required by our projects and is used to install Laravel.

:~$ curl -sS https://getcomposer.org/installer | php
6.- Installing Composer
6.- Installing Composer

Then, make sure that Composer can be used globally in the terminal.

:~$ sudo mv composer.phar /usr/local/bin/composer
:~$ sudo chmod +x /usr/local/bin/composer
:~$ composer -v
Making Composer available as a command
Making Composer available as a command

Now, you can install Laravel.

5. Install Laravel

It’s time to install Laravel. So, run this command.

:~$ composer global require "laravel/installer"

Once the installation is finished. You can create a new project. But, first, make Laravel executable available for the system.

:~$ echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >> ~/.bashrc

Then, close the terminal and open it again. Now, create a project.

:~$ laravel new example
8.- Creating a new project
8.- Creating a new project
9.- Project created!
9.- Project created!

Then, start the Laravel instance.

:~$ php artisan serve
10.- Starting new laravel instance
10.- Starting new laravel instance

As you can see, the IP address you need to go is 127.0.0.1:8000.

Open your web browser and go to the IP address.

11.- Laravel default page
11.- Laravel default page

Laravel is correctly installed.

If you want to use MariaDB in a project with Laravel, then you need to edit the .env file located in the project. In it, you must specify database, port, user, and password of the user MariaDB.

Conclusion

As you’ve seen, installing Laravel on Fedora 29 is simple, you just have to have a basic knowledge about LAMP and that’s it.

So, Please share this article with your friends.

You can also read “How to install Yii PHP Framework on Debian 9?

 

LEAVE A REPLY

Please enter your comment!
Please enter your name here