Installing LAMP on Raspberry Pi is very very simple. It takes a single line to execute on terminal / console.
sudo apt-get update; sudo apt-get -y install mysql-server php5-mysql apache2 apache2-utils php5 libapache2-mod-php5 php-pear php5-xcache php5-curl php5-gd
Copy-paste the above line in terminal and press Enter. You will be asked to choose MySQL Server password. Choose wisely. Wait for it to complete and you are done. Now you can install any PHP / MySQL based programs and run it on the installed Apache server.
Notes;
- sudo is used to run this command in Super User mode
- apt-get update is important because it updates your Pi installation to latest version. Without it the following installation may fail (speaking from experience).
- apt-get install is what installs the required software
- -y answers yes for you when apt-get asks your permission to install
The following instruction was tested on Raspbian Jessie build, which at the time of writing is the latest build.
Questions:
- Why should you use Raspbian distro for Raspberry Pi?
It is maintained by the developers of Pi and as such most optimized for Pi hardware and most aggressively maintained - Why should you use Jessie and not earlier builds?
Latest versions supports newer peripherals and comes with all the latest bug fixes and optimizations. - How to test Apache HTTP server is properly installed on Raspberry Pi?
You can check the default web page at http://localhost/ if you are accessing from Pi or http://ip-address-of-pi/ from any other machine.