Install LAMP (Apache2,MariaDB and PHP) on openSUSE 13.2


openSUSE Logo

LAMP stands for Linux, Apache,MySQL and PHP, of course Linux can be any variant (Debian/Redhat), here is the small tutorial about installing AMP stack on openSUSE 13.2., MySQL is replaced by MariaDB as a default database.


OS: openSUSE 13.2

Install Apache:

To start off we will install Apache. Open up the Terminal and Switch to root user.

raj@server:~> su -

Package name of the Apache is apache2, install it using zypper. Type the following Command in the terminal and then press enter.

server:~ # zypper install apache2

Start the Apache by using the following command.

server:~ # systemctl start apache2.service

To make the apache to start during the every boot, type the following on terminal and hit enter.

server:~ # systemctl enable apache2.service

Testing Apache:

To make sure everything installed correctly we will now test Apache to ensure it is working properly.

Open up any web browser and then enter the following into the web address:

 http://localhost/  or  http://your-ip-address

You will get the web page saying “Access forbidden!”, this confirms that the Apache is working fine. Apache’s default document root is /srv/www/htdocs/ on OpenSUSE, the configuration file is /etc/apache2/httpd.conf. Additional configurations are stored in the /etc/apache2/conf.d/ directory.

openSUSE 13.2 - LAMP Installation - Apache default page
openSUSE 13.2 – LAMP Installation – Apache default page

Install MySQL:

Next is to install the MySQL on openSUSE, now it is a MariaDB package. Type the following command and then Press Enter.

server:~ #  zypper install mariadb

Start MySQL server.

[root@SRV01 ~]# systemctl start mysql.service

To make the MySQL to start during the every boot, Type the following on terminal and hit Enter.

server:~ # systemctl enable mysql.service

Nex is to make the MariaDB secure by using the mysql_secure_installation command.

This program enables you to improve the security of your MariaDB installation in the following ways:

  • You can set a password for root accounts.
  • You can remove root accounts that are accessible from outside the local host.
  • You can remove anonymous-user accounts.
  • You can remove the test database (which by default can be accessed by all users, even anonymous users), and privileges that permit anyone to access databases with names that start with test_.

[[email protected] ~]# mysql_secure_installation


In order to log into MariaDB to secure it, we’ll need the current
password for the root user. If you’ve just installed MariaDB, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): <— Enter Current root password
OK, successfully used password, moving on…

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] y <— Set root password
New password: <— Enter root password
Re-enter new password: <— Re enter root password
Password updated successfully!
Reloading privilege tables..
… Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] y <— Remove anonymous user
… Success!

Normally, root should only be allowed to connect from ‘localhost’. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] y <— root remote login
… Success!

By default, MariaDB comes with a database named ‘test’ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] y <— Remove the test database
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] y <— Save the changes
… Success!

Cleaning up…

All done! If you’ve completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Install PHP:

By default Apache server supports the HTML language only; not PHP, for that we need to install PHP. To install PHP please follow the steps.

Type following line into terminal and press enter: This command includes support package for the MySQL.

server:~ # zypper install php5 php5-mysql apache2-mod_php5

You need to restart the server after the installation of the PHP, to do that type the following on the terminal.

server:~ # systemctl restart apache2.service

Testing PHP:

To test PHP, place a PHP file on to the default directory of the Apache. The document root of the default web site is /srv/www/htdocs/. We will now create a small PHP file (info.php) in that directory and call it in a browser. The file will display lots of useful details about our PHP installation, such as the installed PHP version.

In the terminal copy/paste the following line:

[root@SRV01 ~]# vi /srv/www/htdocs/info.php

This will open up a file called info.php.

Copy/Paste this line into the phpinfo file:

<?php phpinfo(); ?>

Save and close the file. use Esc + :wq for saving the file.

Now open you’re web browser and type the following into the web address:

http://localhost/info.php or http://your-ip-address/info.php

The page look like below:

openSUSE 13.2 - LAMP Installation - PHP info
openSUSE 13.2 – LAMP Installation – PHP info

Scroll down the browser to modules section to check the support for the MariaDB. you will get the screen like below.

openSUSE 13.2 - LAMP Installation - PHP info MySQL
openSUSE 13.2 – LAMP Installation – PHP info MySQL

That’s All!, you have successfully installed the LAMP on openSUSE 13.2. You can take a look at installing phpMyAdmin, this will help you to manage databases using web browser.


Share This Post

  • sau geil


  • ketil ervik

    Not working on opensuse 13.2

    • whats the issue you are facing, could you please share that

      • ketil ervik

        I try again, and maby i ciming back soon. Thanks for answear.

      • ketil ervik

        That is this? Save and close the file. use Esc + :wq for saving the file.
        I have try that, not working

    • Jeff Cold

      Edit the /etc/sysconfig/apache2 file. In that file, go to APACHE_MODULES= and make sure php5 is in that list. Restart apache2 with systemctl apache2.service