How to install LAMP (Apache, MySQL, PHP) and phpMyAdmin in Manjaro; valid for base Arch

phpMyAdmin in Manjaro

There are many things in Linux that are easier than in Windows, but it is also true that a lot of information is found earlier for Windows. Things like working with PHP or accessing an FTP server from the same file manager are much better on Linux, and for that reason I tend to move better on systems with the penguin kernel. The downside is that what works for one distribution is not always valid for another, and install phpMyAdmin and all LAMP on Manjaro and other Arch-based distros it is not the same as on Debian derivatives.

But it is also true that everything (or almost everything) that can be done in a Linux distribution can be done in another, and the only thing that is necessary is to know another path that leads us to Rome itself. get to have LAMP In Manjaro it is not difficult, and here we are going to show you the easiest path, which it is, although it may not seem so due to the total number of steps. Before we will explain what the acronyms mean: Linux, Apache, MySQL and PHP. The steps to follow would be the following:

Installing and configuring LAMP

  1. First of all, when faced with installations like this, it is worth doing a complete synchronization of the servers and updating all the available packages. We achieve that with the command
sudo pacman -Syyu
  1. With everything updated, and restarted if requested or we see that something important has been updated, we continue. In many commands we are going to need privileges, so we identify ourselves as root with:
sudo su
  1. The first thing to install will be A, that is, Apache:
pacman -S apache
  1. Now we start with editing the httpd.conf file. Here we are going to use nano, and the shortcuts we will use are Ctrl+W to search, to paste is Ctrl+Shift+V (because we are in the terminal), Ctr+O to save, Enter to commit changes and Ctrl+X to exit . It does not hurt to press the up arrow, re-enter the last command and check that we have saved the changes. The first thing will be to enter the edition of the file:
nano / etc / httpd / conf / httpd.conf
  1. We look for the following and comment it, if it is not already there:
# LoadModule unique_id_module modules/
  1. We look for ServerName and put what is necessary, uncommenting the line if it is not. For local connections:
ServerName localhost
  1. We save and close.
  2. We start the web service:
systemctl enable --now httpd
  1. We check that it is active:
systemctl status httpd
  1. We do a test, not necessary but recommended, as it will tell us that we are on the right track, putting a file named index.html in /srv/http, for which we will need permissions. For example, with this content: Hello LinuxAddicts

Creating HTML test

  1. Now we install the M, that is, MariaDB, which is the engine that Manjaro and other Arch-based distros use to manage MySQL databases.
pacman -S mariadb
  1. We initialize the MariaDB directory before starting the service.
mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
  1. When finished, we activate the service:
systemctl enable --now mariadb
  1. We check that it has started. It has to put that it is active and not show any error.
systemctl status mariadb
  1. It is advisable to put security to our database installation with a script that has been designed for it. You have to read what it puts us, but here are some suggestions:
    1. It starts with "mariadb-secure-installation" without the quotes.
    2. The password should be empty if we start it for the first time. If we have already done tests and you have another password, we need to know what it is or reset it.
    3. When asked whether to switch to unix_socket authentication, we say no.
    4. Change the password, yes.
    5. We enter it twice, once to configure it and once to confirm.
    6. Delete anonymous users, yes.
    7. Disable remote login, input, yes. This can be changed later, but it can be dangerous and connections need to be managed through a firewall.
    8. Yes to delete test database. Or not, if you want to delete it later. That database serves as an example to see some things.
    9. Reload privileges, yes.
  2. We now install P, that is, PHP:
pacman -S php php-apache
  1. We enter the Apache PHP module:
nano / etc / httpd / conf / httpd.conf
  1. We look for LoadModule and leave this like this:
#LoadModule mpm_event_module modules/
LoadModule mpm_prefork_module modules/
  1. At the end of the file, we add:
LoadModule php_module modules/
AddHandler php-script .php
Include conf/extra/php_module.conf
  1. We check the configuration with this, and it should tell us "Ok":
apachectl configtest
  1. We restart the service with:
apachectl restart
  1. We do another test, this time of PHP. In the same folder as before, /srv/http, we create the file info.php, and inside we put this text:
<?php phpinfo(); ?>;

php test

phpMyAdmin Configuration

  1. We install phpMyAdmin:
pacman -S phpmyadmin
  1. We create or edit the phpmariadb.ini file:
nano /etc/php/conf.d/phpmariadb.ini
  1. We paste this:
  1. We verify that the .ini file has been loaded (it will show the paths):
php --ini
  1. We start the Apache configuration:
nano /etc/httpd/conf/extra/phpmyadmin.conf
  1. and paste this:
Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
<Directory "/usr/share/webapps/phpMyAdmin">;
DirectoryIndex index.php
AllowOverride All
Options FollowSymlinks
Require all granted
  1. We open the Apache configuration file:
nano / etc / httpd / conf / httpd.conf
  1. At the end we add the following, and the final configuration will be as in the screenshot:
Include conf/extra/phpmyadmin.conf

Final configuration of phpMyAdmin

  1. we save and check the configuration (it should say that there are no syntax errors):
apachectl configtest
  1. We restart apache:
apachectl restart
  1. We open the phpMyAdmin configuration file:
nano /etc/webapps/phpmyadmin/
  1. We can do this step manually, but it is worth doing it this way. In another terminal, we generate a random hexadecimal number:
openssl rand -hex 16
  1. We copy what you have given us in the line where it says blowfish_secret, between the quotes. It should look like this (changing what is in quotes by the hexadecimal number from the previous step:
$cfg['blowfish_secret'] = 'valorhexadecimancreadoenelpasoanterior';
  1. Below that line, we add the temporary folder:
$cfg['TempDir'] = '/tmp';
  1. We save and exit. Now all that remains is to enter this case, localhost/phpmyadmin

If we prefer another option than phpMyAdmin, one of the best for Linux is DBeaver. If you get used to it, there are things that work better, for example, creating relationships.

And this is how you can have phpMyAdmin and LAMP on Arch based distros. If there is something different, it should be some path, but for the most part what is explained here should do.

The content of the article adheres to our principles of editorial ethics. To report an error click here.

A comment, leave yours

Leave a Comment

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



  1. Responsible for the data: AB Internet Networks 2008 SL
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   ricky said

    thank you very much for the tutorial