This guide walks you through installing a full LAMP stack (Linux, Apache, MariaDB, PHP) along with phpMyAdmin on Arch Linux. By the end, you’ll have a working web server with database management via a browser.
📦 Step 1: Update Your System
Always start by updating your system:
sudo pacman -Syu
🌐 Step 2: Install Apache (Web Server)
Install Apache:
sudo pacman -S apache
Configure Apache
Edit the config file:
sudo vim /etc/httpd/conf/httpd.conf
Make sure these lines are set:
Uncomment:
LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
Comment out:
#LoadModule mpm_event_module modules/mod_mpm_event.so
Start and enable Apache:
sudo systemctl enable --now httpd
Test Apache
Open your browser and go to:
http://localhost
You should see the Apache test page.
🗄️ Step 3: Install MariaDB (MySQL Alternative)
Install MariaDB:
sudo pacman -S mariadb
Initialize the database:
sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
Start and enable MariaDB:
sudo systemctl enable --now mariadb
Secure installation:
sudo mysql_secure_installation
Follow the prompts (set root password, remove test DB, etc).
🐘 Step 4: Install PHP
Install PHP and Apache module:
sudo pacman -S php php-apache
Configure PHP with Apache
Edit Apache config again:
sudo vim /etc/httpd/conf/httpd.conf
Add this at the end:
LoadModule php_module modules/libphp.so
AddHandler php-script .php
Include conf/extra/php_module.conf
Restart Apache:
sudo systemctl restart httpd
🧪 Step 5: Test PHP
Create a test file:
sudo vim /srv/http/info.php
Add:
<?php phpinfo(); ?>
Visit:
http://localhost/info.php
You should see PHP info page.
📊 Step 6: Install phpMyAdmin
Install phpMyAdmin:
sudo pacman -S phpmyadmin
⚙️ Step 7: Configure phpMyAdmin
Create Apache config file:
sudo vim /etc/httpd/conf/extra/phpmyadmin.conf
Add:
Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
<Directory "/usr/share/webapps/phpMyAdmin">
DirectoryIndex index.php
AllowOverride All
Options FollowSymlinks
Require all granted
</Directory>
Include it in Apache config:
Edit:
sudo vim /etc/httpd/conf/httpd.conf
Add:
Include conf/extra/phpmyadmin.conf
🧩 Step 8: Enable Required PHP Extensions
Edit PHP config:
sudo vim /etc/php/php.ini
Uncomment these:
extension=mysqli
extension=pdo_mysql
extension=mbstring
extension=zip
extension=gd
🔐 Step 9: Configure phpMyAdmin Blowfish Secret
Edit:
sudo vim /etc/webapps/phpmyadmin/config.inc.php
Find:
$cfg['blowfish_secret'] = '';
Set a random string:
$cfg['blowfish_secret'] = 'your_random_secret_here';
🔄 Step 10: Restart Apache
sudo systemctl restart httpd
🌍 Step 11: Access phpMyAdmin
Open:
http://localhost/phpmyadmin
Login using:
Username: root
Password: (the one you set earlier)
✅ Done!
You now have a fully working LAMP stack with phpMyAdmin on Arch Linux 🎉
🧠 Tips
Store your websites in:
/srv/http/
For better security:
- Disable root login remotely
- Use a dedicated database user
- Consider adding HTTPS with Let’s Encrypt