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
Next, enable and start the service:
:~$ sudo systemctl enable httpd :~$ sudo systemctl start httpd
Finally, check the service status.
:~$ sudo systemctl status httpd
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
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
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
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
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
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
Then, start the Laravel instance.
:~$ php artisan serve
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.
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?”
So, why did you install Apache if you are not using it?…