Your cart is currently empty!
How to Install LAMP (Linux, Apache, MySQL, and PHP/PhpMyAdmin) in Arch Linux
If you’re running Arch Linux and want to set up a web server stack, LAMP (Linux, Apache, MySQL/MariaDB, PHP) is still one of the most common and reliable setups. In this guide, we’ll walk through installing and configuring LAMP along with PhpMyAdmin to make database management easier.
Step 1: Update Your System
Before installing anything, update your packages to ensure you’re working with the latest versions.
sudo pacman -SyuStep 2: Install Apache
Apache is the web server that will handle requests and serve your content.
sudo pacman -S apacheEnable and start Apache:
sudo systemctl enable httpd
sudo systemctl start httpdTo test, open your browser and go to:
http://localhostYou should see the default Apache page.
Step 3: Install MySQL (MariaDB)
On Arch, MariaDB is the default MySQL drop-in replacement.
sudo pacman -S mariadbInitialize and start the database:
sudo mariadb-install-db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
sudo systemctl enable mariadb
sudo systemctl start mariadbSecure the installation:
sudo mysql_secure_installationFollow the prompts to set the root password and remove insecure defaults.
Step 4: Install PHP
PHP is the server-side scripting language that connects Apache and MySQL.
sudo pacman -S php php-apacheEdit Apache’s configuration to enable PHP. Open /etc/httpd/conf/httpd.conf and:
- Comment out:
LoadModule mpm_event_module modules/mod_mpm_event.so - Uncomment or add:
LoadModule mpm_prefork_module modules/mod_mpm_prefork.soLoadModule php_module modules/libphp.soAddHandler php-script phpInclude conf/extra/php_module.conf
Restart Apache:
sudo systemctl restart httpdStep 5: Test PHP
Create a PHP test file:
echo "<?php phpinfo(); ?>" | sudo tee /srv/http/info.phpGo to:
http://localhost/info.phpIf PHP’s info page loads, you’re good.
Step 6: Install PhpMyAdmin
PhpMyAdmin provides a web interface to manage MySQL/MariaDB.
sudo pacman -S phpmyadmin php-mysqliEdit /etc/httpd/conf/httpd.conf and add:
Include conf/extra/phpmyadmin.confCreate the config file:
sudo nano /etc/httpd/conf/extra/phpmyadmin.confAdd:
Alias /phpmyadmin "/usr/share/webapps/phpMyAdmin"
<Directory "/usr/share/webapps/phpMyAdmin">
DirectoryIndex index.php
AllowOverride All
Options FollowSymlinks
Require all granted
</Directory>Restart Apache:
sudo systemctl restart httpdVisit:
http://localhost/phpmyadminLog in with your MySQL root credentials.
Step 7: Secure Your Setup
- Delete
info.phpafter testing:sudo rm /srv/http/info.php - Configure strong MySQL passwords.
- Restrict PhpMyAdmin access to trusted IPs.
✅ You now have a fully functional LAMP stack with PhpMyAdmin running on Arch Linux.

Tech enthusiast and content creator passionate about making technology simple for everyone. I share practical tips, guides, and reviews on the latest in computers, software, and gadgets. Let’s explore the digital world together!
