In this post, I will show you how you can install LAMP on Raspberry Pi and set up a LAMP Raspberry Pi Web server and host your own site on your Raspberry Pi. This is the easiest way to set up raspberry pi web server, running Linux as Operating system.

What is LAMP?

LAMP (Linux, Apache, MySQL, PHP) is simply a set of open-source Web development tools that uses Linux as the operating system, the well known Apache as the Web server, MySQL as the database and PHP as the object-oriented scripting language.

Things Needed for Setting up Raspberry Pi LAMP Server

To build your own Web server using LAMP on a Raspberry Pi, all you need is a raspberry pi with a linux OS and active network connectivity. We will need internet access to install LAMP tools.

Lets Install LAMP on Raspberry Pi

Raspberry Pi LAMP Server Install – Video Tutorial

Install LAMP Raspberry Pi | Raspberry Pi Web Server

Step 1 – Install Apache on your Raspberry Pi

First thing to do is installing Apache web server on your Raspberry Pi. Apache is the first element of LAMP which will help your Raspberry Pi to work as a Web server and host webpages that will be accessible by other devices.

To install Apache execute the below command on the terminal

sudo apt-get install apache2 -y

This will install Apache to your Raspberry Pi. Next we will have to test the working. Make sure the apache service is running by executing the below command

sudo service apache2 status

If it is not running, start the service by

sudo service apache2 start

Now start a browser and enter the address “http://localhost”. You should be able to see a sample webpage, a HTML file on the file system. It is located at /var/www/html/index.html as shown below.

Step 2 – Install MySQL in your Raspberry Pi

MySQL is the second element of LAMP platform. MySQL manages all the databases and data flows with in the databases.

Now we will install the MySQL Server and PHP-MySQL packages by running the below commands into the terminal.

sudo apt-get install mysql-server php-mysql -y

Now restart Apache

sudo service apache2 restart

Step 3 – Install PHP in your Raspberry Pi

PHP is the last element of LAMP. You can easily install it using the below command.

sudo apt-get install php -y

Now restart Apache

sudo service apache2 restart

Thats it Guys!!

You have successfully install LAMP Server on your Raspberry Pi. Have fun!!

Want to Access your webpage from outside the LAN? Have you ever heard of ngrok? Check this out. Easily access this webpage from anywhere around the world.

Rate the Project

Did you find this page useful? Help us to improve by rating this page.

[RICH_REVIEWS_FORM]
[RICH_REVIEWS_SNIPPET stars_only=”true”]

Similar Posts

Leave a Reply

Your email address will not be published. Required fields are marked *