OpenSUSE is a Linux distribution, sponsored by SUSE. It is a great new distribution, stable and with outstanding tools like Yast. That’s why more and more developers are using it as their main system, which indicates its broad functionality. So, I will teach you how to install Laravel PHP Framework on OpenSUSE 15.
As you know, we like Laravel, and that’s why we talked about it here. In case you don’t know, Laravel is a PHP framework that pays a lot of mind to the application code. That is to say, it stands out for being very understandable to the user, without leaving aside the speed and security of the data.
So, let’s start to install Laravel PHP Framework on OpenSUSE 15. It’s simple.
The installation of Laravel, should not cost much work, however, there are a series of minimum requirements to be able to do the procedure in the best possible way. First of all, it is necessary to know the Linux terminal.
On the other hand, your user must be able to use sudo because packages have to be installed and permission as root is required.
Finally, your computer must be able to run PHP and Apache. Don’t worry, any modern computer should.
1. Upgrade OpenSUSE
The first step to install Laravel PHP on OpenSUSE 15 is to upgrade the operating system. It is recommended to do this at all times.
:~$ sudo zypper up
With this your system will have the latest security patches and will be more robust.
2. Install Apache web server
Now you need to install Apache to be able to work more comfortably on your project. To do this, run on a terminal:
:~$ sudo zypper in apache2
Next, enable and start the service.
:~$ sudo systemctl enable apache2 :~$ sudo systemctl start apache2
Set the firewall rule for Apache.
:~$ sudo firewall-cmd --add-service=http --permanent :~$ sudo firewall-cmd --reload
Now, open your web browser and go to http://IP_SERVER. You will see this.
The image says we don’t have permission to access Apache’s root. Don’t worry, that’s OpenSUSE policy and for now I won’t modify it. So, Apache is installed.
2. Install MariaDB
If you are going to develop in Laravel, you will need a database manager. Laravel supports several, but I will install MariaDB.
:~$ sudo zypper in mariadb
When the installation is complete. It is necessary to start the MariaDB service. Then, it is time to define a root password using the
:~$ sudo systemctl enable mariadb :~$ sudo systemctl start mariadb
:~$ sudo mysql_secure_installation
After defining the root password, you will be asked some questions regarding the configuration of the MariaDB server. You can answer as you like, I did it this way.
Remove anonymous users? [Y/n] y Disallow root login remotely? [Y/n] n Remove test database and access to it? [Y/n] y Reload privilege tables now? [Y/n] y
3. Install PHP
The latest stable version of Laravel requires at least PHP 7.1. It’s a good version. In OpenSUSE 15 version 7.2 is available via official repositories. So there are no problems.
:~$ sudo zypper in php7 php7-openssl php7-pdo php7-mbstring php7-tokenizer php7-xmlreader php7-phar php7-zip php7-xmlwriter php7-ctype php7-json php7-mysql
As you can see, I have also installed some PHP modules required by Laravel.
Then, enable PHP module and restart Apache2.
:~$ sudo a2enmod php7 :~$ sudo systemctl apache2
4. Install Laravel PHP Framework
A simple and efficient way to install Laravel PHP Framework on any Linux distribution is with Composer.
Composer is a PHP dependency manager that greatly simplifies the handling of dependencies. So, let’s install it first.
:~$ curl -sS https://getcomposer.org/installer | php :~$ sudo mv composer.phar /usr/local/bin/composer :~$ sudo chmod +x /usr/local/bin/composer
Next, create a new Laravel project.
:~$ composer create-project --prefer-dist laravel/laravel example
Of course, replace example with the name of your project.
Next, serve your project.
:~$ cd example :~$ php artisan serve
This will serve you project on
http://localhost:8000. However, you can serve the project with a specific host and port. But you have to open the ports.
:~$ sudo firewall-cmd --add-port=8000/tcp --permanent :~$ sudo firewall-cmd --add-port=8765/tcp --permanent :~$ sudo firewall-cmd --reload
:~$ cd example/ :~$ php artisan serve --host=192.168.250.3 --port=8765
Now, open your web browser and go to http://IP_SERVER:8765/. Or
http://localhost:8000 depending on the case.
And that’s it.
The installation of Laravel is something simple that can be achieved after a few minutes. Laravel is a very powerful framework that more and more people are using.
Please share this post with your friends.