How To Install LAMP on Manjaro 20

Install LAMP on Manjaro 20

In this tutorial, we will show you how to install LAMP on Manjaro 20. For those of you who didn’t know, LAMP stands for Linux, Apache, MySQL/MariaDB, PHP or Perl, or Python. All components are free and open-source software, and the combination is suitable for building dynamic web pages. The LAMP stack is one of the most popular server configurations in the world.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of LAMP Stack on a Manjaro 20 (Nibia).


  • A server or desktop running one of the following operating systems: Manjaro, or Arch Linux.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install LAMP on Manjaro 20 Nibia

Step 1. Before running the tutorial below, make sure that our system is up to date:

sudo pacman -Syu

Step 2. Installing Apache.

Let’s install the Apache webserver using the following command:

sudo pacman -S apache

Once the installation has been completed, open the Apache configuration file that exists on /etc/httpd/conf/httpd.conf, search and comment on the following line:
# LoadModule unique_id_module modules/

We can now enable and start the apache server by using the following command:

sudo systemctl enable httpd
sudo systemctl restart httpd

Step 3. Install MySQL.

Run the following command to install MySQL Server on Manjaro:

sudo pacman -S mysql

Once completed, begin by initializing the MySQL data directory using the following command:

sudo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql

Next, enable and start it by using the following commands:

sudo systemctl enable mysqld
sudo systemctl restart mysqld

By default, MySQL is not hardened. You can secure MySQL using the mysql_secure_installation script. you should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MySQL:

$ sudo 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
haven't set the root password yet, you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

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

You already have your root account protected, so you can safely answer 'n'.

Switch to unix_socket authentication [Y/n] Y
Enabled successfully!
Reloading privilege tables..
 ... Success!

You already have your root account protected, so you can safely answer 'n'.

Change the root password? [Y/n] n
 ... skipping.

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!

Step 4. Installing PHP.

To install PHP and PHP Apache module in Manjaro, simply use pacman the command:

sudo pacman -S php php-apache

After installation, we need to configure out PHP. Edit file: /etc/httpd/conf/httpd.conf:

sudo nano /etc/httpd/conf/httpd.conf

Find the following line and comment on it:

#LoadModule mpm_event_module modules/

Also, uncomment or add the line:

LoadModule mpm_prefork_module modules/

Then, add the following lines at the bottom of the configuration file:

LoadModule php7_module modules/
AddHandler php7-script php
Include conf/extra/php7_module.conf

Now save the file and exit. Restart the apache server to make sure all the configurations are loaded properly:

sudo systemctl restart httpd

To test the PHP installation, create a file at /srv/http/phpinfo.php and write the following PHP code:


Now open this file in the browser by visiting the localhost/phptest.php and check that the Apache server with the latest PHP version is installed on your Manjaro Linux.

Congratulations! You have successfully installed the LAMP server. Thanks for using this tutorial for installing LAMP (Apache, MariaDB, and PHP) in Manjaro 20 systems. For additional help or useful information, we recommend you to check the official Apache, MariaDB, and PHP website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!


r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button