20.5 C
Texas
angeloma
Senior Writer and partner

How to install LEMP on OpenSUSE 15 / 15.1 / SUSE?

OpenSUSE is a fairly reliable and robust distribution. So it makes it ideal for installing and running on it many web-oriented services. That’s why it has a high reputation in Europe as a Linux community solution. On the other hand, SUSE which is the mother distribution of OpenSUSE achieves the goal of being a professional and ideal Linux distribution for large enterprises. As you can see, OpenSUSE inherits the seriousness and stability of its mother. If we combine this with the availability of web services, we will have a pretty good combination. For this reason, in this post, I will teach you how to install LEMP on OpenSUSE 15/ 15.1 and SUSE.

LEMP is a set of applications that together form a web server. It consists of a Linux distribution, Nginx as the web server, MariaDB as the database manager and PHP as interpreter language. As you can see, each component can be installed separately but together they make your computer with OpenSUSE or SUSE a very fast and reliable web server.

So, let us start to install LEMP on OpenSUSE 15 and SUSE 15.

Install Lemp on OpenSUSE 15 / 15.1

1. Install Nginx

First, you need to install Nginx.

- Advertisement -

Nginx is an HTTP server that is characterized for being fast, stable and with extraordinary handling of many petitions. This makes it the fastest in its area including surpassing a veteran like Apache.

Similarly, it is worth noting that it is open source and is available for most Linux distributions.

In this post, we show you how to install Nginx on OpenSUSE 15/ 15.1.

Nginx was recently acquired by F5 networks and you can also visit this post to find out about it.

2. Install PHP

PHP is one of the most used programming languages in the construction of web applications. So with it, we will be able to develop and execute many applications built for the web. So it is necessary to install it:

:~$ sudo zypper in php7 php7-mysql apache2-mod_php7 php7-fpm php7-gd php7-mbstring

1.- Install lemp on OpenSUSE
1.- Install lemp on OpenSUSE

Then, for PHP to work with Nginx it is necessary to make some extra settings to PHP-FPM. So let’s go for it.

First, you have to locate us in the php-fpm configuration folder. Then, copy your default configuration into the file where you are going to read the configuration. Then you have to edit it:

:~$ cd /etc/php7/fpm/
:~$ sudo cp php-fpm.conf.default php-fpm.conf
:~$ sudo nano php-fpm.conf

Next, find the “error_log” line and change it:

error_log = /var/log/php-fpm.log

2.- edit the php-fpm configuration file
2.- edit the php-fpm configuration file

Now, you can save the changes and close the file.

After that, you need to edit another configuration file. But first, you have to copy again.

:~$ sudo cp /etc/php7/cli/php.ini /etc/php7/fpm/

Then, edit it.

sudo nano /etc/php7/fpm/php.ini

So, find the cgi.fix line and change it:

cgi.fix_pathinfo=0

3.- configuring php
3.- configuring PHP

Next, save the changes and close the file. And copy the file to the configuration folder.

:~$ sudo cp /etc/php7/fpm/php.ini /etc/php7/conf.d/

Then, you need to configure nginx.

:~$ cd /etc/nginx/
:~$ sudo cp nginx.conf nginx.conf.backup

Next, edit the configuration file:

:~$ sudo nano nginx.conf

And make the following changes. Add index.php on line 48.

4.- Configuring PHP
4.- Configuring PHP

5.- Set PHP configuration
5.- Set PHP configuration

Save the changes and close the file.

After that, you need to enable and start the php-fpm service.

:~$ sudo cp /etc/php7/fpm/php-fpm.d/www.conf.default /etc/php7/fpm/php-fpm.d/www.conf
:~$ sudo systemctl enable php-fpm
:~$ sudo systemctl start php-fpm

6.- Start php-fpm
6.- Start php-fpm

Finally, test PHP.

To do it, you have to create a file on /srv/www/htdocs/ called test.php.

:~$ sudo nano /srv/www/htdocs/test.php

And add the following:

<?php
phpinfo();
?>

7.- test php
7.- test php

Next, reload Nginx.

:~$ sudo systemctl reload nginx

Finally, open your web browser and go to http://Your-server/test.php

So, Nginx and PHP are working.

3. Install MariaDB

The last step is to install MariaDB as a database manager and configure it to start.

:~$ sudo zypper in mariadb mariadb-tools mariadb-client

8.- Install MariaDB
8.- Install MariaDB

So, start and enable the service:

:~$ sudo systemctl enable mysql
:~$ sudo systemctl start mysql

Then, you have to set the root password and other configurations.

:~$ sudo mysql_secure_installation

9.- Configuring Mariadb
9.- Configuring Mariadb

Once you have defined the root password, you will be asked other configuration questions that you must read carefully and choose the answers that suit your case.

So, this is it.

Install Lemp on OpenSUSE 15: conclusion

Knowing how to install and configure LEMP in OpenSUSE 15 and SUSE 15 is quite simple. However, it is vital to start running PHP applications on OpenSUSE 15. It is also important if you are a developer and starts using the right tools.

Please share this post with your friends.

 

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

1 COMMENT

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article