How to install LAMP - Apache, Mariadb & php on Manjaro/Arch Linux - How to integrate phpMyAdmin & Wordpress to LAMP stack on a local enviornment

For Manjaro being number one on distrowatch it sure is hard to find a guide to follow. I’ve lost some sleep to compile a more complete guide on how to properly setup LAMP stack and integrate Wordpress. Using either MariaDB(terminal), Adminer(GUI), or phpMyAdmin(GUI) for database management on localhost. It’s possible to configure a DNS and host your own server but that’s better suited for an OS such as CentOS. This is meant to be a configuration to develop Wordpress on a local enviornment.

#PREREQUISITES
##Update system

pacman -Syyu

##Install apache, php & mariadb

pacman -S apache php php-apache mariadb

<=====================================================>

#FIREWALL CONFIG
##Enable firewall on system startup

ufw enable

##Add apache exception

ufw allow http

##Create symlink

systemctl enable ufw

##Start firewall

systemctl start ufw

<=====================================================>

#TEST APACHE
##Create test index file

nano /srv/http/index.html

##Copy text below in to index.html file and save changes

<h3>If you see this in browser; Apache is running</h3>

##Restart httpd to refresh changes

systemctl restart httpd

##Open browser and direct to localhost or 127.0.0.1

<=====================================================>

#SETUP MARIADB
##Initialize mariadb data directory

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

##Create symlink

systemctl enable mysqld

##Start mysqld

systemctl start mysqld

##Run mysql install

mysql_secure_installation

#SETUP DB & USER IN MARIADB(can use adminer or phpmyadmin)
##Login to mysql as root user

mysql -u root -p

##Replace $ with your info
##Create database & user

create database $your_db default character set utf8 default collate utf8_bin;
create user $your_user@‘localhost’ IDENTIFIED BY ‘$your_user’;

##Add user & give all privileges

GRANT ALL PRIVILEGES ON $your_db.* to $your_user@‘localhost’ IDENTIFIED BY ‘$your_user’;
FLUSH PRIVILEGES;
quit

<=====================================================>

#SETUP APACHE
##Create symlink

systemctl enable httpd

##Open httpd.config

nano /etc/httpd/conf/httpd.conf

##Comment out by adding a hashtag(#)

#LoadModule mpm_event_module modules/mod_mpm_event.so

##Uncomment by removing the hashtag(#)

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
LoadModule rewrite_module modules/mod_rewrite.so

##Add following lines to bottom of httpd.config and save changes(ctrl+x)

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

##Only add one or the other depending on if you’re using adminer/phpmyadmin

Include conf/extra/httpd-adminer.conf
Include conf/extra/phpmyadmin.conf

<=====================================================>

#TEST PHP
##Create test php file

nano /srv/http/test.php

##Copy text below in to test.php file and save changes

<?php phpinfo(); ?>

##Restart httpd to refresh changes

systemctl restart httpd

##Open browser and direct to localhost/test.php or 127.0.0.1/test.php

<=====================================================>

#INTEGRATE WORDPRESS
##Set terminal where you want to keep latest.tar.gz

cd /tmp/

##Download latest wordpress

wget http://wordpress.org/latest.tar.gz

##Unzip wordpress tar file

tar xfz latest.tar.gz

##Move wordpress folder to root web directory

mv wordpress /srv/http/

##Open browser and direct to localhost/wordpress or 127.0.0.1/wordpress

database name = the database you made
username = the user you created under that database
password = password created or skipped
database host = localhost
table prefix = wp_

##Create wp-config.php file

nano /srv/http/wordpress/wp-config.php

##Copy the wp-config.php content from setup-config.php and save changes
##Run the installation
##Fill out install.php

<=====================================================>

#INTEGRATE ADMINER(optional)
##Install adminer

yaourt -S adminer

##Edit php.ini

nano /etc/php/php.ini

##Uncomment extensions by removing semicolon to run adminer

extension=mysqli
extension=pdo_mysql

<=====================================================>

#INTEGRATE PHPMYADMIN(optional)
##Install phpmyadmin

pacman -S phpmyadmin

##Edit php.ini file

nano /etc/php/php.ini

##Uncomment the following lines by removing the semicolons(:wink: and save changes

extension=mysqli
extension=bz2

##Create config file for phpmyadmin

nano /etc/httpd/conf/extra/phpmyadmin.conf

##Copy text in to phpmyadmin.conf file and save changes(ctrl+x)

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

##Restart httpd to refresh changes

systemctl restart httpd

##Open browser and direct to localhost/phpmyadmin or 127.0.0.1/phpmyadmin
##You can login with root/root and create a database, click privileges, add user account set host name to local/localhost, grant all privileges

7 Likes

Nice tutorial! Well done!
I may just commend
mysqld is an alias to mariadb, for backwards compatibility IIRC. You could use mariadb instead.
I think that the basic landing files were auto created but I am not sure.
For your WP questions, you would probably find answers elsewhere :wink:

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.