Installing a Web Server, PHP and Wordpress

Want to host your own blog on your RaspberryPi? No problem with that! Let's do this! (cit.)

Installing Apache2 web server

This is quite easy, just type

sudo apt-get install apache2 -y

in a bash window and you'll be ready to go! After the installation you should be able to see the Apache Default page (or the awful "It works"). This page is a simple HTML file and it's located in the /var/www folder (or /var/www/html if you are using Raspbian Jessie, which is my case, so I'll stick with it!)

Useful commands

To reload o restart apache you can use this commands:

sudo /etc/init.d/apache2 reload
sudo /etc/init.d/apache2 restart

Installing php5

To install php just type

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

After the install process is over you can check the installation easily. First of all you have to remove or rename your Apache Default Page ( /var/www/html/index.html ). I prefer moving it, as it could be useful in the future (?) so... just type

cd /var/www/html
sudo mv index.html _index.html

Now let's create a new PHP file! Just open a new text file with your favorite text editor:

sudo nano index.php

and type <?php phpinfo(); ?>. Surfing to your Raspi IP Address you should now see your PHP info page, with some useful information about the system. Let's move on!

Installing a Database (mySQL)

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

Downloading latest Wordpress version

cd /var/www/html/
wget http://wordpress.org/latest.tar.gz
tar xzf latest.tar.gz

You'll now have your Wordpress files in a wordpress/ folder. Let's rename it to blog/ and remove the archive

mv wordpress/ blog/
rm -rf wordpress latest.tar.gz

WORK IN PROGRESS =)