in ,

Install LAMP Web Server on Raspberry Pi – Easy Way | Apache, MySQL, PHP

In this post, I will show you how you can install LAMP Web server on a Raspberry Pi and host your own site in your Raspberry Pi. This is the easiest way to set up web server on a raspberry pi 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.

lamp install raspberry pi

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 Start Installing LAMP on your Raspberry Pi

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.

install lamp on raspberry pi

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.

What do you think?

0 points
Upvote Downvote

Total votes: 0

Upvotes: 0

Upvotes percentage: 0.000000%

Downvotes: 0

Downvotes percentage: 0.000000%

Comments

Leave a Reply

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

Loading…

Comments

comments

offroad robot 4 wheel drive badland brawler

Off Road Robot With 4 Wheel Drive | Arduino Badland Brawler