How to install Lamp in ArchLinux


Please shareShare on Facebook2Share on Google+5Tweet about this on Twitter1Share on LinkedIn0Share on Reddit0Digg thisShare on StumbleUpon0Share on VKBuffer this page

LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform that uses Linux as operating system, Apache as the web store , MySQL as the ArchlinuxLogo2relational database management system and PHP as the object-oriented scripting language. 
In this Simple tutorial we will explain you how to install LAMP SERVER on your ArchLinux.

Install Apache, PHP, y MySQL

The  installation  of  Lamp  on Archlinux  needs  some  manual configurations . please   follow  steps bellow:

Install Packages

# pacman -S apache php php-apache mysql

1- Configure Apache

  • Add  if not exist to /etc/hosts  localhost.localdomain   localhost
  • Edite /etc/rc.conf.  and  define the hostname
# Networking
  • Comment out the  below  lines
# nano /etc/httpd/conf/httpd.conf
LoadModule unique_id_module        modules/


#LoadModule unique_id_module        modules/
  • Now restart apache, As root enter the following command:
# /etc/rc.d/httpd start
  • Edit /etc/rc.conf to run apache on start.
DAEMONS=(... varios daemons ... httpd

or add this line to rc.local:

/etc/rc.d/httpd start


open the  browser  and  check   http://ip  or  http://hostname


2- Configure PHP

Check php module configuration

Add the following lines to /etc/httpd/conf/httpd.conf:

# Use for PHP 5.x:
LoadModule php5_module       modules/
AddHandler php5-script php
Include conf/extra/php5_module.conf

Add index.php after “DirectoryIndex index.html”

# DirectoryIndex: sets the file that Apache will serve if a directory
# is requested.
<IfModule dir_module>
    DirectoryIndex index.html index.php

DirectoryIndex index.php index.phtml index.html

Now test php page, Add and edit file test.php under /srv/http/ add


php phpinfo();


Now test the page http://ip/test.php ot http://hostname/test.php

  • If you want the libGD module, install php-gd package and uncomment in /etc/php/php.ini:



Pay attention to which extension you uncomment, as this extension is sometimes mentioned in an explanatory comment before the actual line you want to uncomment.

  • If you want the mcrypt module, install php-mcrypt package and uncomment in /etc/php/php.ini:


change this line of /etc/php/php.ini

;date.timezone =


date.timezone = Europe/Amsterdam
nano /etc/httpd/conf/httpd.conf


  • Restart Apacheto  take  teh  new   change

# /etc/rc.d/httpd restart

3- Configure MySQL

  • Configure MySQL as described in MySQL.
  • Edit /etc/php/php.ini

Caution:Some users have reported typos on this line. Please make sure that it reads ; and not ;
  • You can add minor privileged users for your web scripts by editing the tables found in the mysql database. You have to restart MySQL for changes to take effect. Do not forget to check the mysql/users table. If there is a second entry for root and your hostname is left with no password set, everybody from your host probably could gain full access. Perhaps see next section for these jobs.
  • Run in terminal:
 # /etc/rc.d/mysqld start
  • You may also need to restart Apache. Run in terminal:
 # /etc/rc.d/httpd restart
  • MySQL should now be running. Set the root password and test it by running:
 # mysqladmin -u root password password
 # mysql -u root -p
Type exit to exit from the CLI MySQL client
  • Edit /etc/rc.conf (to start MySQL at boot):
 DAEMONS=(... mysqld ...)

Or add this line to rc.local:

 /etc/rc.d/mysqld start


4- Configurar PHPMyAdmin

Install ph[pmyadmin

pacman -S phpmyadmin php-mcrypt

Copy the example configuration file to your httpd configuration directory.

cp /etc/webapps/phpmyadmin/apache.example.conf /etc/httpd/conf/extra/httpd-phpmyadmin.conf

Add the following lines to /etc/httpd/conf/httpd.conf:

# phpMyAdmin configuration
Include conf/extra/httpd-phpmyadmin.conf

Adjust access rights

In /etc/webapps/phpmyadmin/.htaccess, comment out deny from all. The line should look like this:

#deny from all

Change it to Allow from all or to allow from specified Ip

This file (/etc/httpd/conf/extra/httpd-phpmyadmin.conf) will make the lias to the phpmyadmin directory

Now restart apache and check the phpmyadmin page under http://ip/phpmyadmin