Introduction: Raspberry Pi Simple Blog Server.
Hopefully you already have your basic Raspberry Pi already set up with the Debian Linux image. There are already many articles on how to do that. Here we will set up a simple blog that does not require MySQL You do need the Apache2 web server and PHP software. The blog we will install is known as Flatpress it is great for the family intranet network, though, I would not allow to be on the web. Flatpress is good for starting web masters. After doing this instructable, you might want to also install status.net a twitter sort of clone. (https://www.instructables.com/id/Statusnet-the-Twitter-clone-setup/)
Note: you need to have at least some knowledge of the linux command line to complete this instructable. Using putty or ssh from a gui environment to log into the RPi is extremely helpful. Makes it easy to just copy and paste commands.
Note 2: You could actually install this on most any computer system with the Apache2 php requirements fulfilled.
Step 1: Name Change to Protect the Innocent.
You will want to change the name of your Raspberry Pi or you might get another server from the web. Also I am sure you have already set up your router to set the raspberry pi address. See your router manual on how to do that.
$ sudo hostname
Add oeraspberrypi to the list.
Use ifconfig to get your ipaddress of the RPi
eth0 Link encap:Ethernet HWaddr xx:xx:xx:xx:xx:xx
inet addr:18.104.22.168 Bcast:192.168.1.255 Mask:255.255.255.0 < < < < <
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:60188 errors:0 dropped:0 overruns:0 frame:0
TX packets:32615 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:80088549 (76.3 MiB) TX bytes:3105057 (2.9 MiB)
lo Link encap:Local Loopback
inet addr:127.0.0.1 Mask:255.0.0.0
UP LOOPBACK RUNNING MTU:16436 Metric:1
RX packets:32 errors:0 dropped:0 overruns:0 frame:0
TX packets:32 errors:0 dropped:0 overruns:0 carrier:0
RX bytes:2540 (2.4 KiB) TX bytes:2540 (2.4 KiB)
Then you will need to edit your host file to reflect that address.
Step 2: Web Server Software Setup.
There are two basic programs we want to install. Apache2 the web server and PHP a programming language for use with the server.
$ sudo apt-get install apache2 php5 libapache2-mod-php5 php5-cli
That will take a little while to install. Be patient.
Then you need to do a fix for the server.
$ sudo nano /etc/apache2/conf.d/name
For example set add ServerName localhost or any other name:
or you could use
Save the file and restart Apache 2
$ sudo service apache2 restart
Test the server:
Point a browser to the RPi You should get the setup page.
Now we need to test the PHP install..
$ cd /var/www
You should already see index.html with the code that shows you the home page.
Now we need to create a new page
$ sudo nano phpinfo.php
Save and exit. Now point your browser to yourhostname/phpinfo.php
You should get the PHP status page.
Now you should be ready to roll.
Note: you may need to edit /etc/apache2/apache2.conf and add:
# add php useage
AddHandler application/x-httpd-php .html
Step 3: Get the Software.
You need to go to: http://sourceforge.net/projects/flatpress/files/flatpress/ and download the latest version to your pc
Then you need to get the software to your Rpi. For MSWwindows you can use WinSCP, not a MSWindows user so you will have to look at it's instructions.
On linux Send the file to your pi home directory
$ cd downloads
$ scp flatpress-1.0-solenne.tar.bz2 oerapberrypi:~/.
or scp flatpress-1.0-solenne.tar.bz2 pi@oerapberrypi:~/.
Log into the Raspberry pi Go to your home directory to make sure the file is there: (ssh@rpiservername)
$ ssh pi@oeraspeberrypi
Desktop flatpress-1.0-solenne.tar.bz2 helloworld.py hw hw.c python_games
Step 4: Software Install.
While at your home prompt, you need tp expand the archive of Flatpress since it comes in one big file and needs to be expanded into it's full web directory. I like to do every thing in the home directory first so I do not mess up the base web directory.
$ tar xvjf flatpress-1.0-solenne.tar.bz2
if you do ls you should see the Flatpress directory now. On linux Apache to has a special place where all the web pages are stored. If we were only going to run one web program, you could store the files in /var/www. I prefer to to use the whole directory on it's own. So lets move it.
$ sudo mv flatpress /var/www
You should see it now with the two other files we created in another instructable.
To the final step.
flatpress index.html index.php
if you cd flatpress, you will see lots of files. but you really do not need to do that.
Step 5: Installing Flatpress.
Before we look at the blog, you will need to give right for use in the flatpress directory for Apache2
$ cd /var/www
$ sudo chown -R www-data:www-data flatpress
$ sudo chmod -R 755 flatpress
Now you point your browser to servername/flatpress and just follow the instructions.
Step 6: Access for the World.
If you really want to open your local website to the world, I recommend using two routers. Reason being that if your web server is breached, your main network is not as much risk as it would be directly connected to the main router. To allow your web site to be open to the net you will need to either open a port (port-forwarding) or set up a DMZ on your router where all the ports to the Raspberry Pi are exposed. (not recommended). So that people can easily find your site, you will need to set up an account with one of the Dynamic Dns hosts. (DDNS). Most newer routers support this. There are two advantages, you do not have to run an DDNS IP client on the RPi and you can hook up other devices and still be able to use the same ipaddress via ddns.
Port forwarding see:
DDNS on DD-WRT:
Step 7: Other Part of a Lamp.
Because there has been so much consternation of using MySQL now that it is in the hands of Oracle, prefered a web application that did not need it. Most people are now preferring MariaDB over MySQL.