How to create a web server with LAMP architecture with a Raspberry Pi


Would you like to host your own website on a server But you don't have enough money to pay the monthly hosting fees, or you're not convinced by the offers you're being offered, the inexpensive Raspberry Pi is the solution. This mini-PC costs around €40 for its most powerful version and thanks to its versatility can be transformed into almost anything.

Are you wondering what LAMP is, it refers to the infrastructure of a web server consisting of Linux, Apache, MySQL/MariaDB and PHP/Perl. Since it's free software, you won't have to pay a cent for any of this and the hardware, as I said, is cheap. These servers are very reliable and powerful, if you look at them they are the dominant ones on the market.

So you can host your own website and start your online business or whatever your idea is. A own server for less than €50 is a real bargain. All you have to do is pay your electricity bill (which will hardly increase at all due to the Raspberry Pi's low power consumption) and your Internet provider. If you want to know how, here's how...


  • Raspberry Pi assembled and configured. You can buy it in our shop at the best price on the market.
  • Router for Internet connection.
  • Software required to set up the LAMP server.


Configuring the server

  • First we must mount and configure our Raspberry Pi as we explained in another article in this blog. If you prefer, you can install on your Raspberry Pi a special operating system for servers (Raspbian Server Edition).
  • Once up and running, we will need to install the appropriate software. The first thing to do is to install Apache as a web server and PHP from the terminal:

sudo apt-get install apache2 php5 libapache2-mod-php5

  • Now we start the server using the following command:

sudo service apache2 restart

/etc/init.d/apache2 restart

  • If we open the web browser and type our IP in the address bar, we will get a page indicating that the Apache server is running, It Works!.

It works, LAMP server

  • Once we have Apache, we can install MySQL or MariaDB, as we prefer. For MySQL, type the following line in the terminal:

sudo apt-get install mysql-server mysql-client php5-mysql

/etc/init.d/mysql restart

Once this is done, we will configure everything according to our needs. Once this is done, our LAMP server is ready. Remember to host your web directory in the SD of the "Raspi" or in an external USB hard disk (if you need more capacity). Don't forget that if it shuts down, or disconnects from the network, the page will go down.

Buy - Raspberry Pi 3 Model B+

More information - Raspberry Pi how to set up and configure it step by step

Downloads Raspbian Server Edition

Leave a Comment

Your email address will not be published.

Scroll to Top