In the previous articles, I covered how to install Ubuntu and setup WiFi on Raspberry Pi 3. Now, it is time to setup a web server. LAMP stack is a popular choice for hosting dynamic web sites. LAMP is an acronym for Linux, Apache, MySQL and PHP.
With 1GB memory and 4 ARM cpu cores in Raspberry Pi 3, it is more viable to host LAMP stack on Raspberry Pi for home and small business.
Since Raspberry Pi 3 was just released last month, at the moment, there are not too many Linux variants ported. Ubuntu is one of the available ones at the moment. To install it, please follow the instruction here.
It is actually quite simple to install Apache web server. From your superuser account, run the followings
sudo apt-get install apache2 -y
The default home page is located at
When you open the http://localhost in Firefox browser in Ubuntu, you will see the following page:
Alternative, you may find out the IP address of your Raspberry Pi 3 and open the home page by IP address like http://192.168.0.114
The following command reports the IP addresses.
ifconfg | grep "inet addr"
It returns 127.0.0.1 (local host), 192.168.0.113 (Ethernet) and 192.168.0.114 (WiFi)
PHP is a server-side scripting language developed by Zend Technologies. It is widely used for web developement. To install PHP, run the following commands
sudo apt-get install php5 -y php -v
It should look like the followings once it is successfully installed
To report more information about PHP installed, create a file as follows
sudo emacs /var/www/html/info.php
put the following line in /var/www/html.info.php save it and exit out of Emacs
<?php phpinfo(); ?>
Now open the web page from your browser http://192.168.0.114/info.php
where 192.168.0.114 is the IP address of my Raspberry Pi 3
Is it a widely used open source RDBMS (Relational Database Management System) on Linux and other operating systems.
Run the following commands to install MySQL
sudo apt-get install mysql-server -y
During the installation, you will be asked to create a password for MySQL
If this screen doesn’t show up, it is probably due to some package dependency issues. You may want to run the following commands to try installing MySQL again
sudo apt-get update sudo apt-get install mysql-server -y
A few packages (like mysql-client, mysql-client-core and etc.) will be installed as part of process.
To check to see if mysql is running , issue the following command
sudo service mysql status
If it is not, try the following
sudo service mysql start
The status should look like this:
Run the following to open MySQL Montior
mysql -u root -p
By now, you have successfully installed LAMP web server stack on Raspberry Pi 3 running Ubuntu Linux. In the future, I will cover more on how to configure your LAMP stack.