How to install and configure LAMP in Open SUSE Leap

To install and configure LAMP setup in Open SUSE Leap

LAMP is an web development platform for Linux systems. It uses Apache as the web server, MySQL as the relational database management system and PHP as the scripting language. LAMP stands for Linux, Apache, Mariadb or Mysql, Php and Phpmyadmin. Installation and configuration of LAMP setup is discussed in this manual.

Installation of Apache

Run the below command to install the Apache web server.

linuxhelp:/home/user1 # zypper install apache2
Loading repository data...
Reading installed packages...
Resolving package dependencies...
.
.
.
(5/6) Installing: apache2-prefork-2.4.16-12.1 ...............................................[done]
(6/6) Installing: apache2-mod_dnssd-0.6-23.1 ................................................[done]


Then you need to start the Apache service by using the below given command.

linuxhelp:/home/user1 # systemctl start apache2


Next enable the Apache service to access.

linuxhelp:/home/user1 # systemctl enable apache2


Checkout the status of Apache as given below.

linuxhelp:/home/user1 # systemctl status apache2


Now its time to create a file named index.html in the Apache web-root directory.

linuxhelp:/home/user1 # cd /srv/www/htdocs/
linuxhelp:/srv/www/htdocs # vim index.html


Just make a click on the browser and enter your server ip or hostname to know the apache working status.

Installation of MariaDB

Run the below given command line to install the Mariadb package.

linuxhelp: # zypper install mariadb mariadb-client mariadb-tools
Loading repository data...
Reading installed packages...
Resolving package dependencies...
.
.
.
(9/9) Installing: mariadb-tools-10.0.26-9.1 .................................................[done]
Update notifications were received from the following packages:
mariadb-10.0.26-9.1.x86_64 (/var/adm/update-messages/mariadb-10.0.26-9.1)


Here you need to start and enable the MariaDB service.

linuxhelp: # systemctl start mysql
linuxhelp: # systemctl enable mysql


If you want to check the status of Mariadb, use the below command.

linuxhelp: # systemctl status mysql


Create and set the root password to access MariaDB.

linuxhelp: # 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):
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
New password:
Re-enter new 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
... 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
... 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
- 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
... 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!


Open the Mariadb shell and execute some mysql commands.

linuxhelp: # mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with   or g.
Your MariaDB connection id is 12
Server version: 10.0.26-MariaDB SLE 12 SP1 package

Copyright (c) 2000, 2016, Oracle, MariaDB Corporation Ab and others.

Type ' help '  or ' h'  for help. Type ' c'  to clear the current input statement.

MariaDB [(none)]>  show databases 
+--------------------+
| Database |
+--------------------+
| information_schema |
| mysql |
| performance_schema |
+--------------------+
3 rows in set (0.00 sec)

MariaDB [(none)]>  q
Bye

Installation of PHP

Run the below command to install the PHP package.

linuxhelp:~ # zypper install php5 php5-mysql apache2-mod_php5
Loading repository data...
Reading installed packages...
Resolving package dependencies...
.
.
.
(11/12) Installing: php5-mysql-5.5.14-56.1 ..................................................[done]
(12/12) Installing: php5-xmlreader-5.5.14-56.1 ..............................................[done]


Create a PHP file in the web-root directory and add some lines as shown below.

linuxhelp:/srv/www/htdocs # vim text.php

Now its time to restart the Apache service.

linuxhelp:/srv/www/htdocs # systemctl restart apache2


Let us open the web-browser and enter server IP. Here you can able to see the result.

Installation of PhpMyAdmin

Run the below command to install PhpMyAdmin package.

linuxhelp:s # zypper install phpMyAdmin
Loading repository data...
Reading installed packages...
Resolving package dependencies...
.
.
.
(8/9) Installing: php5-mcrypt-5.5.14-56.1 ...................................................[done]
(9/9) Installing: phpMyAdmin-4.4.15.8-25.1 ..................................................[done]


Open the php.ini file, go to line no 873 and uncomment that line. After that save and quit the configuration file.

linuxhelp:~ # vim /etc/php5/apache2/php.ini

Give full permission to the /var/lib directory.

linuxhelp:~ # cd /var/lib/
linuxhelp:/var/lib # chmod -R 777 php5


And also give permission to the phpmyadmin directory which is presented in the web-root directory.

linuxhelp:~ # chmod -R 775 /srv/www/htdocs/phpMyAdmin


Now its time to restart the Apache service.

linuxhelp:~ # systemctl restart apache2


Finally open the browser with your server IP along with the PhpMyadmin path. Enter the following credentials in the PhpMyAdmin login page.

Now you can able to view and access the phpmyadmin page. This will helps you to run dynamic web sites and servers.


Tag : LAMP
FAQ
Q
Do I have to use an incident to get support for a bug?
A
Yes. If you are an Academic customer or Partner with a limited incident, we will credit back the incident upon your request if the issue you are reporting has not already been documented in our release notes, patch documentation, or as a TID in our support knowledgebase.
Q
What's lampi in Open SUSE Leap?
A
It s Stack that is required for webapplication setup. Apache Linux Mysql PHP
Q
Shall I enable the apache at the end?
A
You can but it is not recommended , enabling the service will make you to verify the installation too
Q
How to check apache status on centsos 6?
A
You can verify using " service httpd status" command
Q
What is SUSE CHAT?
A
SUSE offers the ability for customers to choose chat as a method of receiving support. This method provides the ability for Technical Support Engineers to chat, diagnose, and establish remote control all through a single tool and session.