Deploying LAMP in Archlinux

This is for a dev environment. Let’s start by installing apache

pacman -S apache

Now install PHP

pacman -S php php-apache php-mcrypt

Installing MySQL (MariaDB)

pacman -S mariadb

Now, edit /etc/php/php.ini and effect the following changes:

date.timezone = Europe/Berlin

Now, let’s configure MySQL

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

Start mysqld

systemctl start mysqld.service

And then


Now change your /etc/httpd/conf/httpd.conf as follows:

User dth
Group users
DocumentRoot "/home/dth/www"
#LoadModule mpm_event_module modules/
LoadModule mpm_prefork_module modules/
# Place after LoadModule dir_module modules/ :
LoadModule php7_module modules/
LoadModule rewrite_module modules/
# Place this at the end of the include list
Include conf/extra/php7_module.conf

Since I don’t want httpd and mariadb to start on boot, I wrote a little script to quickly start/stop/restart them:


start_services() {
  sudo systemctl start httpd.service
  sudo systemctl start mysqld.service

stop_services() {
  sudo systemctl stop httpd.service
  sudo systemctl stop mysqld.service

case "$1" in 
  start)   start_services ;;
  stop)    stop_services ;;
  restart) stop_services; start_services ;;
  *) echo "usage: webdev start|stop|restart" >&2
     exit 1

Leave a Reply

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

Loading Facebook Comments ...
Loading Disqus Comments ...