Install and configure LAMP (Linux Apache MySQL and PHP) on Arch Linux 2016

This tutorial is going to show you how to install and configure LAMP stack on Arch Linux 2016. LAMP (Linux, Apache, MySQL and PHP) is a fundamental tool to build a powerful web server and web applications.

System Summary:

  • Arch Linux 2016
  • IP address: 10.34.0.179

Step 1. Install Apache Web Server

To install Apache web server on Arch Linux, use the following command on Terminal

Now start the httpd service

Check the status :

Output:

[dhani@arch-linux]: ~>$ systemctl status httpd.service
● httpd.service – Apache Web Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor prese
Active: active (running) since Sat 2016-12-17 18:04:52 WIB; 51min ago
Main PID: 699 (httpd)
Tasks: 82 (limit: 4915)
CGroup: /system.slice/httpd.service
├─699 /usr/bin/httpd -k start -DFOREGROUND
├─700 /usr/bin/httpd -k start -DFOREGROUND
├─701 /usr/bin/httpd -k start -DFOREGROUND
└─702 /usr/bin/httpd -k start -DFOREGROUND

Dec 17 18:04:52 arch-linux systemd[1]: Started Apache Web Server.

Now check if the web server is running. Open web browser and type the server ip address:

Step 2. Install MySQL / MariaDb

Initialize MariaDb data directory

Start MariaDb server

Verify the MariaDb status

Secure MySQL installation

The following command should be executed in order to change the default root password for MySQL

At this point, MySQL server is ready.

Step 3. Install PHP

Configure apache PHP module

Comment out the following line

#LoadModule mpm_event_module modules/mod_mpm_event.so

Also copy and paste the following lines to the bottom of the httpd.conf file

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
LoadModule php7_module modules/libphp7.so
AddHandler php7-script php
Include conf/extra/php7_module.conf

At this point PHP is now installed on Arch Linux. It is good to make sure that PHP is working well on our Arch Linux. Now do the following to test it.

Now paste the following lines

<?php
phpinfo();
?>

Restart the web server

Now open web browser and point to the server IP address as follow

http://10.34.0.179/test.php

Ok at this point we have installed Apache web server, MySQL Server and also PHP.

Ariel

Leave a Reply

Your email address will not be published. Required fields are marked *