Build My New Blog on A Raspberry Pi

Hey, do you know that what you are browsing is built on a Raspberry Pi?

In the past, I’ve built many blogs. Loving the expansibility, I end up using WordPress as my platform. However, WordPress need servers, and servers cost money.

I was a bad blogger, and it’s unwise paying for a zero audience blog. Many times, when receiving those VPS bills, I choose to shut down my blog.

Today, ITP makes me eager for an excellent blog, again. And, I’ve got a Pi, why don’t I take advantage of it?

Ok, ok, fine, let’s just shut up and make something.

The requirement is quite simple:

I type the domain, and the Raspberry Pi gives me a blog website.

But…the problems are:

  1. The Raspberry Pi works on a LAN, how can I reach it with a device outside the LAN?
  2. I’m using an ADSL, which means, every time I reconnect, my public IP changes. How can I update my DNS instantly when the IP changes?
  3. Considering the weight of my luggage, I did not bring my keyboard to the states, and now I cannot make my Raspberry Pi connect my WiFi, I even cannot login by the GUI because I am unable to input the password….

The Gee Router

Luckily, I brought a super weapon from my country, a Gee Router.

Benefit by the Chinese black tech, the Gee Router allows me to install plugins into it so that it can work as a computer. Super powerful isn’t it?

The 1st problem, how to reach a device from other LAN?

The answer called NAT, and the tool is a port forwarder.

If I request the router with a specific port number, the router will pass the request to a device after it for another certain port number. It works like this:

Ok, if I visit public IP:80, I will get LAN IP:80, which is my Pi and its Apache port.
I can also use another port number to use SSH connection, as my config shows.

Next, getting a permanent address.

This time we use a dynamic DNS plugin, which can check the public IP periodically and change the DNS record automatically when the IP changes.

Problem solved.

Now, how can I build the website on the Pi? I don’t even have a keyboard

Firstly, connect the Pi to the router by cable, then SSH to the Pi.

Not being hard-hearted enough to leave my Pi with the router, I want my Pi on my table, Let’s m up the WiFi first.

My Pi runs a Ubuntu, the network configuration file is /etc/network/interfaces. Use Vim to open it, add the WiFi information.

And the NAT requires a static IP, change the DHCP to static, and add necessary lines.

It end up like this:

Done, sudo reboot.

The final step is, install the WordPress.

I can vaguely remember what dependencies are needed, so I just installed them all, including:

$ sudo apt-get install php
$ sudo apt-get install mysql-server
$ sudo apt-get install apache-server

Then just install the WordPress, some configurations are needed,

In case I would make some mistake, I followed an instruction here:

After that, delete the default Apache test page:

cd /var/www/html/
rm -rf index.html

Set up a CNAME record to your dynamite domain:

Ok, I’m all set., finally on the air, again.

Look at it, isn’t it cute?


Leave a Reply

Your email address will not be published. Required fields are marked *