Raspberry Pi – Install a LAMP Server (Linux, Apache, MariaDB, PHP)

You can turn your Raspberry Pi with Raspberry PI OS into a full LAMP web server. We use MariaDB because MySQL is not provided in the main repository and it is a drop in replacement fro MySQL.

Install Apache2

sudo apt-get install apache2

Change Ownership of HTML Folder

sudo chown pi /var/www/html

Install PHP

sudo apt-get install php libapache2-mod-php php-mysql

Install MariaDB, and Cleanup Installation

sudo apt-get install mariadb-server-10.0 
sudo mysql_secure_installation

Restart Apache2 Service

sudo service apache2 restart

Be the first to comment

Leave a Reply