I’ve seen many tutorials on how to set up a personal website with WordPress on a Pi, and all of them take time and patience as just one wrong mistyped line or bump of the keyboard will send you flying off to chase errors. There are many steps and many moving parts to install and get right. My story is that every time I got it going, and then did something wrong, I often had to start over again with a fresh install of the Pi OS because I didn’t know enough how to correct what had happened. And so I started again from scratch. My n7okn.com site is on WordPress, using the free Touring Zone Lite theme available within the Admin page.
WordPress is undoubtedly the number one web building platform in the world. Compared to what we had back in the day where you would need to know HTML, jump through a bunch of hoops, and pay a lot of money to to get published, now platforms such as WordPress make it reachable by almost anyone.
WordPress has hundreds of free templates for free that you can use to simply fill in the blanks and be published in no time. More web sites use WordPress than any other single platform in the world. Custom web design and manual creation comes in at second.
The biggest hurdle you will face to self publish these days is to have an Internet service provider that lets you publish a web page on your connection at home for an affordable price. That means having a public facing IP address dedicated to hosting web pages.
My n7okn.com domain is purchased through Dynu.com, and configured so that n7okn.com points to my public permanent IP address (209.180.148.15). My n7okn Raspberry Pi server is sitting on my LAN though at 192.168.1.36. My router intercepts any web traffic to n7okn.com to my inside LAN (192.168.1.36).
The target audience for this article is for those of you who can use your Internet connection to host your own web page. Otherwise, there are web hosting companies such as Blue Ocean that are very affordable. They can host your own server virtually for you.
Before we begin, I want to say that while there are workarounds and tricks that you can do if you have an ISP that is less than friendly– blocking essential channels needed to host your site– it’s not always a good idea to jump through those hoops because your ISP may just shut you down for violating their terms of agreement. Mine is very friendly and has given me a static IP address and permission to publish on it. They also opened up ports 80 and 443 so that my website can communicate to the outside world.
I found that a Pi is just as capable as a regular PC (that I used for years) for doing the job. In my environment, I host four domains, plus three or four other sites that piggyback on the main Pi.
I have one IP address assigned to me, and to make that work, one Pi handles all the traffic to the other Pi’s acting as a proxy server.
The purpose of this write-up is to guide you through taking a bare-bones Pi and making it into a fully functional WordPress server, complete with Webmin, the Swiss Army Knife of administrating everything Linux. I wrote a script called WP that you will find easy as Pi to use. It does all the heavy lifting for you so that you don’t have to spend a long time typing out install code. I wrote it because I’ve not seen anything on the Internet that does what it does, and I got tired of continuously starting over.
Here are the prerequisites:
1. Raspberry Pi 3 or 4 with a 128GB SD card; high speed preferable.
2. As of this writing, I’ve found that now that the latest version of Bookworm with Desktop GUI works well.
3. A keyboard and monitor connected to your Pi.
4. A public facing IP address from your ISP. There are also VPN solutions for this if you can’t secure one from your ISP
5. Ethernet wire plugged into it on your local LAN, and that can access the Internet.
6. Eventually you will want your router to forward any web traffic it receives on your public facing IP address to go to your
WordPress Pi. Contact me for help with this if you’re not familiar with port forwarding on your router.
Update: Bookworm works great, and now I recommend it because the GUI has a great utility called SD copy. You can make a clone of your SD card while the system is live, and you won’t need any down time to make a backup. Just plug an additional SD card into your Pi using a USB to SD card adapter, and run the SD copy utility.
Now the easy part…
First, get to a Linux command prompt on the target Pi using keyboard or SSH.
At a prompt, type the following lines:
sudo su (this gives you root rights and access)
wget n7okn.com/wp (this downloads the script)
chmod +x wp (this prepares the script to run properly)
./wp (this is the command that runs the script)
First, it will ask you to change the Pi user password and confirm (you can use special characters now because the keyboard mapping issue is now fixed before it asks for the password).
Then it will ask for a new root password and confirm. Be careful not to misspell, it won’t tell you they don’t match. I found it easiest to go ahead and choose one root password for both the SQL database and the system root user. That way later on when it asks for each of them, you won’t get them mixed up. After all they’re both called root unfortunately.
Then sit back and enjoy the show. It will fix the annoying special character swap (like ” and @ interchanged), set your SSH to work, and make it so that root can log into SSH, install Webmin, Maria DB, PHP, Apache, Certbot, WordPress, and a slew of dependencies and Apache modules.
After a while, it will ask you to choose a SQL database root password. It will also ask for your root password that you chose when you started. It will ask you if you want to change the root password, Just say no. I’m still not sure if it means the SQL or user password.. I never bothered to find out.
Then it will ask you 4 questions. Just say yes to all and then it will ask you one more time for the database root password.
At that point it will finish and tell you what your internal IP address is as well as your public facing IP. Use the internal IP for SSH and also for logging into WordPress with your browser like this:
http://192.168.x.x
On your browser, the database name is wordpress, username is root, the password will be the password you chose as the database root password. All the other fields leave alone as it apparently knows what it’s doing. When you click continue, if you then get the “OK sparky” dialogue, throw yourself a party and eat cake. The next screen is setting up your username, password, and web site name for WordPress.
From there, refer to the plethora of WordPress documentation sites to get you going. My next article will reveal a super easy way of adding ssl encryption so you can look real official and make it so that http://foo.com becomes https://foo.com without any errors.
Please let me know how it worked for you in the comments below.