LAMP Server Arch Linux

This is tutorial how to install Apache,Mysql,PHP on arch linux.

First of all lets update arch linux:

sudo pacman -Syu

Now we can continue, install apache server:

sudo pacman -S apache
sudo systemctl start httpd

Mysql:

sudo pacman -S mysql

you will see something like this:

: There are 2 providers available for mysql:
:: Repository extra
   1) mariadb
:: Repository community
   2) percona-server

I’m recommending mariadb so click 1, before starting mysql we need to initialize the mariadb data directory and after start it:

udo mysql_install_db --user=mysql --basedir=/usr --datadir=/var/lib/mysql
sudo systemctl start mysqld

now to create password for mysql root user type:

sudo mysql_secure_installation

install php and it’s apache module:

sudo pacman -S php php-apache

open apache config file

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

and comment this line

LoadModule mpm_event_module modules/mod_mpm_event.so

by adding # at start, after at the end of document add

#php
Include conf/php.conf

click CTRL + O and CTRL + X

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

and add this lines

LoadModule mpm_prefork_module modules/mod_mpm_prefork.so
LoadModule php5_module modules/libphp5.so
 
Include conf/extra/php5_module.conf

click CTRL + O and CTRL + X

restart apache,

sudo systemctl restart httpd

now create php file and add into it:

<?php
 
phpinfo();
 
?>

navigate to this file, for example localhost/index.php

Now to install PHPMyadmin

sudo pacman -S phpmyadmin php-mcrypt

edit php.ini file and uncomment some needed extensions

extension=mcrypt.so
extension=mssql.so
extension=mysqli.so
extension=openssl.so
extension=iconv.so
extension=imap.so
extension=zip.so
extension=bz2.so

also search for base_dir and make sure it’s like this

open_basedir = /srv/http/:/home/:/tmp/:/usr/share/pear/:/usr/share/webapps/:/etc/webapps/

now open

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

add at bottom

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

restart apache

sudo systemctl restart httpd

you can access phpmyadmin using http://localhost/phpmyadmin

Thats all last step if you want LAMP stack to be started at start-up us this

sudo systemctl enable httpd mysqld

sudo systemctl enable httpd mysqld

Leave a Reply

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