How to turn your Raspberry Pi into a LAMP Web Server

Share on Facebook1Share on Google+0Tweet about this on TwitterShare on Reddit0Share on StumbleUpon0Pin on Pinterest0

About: Many projects you use your Raspberry Pi for may need your Raspberry Pi to be a web server. A popular package is LAMP which stands for Linux, Apache, MySQL and PHP. LAMP is not a package in itself but 3 packages in one. LAMP is the Linux equivalent. You may hear it called a WAMP server or MAMP server if you are using Windows or Mac as your operating system. Since the Raspberry Pi runs on Linux we will be installing a LAMP server.

The 3 packages we will be installing are:

  • Apache – Apache is a popular HTTP Web Server.
  • MySQL – Used as our SQL database system
  • PHP – Server Side scripting language that is applied to our websites

Objective: To turn the Raspberry Pi into a LAMP Web Server (Linux, Apache, MySQL, PHP)

Material: You will need the following:

  • Raspberry Pi (Click the link to check out the price on Amazon. Usually around $37 with free shipping)

Instructions: Installing LAMP is easy. Simply type the following commands

The final line will install the MySQL server and it will prompt you for the root password to set for MySQL. Set a password you will remember but is also hard to guess. You will need this password to login to MySQL to create databases.

Once you have Apache, MySQL, and PHP installed you are done. Easy as Pi.

Your website are stored in ‘/var/www/html’. You may want to install a FTP server on the Pi to transfer files to your web server more easily. Managing your MySQL database can also be done by installing PHPMyAdmin which will give you clean web interface to manage the database.

If you would like to see the default web page simply type in your Raspberry Pi’s IP address in your web browser.

The steps I just described above will allow you to host your webpage locally on your own network, if you want to make it more permanent and official check out the tutorial here from MyHydroPi on how to host your website on the Raspberry Pi. It goes more in depth on how to setup a domain name and linking it to your Raspberry Pi.

As always if you have any questions, comment below.

Share on Facebook1Share on Google+0Tweet about this on TwitterShare on Reddit0Share on StumbleUpon0Pin on Pinterest0