Introduction
LAMP stands for Linux, Apache, MySQL, and PHP. Together, they provide a proven set of software for delivering high-performance web applications. Each component contributes essential capabilities to the stack.
It is a set of programs or libraries that when installed 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.
This article will explain how to install the LAMP stack on openSUSE 15.2.
Install the Apache web server
- Update the package index.
$ sudo zypper update
- Install the apache web server by using the following command.
$ sudo zypper install apache2
- Enabling the apache2 web server.
$ sudo systemctl enable apache2
- Start the apache2 web server.
$ sudo systemctl start apache2
- Upon starting the Apache web server, make sure to check the status of the server.
Output$ sudo systemctl status apache2
-
By default, the openSUSE firewall prohibits public access to port '80'. To allow public access, you need to edit the firewall configuration file.
$ sudo vi /etc/sysconfig/SuSEfirewall2
- Search the following line
FW_SERVICES_EXT_TCP
and add the port number as80
.
Save and close the file.FW_SERVICES_EXT_TCP="80"
- Restart the configuration file.
$ sudo systemctl restart SuSEfirewall2
Install MariaDB
-
Install the MariaDB server and client by running the following command.
$ sudo zypper install mariadb mariadb-client mariadb-tools
- Starting the MariaDB.
$ sudo systemctl start mariadb
- Enable the MariaDB.
$ sudo systemctl enable mariadb
- Upon starting the MariaDB, make sure to check its status.
Output$ sudo systemctl status mariadb
-
For securing your database run the below command and provide the required answers as desired.
$ sudo mysql_secure_installation
Output
Install PHP7
-
Install PHP7 and PHP7 extensions.
$ sudo zypper install php7 php7-mysql apache2-mod_php7
-
Enable the PHP module and restart the Apache web server.
$ sudo a2enmod php7 $ sudo systemctl restart apache2
- Verify the PHP installation.
Edit the file with the following code.$ sudo vi /srv/www/htdocs/test.php
Save and close the file.<?php phpinfo(); ?>
- Now, open the browser and enter the following URL to verify PHP information.
(your_instance_IPv4_address)/test.php
Output