Install LAMP on EndeavourOS (Arch based distribution)

LAMP is the the acronym of Linux, Apache, MySQL/MariaDB, PHP/Perl/Pyhton.

Installation of

  • Apache
  • PHP
  • MariaDB

The LAMP stack is often extended with a database administration tool phpMyAdmin

  • phpMyAdmin (webapp to maintain your MariaDB installation)


Never add packages without a full system sync - to sync your system execute

sudo pacman -Syyu

All commands are execute in root context - using

su -l root

Editing system files

Edit system files using a terminal text editory. micro is a personal preference just use the one you prefer..

  • To save files in micro editor press Ctrl+s
  • To exit the micro editor press Ctrl+q
  • To search in micro editor press Ctrl+f

Either install micro or substitute micro for your terminal editor of choice

pacman -S micro

Install Apache

Install Apache web server using command

pacman -S apache

Edit the /etc/httpd/conf/httpd.conf file,

micro /etc/httpd/conf/httpd.conf

Search for and comment the following line if it is not already

# LoadModule unique_id_module modules/

Search for ServerAdmin and replace with a valid email


Next edit the ServerName at the very least enter your system's IP address

ServerName ip.x.y.z:80

Save and close the file.

Enable and start the web service

systemctl enable --now httpd

Verify the status of the service

# systemctl status httpd
● httpd.service - Apache Web Server
     Loaded: loaded (/usr/lib/systemd/system/httpd.service; enabled; preset: disabled)
     Active: active (running) since Fri 2022-11-11 13:03:33 CET; 4s ago
Nov 11 13:03:33 test systemd[1]: Started Apache Web Server.

Verify web service

Test the webservice by creating a sample page in the default web root in /srv/http

micro /srv/http/index.html

Add text - no need for our test to be strictly html compliant

<h2>It works!</h2>

Now, open your web browser and navigate to


You should be greeted with the It works message.

Install MariaDB

MariaDB is the default implementation of MySQL on Arch based distributions. To install MariaDB execute

pacman -S mariadb

Iniitialize the MariaDB data directory prior to starting the service, by using the installer script (do not change --datadir)

mariadb_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

When the script has completed enable and start the seervice

systemctl enable --now mariadb

You can verify the MariaDB service status (shortened)

# systemctl status mariadb
● mariadb.service - MariaDB 10.9.3 database server
     Loaded: loaded (/usr/lib/systemd/system/mariadb.service; enabled; preset: disabled)
     Active: active (running) since Fri 2022-11-11 13:09:51 CET; 10s ago
Nov 11 13:09:51 test systemd[1]: Started MariaDB 10.9.3 database server.

Secure your MariaDB service

Don't confuse the root password with your your system password. The root password asked using the script is for MariaDB.


Install PHP

Arch always uses latest php version. To install PHP and the apache PHP module

pacman -S php php-apache

Proceed to configure Apache PHP module by editing the file /etc/httpd/conf/httpd.conf

micro /etc/httpd/conf/httpd.conf

Search and locate the following and edit to read as below

#LoadModule mpm_event_module modules/
LoadModule mpm_prefork_module modules/

Scroll to the bottom of the file and add for current PHP

LoadModule php_module modules/
AddHandler php-script php
Include conf/extra/php_module.conf

Save the file and restart the httpd service.

systemctl restart httpd

Test PHP

Create a file phpinfo.php file in the web service root folder

micro /srv/http/phpinfo.php

With content


Save the file and open your web browser and navigate to http://ip.x.y.z/phpinfo.php which should then provide you with the currennt php configuraiton, enabled modules etc.

Install phpMyAdmin

phpMyAdmin is a graphical MySQL/MariaDB administration tool that can be used to maintain your MariaDB installation. To install phpMyAdmin

pacman -S phpmyadmin

Edit the file /etc/php/php.ini

micro /etc/php/php.ini

Modify the configuration to include the following modules (remove the ; at the beginning of the line


Save and close php.ini.

Create phpMyAdmin configuration

Then create a new Apache configuration to be able to load phpMyAdmin

micro /etc/httpd/conf/extra/phpmyadmin.conf

With content

Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
<Directory "/usr/share/webapps/phpMyAdmin">
    DirectoryIndex index.php
    AllowOverride All
    Options FollowSymlinks
    Require all granted

Edit the Apache configuraton

micro /etc/httpd/conf/httpd.conf

Include phpMyAdmin configuration at the very end of the file

Include conf/extra/phpmyadmin.conf

Save and close the file.

Edit the phpMyAdmin /etc/webapps/phpmyadmin/ and add a value for blowfish_secret

micro /etc/webapps/phpmyadmin/ 

Generated a random string

echo $(openssl rand -hex 16)

Add the value inside the empty quotation marks

$cfg['blowfish_secret'] = ''

Add a tempdir config

$cfg['TempDir'] = '/var/tmp'

Save the file and restart the httpd service

systemctl restart httpd

Test phpMyAdmin

Open your browser and navigate to