Manjaro : Install Apache, MariaDB – Mysql , PHP (LAMP)

Update your system / Actualizar su sistema

sudo pacman -Syyu


After updating the system, install Apache web server using command / Después de actualizar el sistema, instale el servidor web Apache usando el comando :

sudo pacman -S apache

Edit /etc/httpd/conf/httpd.conf file, Editar el archivo para configurarlo

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

Search and comment out the following line if it is not already / Busque y comente la siguiente línea si aún no lo está:

# LoadModule unique_id_module modules/

Enable Apache service to start at boot and restart Apache service using commands / El servicio Apache nable se inicia en el arranque y reinicia el servicio Apache usando comandos:

sudo systemctl enable httpd
sudo systemctl restart httpd

You can verify whether Apache is running or not with command / Puede verificar si Apache se está ejecutando o no con el comando:

sudo systemctl status httpd

Mysql MariaDB

sudo pacman -S mysql

You need to initialize the MariaDB data directory prior to starting the service. To do so, run / Debe inicializar el directorio de datos de MariaDB antes de iniciar el servicio. Para hacerlo, ejecuta:

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

Then issue the following command to enable and start MariaDB service. / Luego emita el siguiente comando para habilitar e iniciar el servicio MariaDB.

sudo systemctl enable mysqld 
sudo systemctl start mysqld

You can verify whether MariaDb is running or not using command / Puede verificar si MariaDb se está ejecutando o no con el comando:

sudo systemctl status mysqld 

Setup MySQL/MariaDB root user password

As you may know, It is recommended to setup a password for database root user. Run the following command to setup MariaDB root user password:

Como ya sabrá, se recomienda configurar una contraseña para el usuario raíz de la base de datos. Ejecute el siguiente comando para configurar la contraseña de usuario raíz de MariaDB:

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
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): `## Press Enter`
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] `## Press Enter`
New password: `## Enter password`
Re-enter new password: `## Re-enter 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] `## Press Enter`
... 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] `## Press Enter`
... 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] `## Press Enter`
- 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] `## Press Enter`
... 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!

MariaDB has been installed and ready to use.


Install Php / Para instalar php

sudo pacman -S php php-apache

After PHP is installed, we need to configure Apache PHP module.
To do so, edit /etc/httpd/conf/httpd.conf file

Después de instalar PHP, necesitamos configurar el módulo Apache PHP. Para hacerlo, edite el archivo /etc/httpd/conf/httpd.conf

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

Find the following line and comment it out:

#LoadModule mpm_event_module modules/

Uncomment or add the line / Descomente o agregue la línea:

LoadModule mpm_prefork_module modules/ 

Then, add the following lines at the bottom:

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

Now create a test.php file in the Apache root directory.

sudo nano /srv/http/test.php

Restart httpd service.

sudo systemctl restart apache2


phpMyAdmin is a graphical MySQL/MariaDB administration tool that can be used to create, edit and delete databases.

phpMyAdmin es una herramienta de administración gráfica de MySQL / MariaDB que se puede utilizar para crear, editar y eliminar bases de datos.

sudo pacman -S phpmyadmin

After installing, edit php.ini file, Después de la instalación, edite el archivo php.ini,

sudo gedit /etc/php/php.ini

Make sure the following lines are uncommented. Asegúrese de que las siguientes líneas no estén comentadas.


Next, create configuration file for phpMyAdmin / A continuación, cree el archivo de configuración para phpMyAdmin

sudo gedit /etc/httpd/conf/extra/phpmyadmin.conf

Add the following lines:

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

Then, open Apache configuration file, Luego, abra el archivo de configuración de Apache,

sudo gedit /etc/httpd/conf/httpd.conf

Add the following line at the end / Agregue la siguiente línea al final:

Include conf/extra/phpmyadmin.conf

Restart httpd service.

sudo systemctl restart httpd

Un comentario sobre “Manjaro : Install Apache, MariaDB – Mysql , PHP (LAMP)”

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *