Skip to content

Setting up a LAMP server (Linux + Apache + MySQL + PHP)

Linux + Apache + MySQL + PHP

Probably the most common installation of web server, at least for a Linux system, is Linux, Apache, MySQL and PHP. Also possible on a Windows system, in which case it would be known as WAMP. I will cover setting up the former here.

I assume you already have a working Debian based Linux distribution. If not then I highly recommend Debian, or for Raspberry Pi users, Raspbian.

Let's get started. Download the package lists from the repositories:

sudo apt-get update

Install Apache

sudo apt-get install apache2

Install MySQL

sudo apt-get install mysql-server

Install PHP and PHP mysql modules

sudo apt-get install php5
sudo apt-get install php5-mysql

Install phpMyAdmin (optional)

sudo apt-get install phpmyadmin

And we're done!

Well, almost. There are a few additional steps you may want to do, for example running mysql_secure_installation.

By default, the web root directory will be /var/www/ or /var/www/html/


No Trackbacks


Display comments as Linear | Threaded

No comments

The author does not allow comments to this entry

Add Comment

Standard emoticons like :-) and ;-) are converted to images.
E-Mail addresses will not be displayed and will only be used for E-Mail notifications.

To prevent automated Bots from commentspamming, please enter the string you see in the image below in the appropriate input box. Your comment will only be submitted if the strings match. Please ensure that your browser supports and accepts cookies, or your comment cannot be verified correctly.

Form options