The EASY way to build your own WordPress Site on a Raspberry Pi!

I’ve seen many tutorials on how to set up 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 packages 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.

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 thousands 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 for an affordable price. 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 permission to publish.

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 that handles all the traffic to the other Pi’s acting as a proxy server for the other ones.

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 Bullseye with Desktop GUI works well.
3. A keyboard and monitor connected to your Pi.
4. Ethernet wire plugged into it on your local LAN, and that can access the Internet.

I have tried loading this with the GUI version of Buster, but there are some quirks that the lite version doesn’t have. With GUI, I can’t get the SQL tables to set up correctly with the automated install, although it will work manually. You also don’t need the processor taking up precious resources running a GUI desktop environment and serving up web content with SSL at the same time. Any administration you need to do, you can use Webmin if you don’t like the console or GUI. You can use the GUI as well with NoMachine. Also I tried Bullseye, and other things broke, so instead of making three or four different scripts, I’ll just say get Buster lite and you won’t go wrong.
Update: Bullseye 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. In my latest version of WP script, I included an install of NoMachine, a utility that makes it easy to access the GUI from your own PC, so that making a backup is so much easier. No mouse and keyboard are needed now for the Pi once everything is running.

Now the easy part…

Now, get to a command prompt. The desktop is the easiest way at this point.
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)

If you’re successfully connected to the Internet it will download and let you run 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.

Leave a Reply

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