Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Install LAMP - Apache, PHP, MariaDB and PhpMyAdmin in OpenSUSE
The LAMP stack, which stands for Linux, Apache, MySQL/MariaDB, and PHP, is a powerful combination of opensource software widely used for web development and hosting. In this tutorial, we will guide you through the process of installing and configuring the LAMP stack on openSUSE, a popular Linux distribution.
Step 1: Update System Packages
Before we begin, it is essential to update the system packages to ensure that we have the latest software versions and security patches ?
sudo zypper refresh sudo zypper update
Step 2: Install Apache
Apache is a widely used web server that serves as the backbone of the LAMP stack. To install Apache, execute the following command ?
sudo zypper install apache2
Loading repository data... Reading installed packages... Resolving package dependencies... The following NEW package is going to be installed: apache2 1 new package to install. Overall download size: 5.2 MiB. After the operation, additional 25.8 MiB will be used. Continue? [y/n] (y): y
Once the installation is complete, start and enable the Apache service ?
sudo systemctl start apache2 sudo systemctl enable apache2
$ sudo systemctl start apache2 $ sudo systemctl enable apache2 Created symlink /etc/systemd/system/multi-user.target.wants/apache2.service ? /lib/systemd/system/apache2.service.
Step 3: Install PHP
PHP is a popular scripting language used for web development. To install PHP and its required dependencies, run the following command ?
sudo zypper install php8 php8-mysql apache2-mod_php8
Loading repository data... Reading installed packages... Resolving package dependencies... The following 3 NEW packages are going to be installed: apache2-mod_php8 php8 php8-mysql 3 new packages to install. Overall download size: 12.5 MiB. After the operation, additional 45.2 MiB will be used. Continue? [y/n] (y): y
Step 4: Install MariaDB
MariaDB is a dropin replacement for MySQL and provides a powerful and robust relational database management system ?
sudo zypper install mariadb mariadb-client
Loading repository data... Reading installed packages... Resolving package dependencies... The following 2 NEW packages are going to be installed: mariadb mariadb-client 2 new packages to install. Overall download size: 150.1 MiB. After the operation, additional 672.9 MiB will be used. Continue? [y/n] (y): y
Start and enable the MariaDB service ?
sudo systemctl start mariadb sudo systemctl enable mariadb
$ sudo systemctl start mariadb $ sudo systemctl enable mariadb Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service ? /lib/systemd/system/mariadb.service.
To secure your MariaDB installation, run the security script ?
sudo mysql_secure_installation
Securing the MySQL server deployment. Enter password for user root: Set root password? [Y/n] Y New password: Re-enter new password: Remove anonymous users? [Y/n] Y Disallow root login remotely? [Y/n] Y Remove test database and access to it? [Y/n] Y Reload privilege tables now? [Y/n] Y All done!
Step 5: Install PhpMyAdmin
PhpMyAdmin is a webbased interface used to manage MySQL/MariaDB databases ?
sudo zypper install phpMyAdmin
Note: During installation, select "apache2" when prompted for the webserver and "yes" to configure the database for phpMyAdmin.
Step 6: Configure Apache for PhpMyAdmin
Create an Apache configuration file for PhpMyAdmin ?
sudo nano /etc/apache2/conf.d/phpMyAdmin.conf
Add the following configuration ?
Alias /phpMyAdmin /srv/www/htdocs/phpMyAdmin
<Directory /srv/www/htdocs/phpMyAdmin>
DirectoryIndex index.php
AllowOverride All
Require all granted
</Directory>
Step 7: Restart Apache
Restart the Apache service for the changes to take effect ?
sudo systemctl restart apache2
Step 8: Test Your LAMP Stack
Create a test PHP file to verify your installation ?
sudo nano /srv/www/htdocs/info.php
Add the following PHP code ?
<?php phpinfo(); ?>
Access http://localhost/info.php in your web browser to see the PHP configuration. For PhpMyAdmin, visit http://localhost/phpMyAdmin and log in with your MariaDB root credentials.
Conclusion
You have successfully installed the LAMP stack on openSUSE with Apache, PHP, MariaDB, and PhpMyAdmin. This setup provides a complete web development environment for building and deploying web applications.
