Getting started: hardware requirements
Before I show you how to do the install, I’ll give you the shopping list required. The good news is that most of the software comes free. I also encourage you to look around for items you may already own.
Hardware item #1: Raspberry Pi
- Get a Raspberry Pi 3 Model B or later; the Raspberry Pi 4 and 5 models have the best processing power and cost about the same as older versions
- I suggest 8 GB RAM, but 4 GB seems to work well
- Click Buy Now on the Raspberry Pi website for the Pi version you want (Raspberry Pi 5 and Raspberry Pi 4); select your desired RAM and Country; click on retailers to see stock (for instance, USA vendors include Vilros, Chicago Electronic Distributors, Central Computers, and PiShop.us – Micro Center is a reliable brick-and-mortar store if you have one nearby)
- If all else fails, consider eBay or Amazon if you don’t mind spending more ($100+)
When I install WordPress on Raspberry Pi, I’ll use a Raspberry Pi 4 Model B with 4 GB RAM.
Hardware item #2: a MicroSD card
This plugs into the Raspberry Pi and stores WordPress site files.
- Before anything, see if you have an unused MicroSD card
- I recommend a MicroSD with at least 16 GB of storage to run a WordPress site
- You can find these at places like Best Buy, Micro Center, Amazon, eBay, Target, and anywhere that sells electronics
I’m using a 64 GB MicroSD card.
Hardware item #3: monitor
- Grab any monitor with an HDMI port
- Most new Raspberry Pi models have a micro-HDMI port
- It is possible to install WordPress on Raspberry Pi remotely (from another computer on your network), but I find it easiest to have a dedicated monitor for your Pi
Hardware item #4: Micro-HDMI to HDMI cable
- This is required to connect a monitor directly to the Raspberry Pi
- You’ll need a Micro-HDMI to HDMI cable or adapter (since regular HDMI cables don’t have a side with a Micro-HDMI)
I have a Micro-HDMI (not to be confused with a Mini HDMI, which won’t fit) to regular HDMI cable, so I have no need for an adapter.
The other end of the cable (standard HDMI) plugs into the monitor to view and navigate through the Raspberry Pi interface.
Hardware item #5: USB keyboard
- Any USB keyboard works since modern Raspberry Pis have up to four USB ports
Hardware item #6: USB mouse
- Any USB mouse works to connect to the Raspberry Pi
Hardware item #7: power supply
- Find a USB-C power supply around your house, or purchase one
- Some sellers provide kits with power supplies with the Raspberry Pi
- All versions before Raspberry Pi 4 use a micro-USB power supply
- I recommend using a power supply that provides 2.5A to 3A to the Raspberry Pi
Here’s the USB-C power supply I intend to use; it came with the Raspberry Pi kit I previously purchased.
The USB-C cable plugs into the power supply port.
Hardware item #8 (optional): cooling and protection
The Raspberry Pi gets hot, especially if it is running at all times. Ideally, you keep the Pi in an area without surrounding heat sources and with enough airflow (don’t cram it into a closed box next to your dryer).
💸 Here are other cheap options for cooling:
In addition to keeping the Raspberry Pi away from other heat sources, I only have a case for one of my Raspberry Pis. This helps separate the board from other surfaces that may get hot as well. It seems to work well, but there are better ways to keep a Raspberry Pi cool.
For instance, on my second Raspberry Pi, I use a case/fan combo. It has a sturdy case for protecting the Pi, but it also includes a tiny fan that automatically turns on.
Internet requirement: WiFi or ethernet
You need the internet to install WordPress, update the system, and access your WordPress site remotely.
- For the most stable connection, connect with an ethernet cable
- You can also connect the Raspberry Pi to WiFi
I’ll use a wired connection by connecting an ethernet cable to its corresponding port on the Raspberry Pi.
The final configuration of your Raspberry Pi’s components
I decided to put my Raspberry Pi in the black protective case since it comes with a fan for cooling. Once inserted into the case, you have access to its ports to plug in everything from the ethernet cable to the Micro-HDMI, mouse, and keyboard.
How to install WordPress on Raspberry Pi
There are several ways you can do this. After testing all of them, I found the followimg to be the easiest method.
Step 1: Install Raspberry Pi OS on the MicroSD card
Just like any other computer, the Raspberry Pi needs an operating system to give you a controllable interface. You can install different forms of Linux and Windows, but the best operating system is the one designed for a Raspberry Pi: Raspberry Pi OS (formerly called Raspbian).
It’s possible to install different versions of Raspberry Pi OS manually (right on the Raspberry Pi device) or use what’s called a Raspberry Pi Imager.
I highly recommend using the Raspberry Pi Imager; it offers the simplest method for adding Raspberry Pi OS to your MicroSD by using a Mac, Windows, or Ubuntu computer.
Go to the Raspberry Pi Imager page and click the Download button for the operating system on the device you’re using. I’ll use the Mac option.
Open and run the Raspberry Pi Imager on your device. I’m using a Mac, so I’ll add the Imager to my Applications.
Then, I’ll click on the new app to open it.
Take your MicroSD card and plug it into your device (in this instance, I’m plugging the MicroSD card into a Mac computer).
You’ll see a basic Raspberry Pi Imager screen once it’s open, with some options to choose the following:
Click Choose Device.
Pick your Raspberry Pi hardware version. For me, I’ll select Raspberry Pi 4, but you may have something different like a Pi 5 or Pi 3.
Click Choose OS. You have several versions of Raspberry operating systems and alternative operating systems to use.
I always recommend using the standard Raspberry Pi OS 64-bit. The Imager recommends that, and I’ve never had a problem with it.
Next up, click Choose Storage.
Scroll through to find the right storage. In my case, I know the MicroSD card I just plugged in has 64 GB. So I’ll pick that one.
With your selections made, click Next.
You have the option to edit your OS settings, but you can skip this by clicking No. It’s not necessary at this point.
Confirm Yes to erase all existing data on your MicroSD. A fresh SD card is required to install a new Raspberry Pi OS.
Wait for the Raspberry Pi Imager to write the operating system onto the MicroSD card.
Once completed, you’ll see a success message. Click Continue and remove the SD card from your computer. The MicroSD card now contains a fully functional Raspberry Pi OS.
Step 2: Connect the Raspberry Pi (with operating system) to its components
Before powering on your Raspberry Pi, remove the MicroSD card from the previous computer (where you installed the operating system) and insert it into the Raspberry Pi. The SD card slot is on the bottom.
If you haven’t already done so, attach these components to the Raspberry Pi:
- Power supply
- MicroHDMI (connect the other end to a monitor)
- Ethernet (option to use WiFi further in the article)
- USB mouse
- USB keyboard
Power up the Raspberry Pi and watch the monitor to walk through the initial settings.
If prompted, fill in:
- Language preferences
- Your default password
- WiFi settings
- System updates
As a result, you’ll see the main screen of the Raspberry Pi OS where you can click on the Start menu, set Network settings, open a Browser, and manage Files.
Step 3: Connect to your network (preferably through ethernet)
It’s highly recommended you use ethernet for just about anything you do with a Raspberry Pi. If you’ve already plugged in your ethernet connection, scroll over the Network icon in the toolbar to view if the wired connection is active. To set up WiFi, click on the same Network icon to select a WiFi network. Use the password to login.
Step 4: Control the Raspberry Pi using the Terminal
Now that the Raspberry Pi is connected to the network, you have several options to control its interface.
Personally, I find it best to attach a monitor directly to the Raspberry Pi. There, you can use the Terminal to complete all installations necessary in this tutorial. The Terminal is accessible from the main toolbar on Raspberry Pi OS.
Step 5: Activate SSH
Even though I prefer skipping remote access for installing WordPress on Raspberry Pi, it makes sense to grant secure remote access for tapping into your WordPress site from another computer once the installation is done. Therefore, you should enable SSH, a secure remote connection protocol, for completing commands from other computers on your network.
💡 There are two ways to turn on SSH:
Option 1: Use the GUI
On Raspberry Pi OS, go to the Applications Menu → Preferences → Raspberry Pi Configuration.
Open the Interfaces tab. Turn on the option for SSH.
Option 2: Use the Terminal
Alternatively, you could open the Terminal, then paste or type in the following:
sudo service ssh start
Click Enter on the keyboard to activate SSH.
How to autorun SSH after reboot
Unfortunately, SSH doesn’t run automatically once you boot up your Raspberry Pi. That’s why it’s wise to run the following command in the Terminal so SSH activates after each reboot:
sudo crontab -e
Add this line to complete the process:
@reboot /usr/sbin/service ssh start
Code language: CSS (css)
Step 6: Install Apache (the web server)
For WordPress to run locally on a Raspberry Pi, you need a web server.
Since WordPress is built with PHP, we’ll install what’s called a LAMP server on the Pi. After that, you’ll have a fully functional local WordPress site on the Raspberry Pi.
Here are the components of a LAMP server:
- L: Linux (already installed as Raspberry Pi OS)
- A: Apache server (most popular web server; it serves up HTML files for visitors to view as websites in their browsers)
- M: MySQL database server (needed for WordPress to store posts, pages, and other items; we’ll use the MariaDB database server)
- P: PHP (a programming language for making dynamic webpages; WordPress is built using this programming language so we must install it)
Since we already have the “L” portion of the equation installed (Raspberry Pi OS), we can move on to installing Apache.
In the Raspberry Pi Terminal, type in this command and click Enter/Return:
sudo apt-get install apache2
Code language: JavaScript (javascript)
For the next prompt, type in Y and click Enter/Return.
Apache should now be installed on the Pi.
Test the installation of Apache
To test Apache, open a browser window and navigate to the IP address of your Raspberry Pi. To access the IP, hover your mouse over the Network icon in the Raspberry Pi toolbar. Once you do that, a pop-up appears with the IP address.
⚠️ Note: Make the Pi’s IP static on your router if you want to ensure it never changes.
In the browser, type the IP address into the address bar using this format (replace Xs with numbers):
http:
Code language: JavaScript (javascript)
You should see a Debian2 Apache Default Page that indicates Apache was installed properly.
Step 7: Install PHP (the programming language necessary for WordPress to function)
The next part of the LAMP server involves installing the PHP programming language and letting Apache access it.
Using the Terminal on the Raspberry Pi OS, type in this command and hit Enter/Return:
sudo apt-get install php
Code language: JavaScript (javascript)
Type in Y, then click Enter/Return.
That should successfully install PHP on your Pi.
Test to see if PHP works
The best way to test if the PHP works involves installing a test PHP file to view in the browser.
In the Raspberry Pi Terminal, run this command (this brings you to the /var/www/html folder):
cd /var/www/html
Code language: JavaScript (javascript)
Then, create and start editing a test file called test.php. Then run this command in the Terminal:
sudo nano test.php
Code language: CSS (css)
The previous command grants you root access to the file, so you should see a slightly different window to edit the file. Paste in this PHP code:
echo "Hi there!"; ?>
Code language: HTML, XML (xml)
⚠️ Note: Feel free to change the “Hi there!” message.
Hold down Command + X (or Control + X if using a Windows-oriented keyboard) to exit the file.
The window asks you to save the file. Do so by typing Y on your keyboard.
Finally, click Return/Enter to confirm.
Open a new browser window. Type in your Raspberry Pi’s IP address from before, but continue the address with /test/php.
It should look like this (but replace the Xs with IP address numbers):
http:
Code language: JavaScript (javascript)
If you see the message displayed on the screen, PHP is active!
Step 8: Install MariaDB as the database server
It’s best to install the MySQL (MariaDB) database at the end.
Start by opening the Raspberry Pi Terminal. Run this command:
sudo apt-get install mariadb-server
Code language: JavaScript (javascript)
Type Y and hit Enter/Return.
The Raspberry Pi now has MariaDB installed.
Configuring MariaDB
You must create a username and password for the root user to access the database.
To make that happen, open the Terminal on the Raspberry Pi. Run this command to connect to the MySQL CLI:
sudo mysql -uroot
Follow it up by running this command to make a new database user (you can change the ‘wordpress’ and ‘password’ options if you’d like):
CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'password';
Code language: JavaScript (javascript)
Run yet another command in the terminal (this makes a new WordPress database):
CREATE DATABASE wordpress;
Finally, run this command in the Raspberry Pi Terminal to grant database permissions to your WordPress user:
GRANT ALL ON wordpress.* TO 'wordpress'@'localhost';
Code language: JavaScript (javascript)
When you’re done, run this in the Terminal to quit.
quit
You now have a new database, database user, and the correct privileges for your database.
Connecting PHP to MySQL
PHP must connect to the database you just made. Run the following command in the Terminal to make it happen:
sudo apt-get install php-mysql
Code language: JavaScript (javascript)
Type Y and click Enter/Return to move forward.
Finally, run this command in the Terminal (which restarts Apache and completes the connection):
sudo service apache2 restart
Test out the PHP to MySQL connection
You can test the connection between PHP and the MySQL (MariaDB) database by running this command in the Terminal:
mysql -u wordpress -p
Type in the password you just created for the database (“password,” unless you changed it). Hit Enter/Return.
⚠️ Note: On the screen it looks like you’re not typing in anything, but it’s actually working.
Also in the Terminal, run this (to see if the user can view the database):
SHOW DATABASES;
You should see at least one WordPress database:
Seeing a WordPress database tells you the user can access the database, and that PHP can connect to the database. Run the quit command to finish:
quit
Step 9: Install WordPress itself
Perhaps the easiest part about this process is installing WordPress itself. On a Raspberry Pi, you must install the WordPress.org version of WordPress. However, instead of downloading WordPress from the WordPress.org website, it’s easier to use the Raspberry Pi Terminal.
Run this command to install WordPress on Raspberry Pi:
sudo wget https:
Code language: JavaScript (javascript)
Then, run this command in to move the web folder to the right place and to unzip the file onto the Pi:
cd /var/www/html
sudo unzip wordpress.zip
Code language: JavaScript (javascript)
To remove any issues with permissions in the future, use the Terminal to run these commands:
sudo chmod 755 wordpress -R
sudo chown www-data wordpress -R
You now have WordPress installed on your Raspberry Pi. All you have to do is create an admin user and configure the database.
Step 10: Configure WordPress on Raspberry Pi
In a browser (either on the Raspberry Pi or a computer on your network) visit this address:
http:
Code language: JavaScript (javascript)
That brings you to the WordPress configuration wizard. Pick a language and click Continue.
Click Let’s Go on the next page.
Fill in these fields:
- Database name
- Username
- Password
- Database Host
- Table Prefix
If you followed this tutorial exactly, your fields will look like the picture below. If not, adjust the field entries to what you decided. Click Submit.
Click Run the installation.
Now create a WordPress Admin user account. This allows you to log into the backend of your WordPress site.
Fill in these fields with whatever you want (but remember the username and password):
- Site Title
- Username
- Password
- Your Email
Click Install WordPress.
You’ll get a success message that WordPress has been installed! Click the Log In link to access your dashboard.
Step 11: Enjoy your local WordPress site installed on a Raspberry Pi
Everything else from here on out works just like a regular WordPress website. You can visit these addresses from any computer in your network:
http://X.X.X.X/wordpress
brings you to the frontend of your WordPress sitehttp://X.X.X.X/wordpress/wp-admin
takes you to the backend dashboard for your WordPress site
At the login page, type in the Username and Password you just created for a WordPress admin user (not the username and password for the database). Click Log In.
Now you have a fully functional, locally stored WordPress site on your Raspberry Pi! You can’t access the site from the public internet, but that’s actually a good thing. You’d open up all sorts of security vulnerabilities to your home network by doing that. What’s more, Raspberry Pi isn’t nearly as fast as shared hosting, making your site too slow for regular use.
Regardless, feel free to upload new themes and adjust the appearance of your WordPress site.
You can also use the Block Editor for a visual editing experience.
Developers, designers, and even writers will enjoy the ability to test all types of WordPress plugins.
You might even create private, locally stored blog posts or pages, or to publish on the internet later.
Congrats! You’re done. 🥳
Why host WordPress on Raspberry Pi in the first place?
At first, I thought that Raspberry Pi can’t possibly provide a reliable server experience for WordPress; and what’s even the point when you have so many inexpensive hosting options available? After plugging in my Raspberry Pi and getting it configured with WordPress, it hit me: the Raspberry Pi serves as the perfect choice for a wide range of local projects. Not for live, publicly available websites (that’s actually dangerous), but rather for testing, development, and educational sites.
Here’s where the Raspberry Pi shines for WordPress sites:
- Cost-effectiveness: Besides some price-gouging during the pandemic shortage, the Raspberry Pi has remained affordable. It hardly dents your energy bill, and as of this article, I’m finding Raspberry Pi 4 models for anywhere from $35 to $60.
- Testing and development for WordPress themes, plugins, and entire websites: Everyone, from WordPress developers to writers and site owners, requires sandboxing environments to build and test themes and plugins.
- Total control: You can install any software on it. The setup provides root access, and you control everything from performance tuning to the customization of PHP.
- Learning and training: The Raspberry Pi offers perhaps the funnest piece of hardware for learning about server management, web development, computing, and WordPress.
- Website backups: You can use the Pi as a secondary local backup alongside a cloud backup plugin.
- Energy-efficient solution that’s always on: The Pi keeps costs low for development projects. Not to mention, you shouldn’t rely on an old computer that may shut off at times.
Why you should NOT install WordPress on Raspberry Pi
For any public websites and blogs: Although it’s possible, I don’t recommend this for a publicly accessible site. Few people have the time to handle maintenance, updates, and security tasks to protect their home networks from hacks. That’s what web hosting is for. Shared hosting costs a few bucks a month to keep your website far away from your home network. In short, a public website on the Pi means security risks and slow loading.
That’s a wrap
The solution is pretty cut-and-dry: installing WordPress on Raspberry Pi works wonders for testing, learning, and development environments, but not for live websites. Nevertheless, making it work for you is a fun process that I hope you’ll enjoy!
If you have any questions on how to do this, why would anyone even do this, or anything else, leave us a comment below.