Raspberry Pi LAMP installation guide

This short guide teaches you how to turn Raspberry Pi into a LAMP server.
LAMP stands for Linux Apache MySQL PHP

Step 1: update the Raspberry Pi OS to the latest version:

sudo apt-get install -y rpi-update
sudo apt-get update -y && sudo apt-get upgrade -y

Step 2: install Apache Webserver and create permissions:
sudo apt-get install -y apache2 apache2-utils
sudo groupadd -f -g33 www-data
sudo chown pi:www-data /var/www
sudo chmod 775 /var/www

Step 3: install PHP and mod_php
sudo apt-get install -y php5 libapache2-mod-php5 php5-common mysql-client
sudo apt-get install -y php-pear php5-mysql php5-curl php5-gd php5-idn php5-imagick php5-imap php5-mcrypt php5-memcache php5-mhash php5-ming php5-ps php5-pspell php5-
recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl php5-json

Step 4: Install MySQL and phpMyAdmin

sudo apt-get install -y mysql-server
mysql_secure_installation
sudo apt-get install -y
phpmyadmin

5 thoughts on “Raspberry Pi LAMP installation guide

  1. I’m thankful to you. That saved me time and reassured me among a lot of other helpful tips.
    I just had to find out some additional tips with my headless pi to get access to 192.168.1.x with my mbp Safari navigator.
    1- I had to edit /etc/hosts and replace “127.0.0.1 localhost” with “127.0.0.1 localhost.localdomain localhost
    2- and to access phpMyAdmin, I had to create a link under /var/www with
    ln -s /usr/share/phpmyadmin /var/www/phpmyadmin

Leave a Reply