16 C
Texas
angeloma
Senior Writer and partner

How to install LAMP on OpenSUSE 15.2 / 15.1?

It is increasingly common to find small companies that decide to use the SUSE ecosystem for their servers. It’s an unsurprising decision because OpenSUSE is a fairly stable and solid distribution. It also has the support of a giant company like SUSE. So this co-converts it is a pretty reliable distribution for these tasks. So, in this post, I will show you how to install LAMP on OpenSUSE 15.2 / OpenSUSE 15.1. With this, you will have a fully functional basic web server.

What is LAMP?

LAMP is a set of programs or libraries that when installing on a computer, allow you to transform it into a Web server. This makes it one of the first things to do to start deploying dynamic websites.

LAMP is an acronym for Linux + Apache + MariaDB / MySQL and PHP. However, these are not the only components that allow you to have a web server, but the most popular and used.

So let’s get started.

Install LAMP on OpenSUSE 15.2

1) Install Apache

- Advertisement -

Apache is one of the most popular HTTP servers in the world. So much so that many websites run under this program. It is available for many Linux distributions so its installation should not be a problem for users.

In addition, we are looking for open source applications and Apache is bundled with a license that allows us to install it. Then, open a terminal and execute the following command:

:~$ sudo zypper in apache2
1.- Getting LAMP on OpenSUSE 15.2 / 15.1 - Install Apache
1.- Getting LAMP on OpenSUSE 15.2 / 15.1 – Install Apache

With this, Apache is installed. However, Apache is not running. Then you have to start the service. Also, it is a good idea to make it run during system startup. We achieve this with the following command:

:~$ sudo systemctl enable apache2
:~$ sudo systemctl start apache2

Checks the status of the service to make sure that everything is OK:

:~$ sudo systemctl status apache2
● apache2.service - The Apache Webserver
Loaded: loaded (/usr/lib/systemd/system/apache2.service; disabled; vendor preset: disabled)
Active: active (running) since Sun 2020-07-05 21:12:43 EDT; 39s ago
Main PID: 2376 (httpd-prefork)
Status: "Processing requests..."
Tasks: 6
CGroup: /system.slice/apache2.service
├─2376 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconf>
├─2383 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconf>
├─2384 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconf>
├─2385 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconf>
├─2386 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconf>
└─2387 /usr/sbin/httpd-prefork -DSYSCONFIG -C PidFile /var/run/httpd.pid -C Include /etc/apache2/sysconfig.d//loadmodule.conf -C Include /etc/apache2/sysconf>
Jul 05 21:12:33 osradar systemd[1]: Starting The Apache Webserver...
Jul 05 21:12:43 osradar start_apache2[2376]: AH00557: httpd-prefork: apr_sockaddr_info_get() failed for osradar
Jul 05 21:12:43 osradar start_apache2[2376]: AH00558: httpd-prefork: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'Se>
Jul 05 21:12:43 osradar systemd[1]: Started The Apache Webserver.

As you can see, everything is correctly installed. But, OpenSUSE is a pretty secure distribution that comes with a built-in firewall. Then, it is necessary to set some rules in the Firewall so that Apache can run:

:~$ sudo firewall-cmd --add-port=80/tcp --permanent
success
:~$ sudo firewall-cmd --add-port=443/tcp --permanent
success :~$ sudo firewall-cmd --reload success

Now Apache is working properly.

3) Install PHP

In order to run applications or dynamic websites we need a programming language that interprets it. PHP is, of these languages, the most popular in the world. This is because it is easy to develop, quite accessible and with good support. We could say that a web server can not lack PHP.

In a terminal, type the following command to install PHP and several of its modules.

:~$ sudo zypper in php7 php apache2-mod_php7 php7-curl php7-xmlreader php7-zip php7-pdo php7-gd php7-json php7-mysql php7-mbstring php7-openssl
2.- Install PHP
2.- Install PHP

At the end of the installation, enable the PHP module and restart Apache for the changes to take effect.

:~$ sudo a2enmod php7
:~$ sudo systemctl restart apache2

After this, it is necessary to check that PHP is running. Open a text file in the Apache Document root with some PHP code and then open it from the web browser.

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

Add the following content:

<?php
phpinfo();
?>

Then, open your web browser and open it, you should see this:

3.- PHP info on OpenSUSE 15.2 / 15.1
3.- PHP info on OpenSUSE 15.2 / 15.1

So, Apache and PHP are working properly.

4) Install MariaDB

It is now necessary to install a database manager. In this case, MariaDB is indicated by its full compatibility with MySQL but with greater community momentum. All this without sacrificing stability and robustness. So this makes it the most viable option.

To install it, just run this command:

:~$ sudo zypper in mariadb
4.- Getting LAMP on OpenSUSE 15.2 / 15.1 - Install MariaDB
4.- Getting LAMP on OpenSUSE 15.2 / 15.1 – Install MariaDB

Now we have to start the service. As with Apache, it’s a good idea to have it start along with the system:

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

Next, make sure the installation is secure by setting a root password. To do this, use the mysql_secure_installation script that is installed with the program.

5.- Configuring MariaDB
5.- Configuring MariaDB

After defining a password for the root user, you will be asked other configuration questions. Answer them carefully.

And that is it. Now, you know how to install LAMP on OpenSUSE 15.2 / 15.1.

Install LAMP on OpenSUSE 15.2 /15.1  – Conclusion

LAMP is a basic component of a web server. However, the installation is simple if we take into account that Linux has these tools. This way, you can have a basic web server for your personal projects or for the company.

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"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article