openSUSE

How To Install LAMP Stack on openSUSE

Install LAMP Stack on openSUSE

In this tutorial, we will show you how to install LAMP Stack on openSUSE. The LAMP stack, an acronym for Linux, Apache, MariaDB/MySQL, and PHP, is a powerful set of open-source software that provides a robust platform for developing and hosting web applications. Its components are widely used, making it a popular choice for web developers.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the LAMP on openSUSE.

Prerequisites

  • A server running one of the following operating systems: openSUSE.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • You will need access to the terminal to execute commands. openSUSE provides the Terminal application for this purpose. It can be found in your Applications menu.
  • You’ll need an active internet connection to download Apache, MySQL, PHP, and its dependencies.
  • You’ll need administrative (root) access or a user account with sudo privileges.

Install LAMP Stack on openSUSE

Step 1. First, update your system packages to ensure all existing software is up to date. This can prevent potential conflicts during the LAMP stack installation. Open a terminal and execute:

sudo zypper refresh
sudo zypper update

Step 2. Installing Apache Web Server.

Apache is one of the most widely used web server software due to its robustness, customization capability, and active community support. To install Apache on openSUSE, use the following command:

sudo zypper install apache2

After the installation, start the Apache server and enable it to start automatically after a reboot with these commands:

sudo systemctl start apache2
sudo systemctl enable apache2

To verify that Apache is working correctly, create an index.html file in the /srv/www/htdocs/ directory with the following content:

<html>
<body>
<h1> It works!</h1>
</body>
</html>

Then, open a web browser and navigate to ‘localhost’. You should see the “It works!” web page, indicating that the Apache Web server is running correctly.

If you have a firewall enabled, configure it to allow HTTP traffic:

sudo firewall-cmd --permanent --zone=public --add-service=http
sudo firewall-cmd --reload

Step 3. Installing MariaDB.

MariaDB is a database management system that is a fork of MySQL. It is used by various applications, including data warehousing, e-commerce, and logging programs. To install MariaDB on openSUSE, use the following command:

sudo zypper install mariadb-server

After the installation, start the MariaDB service and enable it to start automatically at boot time with these commands:

sudo systemctl enable --now mariadb

To secure your MariaDB installation, run the following command and follow the prompts:

sudo mysql_secure_installation

You can test your setup by logging into MariaDB using the following command:

mysql -u root -p

Enter the password you set up during the mysql_secure_installation process to log in.

Step 4. Installing PHP and Required Extensions.

PHP is a server-side scripting language used to generate dynamic web pages. To install PHP on openSUSE, use the following command:

sudo zypper ar -f https://download.opensuse.org/repositories/devel:/languages:/php/openSUSE_Leap_15.6/ php

Replace openSUSE_Leap_15.6 with your openSUSE version if necessary.

Now install PHP 8.3 using the zypper package manager:

sudo zypper in php8.3

Check the installed PHP version using the following command:

php -v

After the installation, restart the Apache server for the changes to take effect:

sudo systemctl restart apache2

To verify that PHP is working correctly, create an index.php file in the /srv/www/htdocs/ directory with the following content:

<?php phpinfo(); ?>

Then, open a web browser and navigate to ‘localhost/index.php’. You should see a page displaying information about your PHP configuration.

Congratulations! You have successfully installed LAMP. Thanks for using this tutorial for installing the LAMP Stack on your openSUSE system. For additional or useful information, we recommend you check the official openSUSE website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button