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.

Raspberry Pi 3B made in 2015

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 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, the best OS for this script is to use is Rasbian Lite (no GUI), (yes still current although Bullseye is also out)
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. You can make it work with GUI, but why? It’s Linux! 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.

Now the easy part…

Once your Pi boots and you have a login prompt, go to the bathroom or something because lately it’s not been completely done loading the last few startup items. There will be 6 or so more to go while you’re in the necessary room. Pi is the initial username, and raspberry is the password. Don’t worry about changing it, the script will prompt you to change this.

After the additional startup pop-ups so rudely interrupt you, type these 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.

1 + 8 =