Skip to content

I Installed WordPress on Raspberry Pi: My Experience and Findings

I’ve installed WordPress countless times. With shared hosting, VPS hosting, local sandbox environments, and even a dedicated server once or twice. Never, however, have I installed WordPress on a Raspberry Pi.

Like me, you may have heard about the process but wondered why – why on earth install WordPress on Raspberry Pi? I wanted to find out, too.

I planned to backup my version of Home Assistant currently running on my Raspberry Pi 4 and walk through the entire process of setting up a local WordPress environment using a Raspberry Pi. To my surprise, this setup was fun and simple enough once I sifted through the barrage of convoluted tutorials online. I also found a myriad of useful reasons to do this.

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.

The Raspberry Pi device.

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.

MicroSD card to install WordPress on Raspberry Pi.

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
My setup to install WordPress on Raspberry 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.

Micro HDMI to install WordPress on Raspberry Pi.

The other end of the cable (standard HDMI) plugs into the monitor to view and navigate through the Raspberry Pi interface.

HDMI cable.

Hardware item #5: USB keyboard

  • Any USB keyboard works since modern Raspberry Pis have up to four USB ports
USB keyboard.

Hardware item #6: USB mouse

  • Any USB mouse works to connect to the Raspberry Pi
USB mouse.

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.

USB-C power source.

The USB-C cable plugs into the power supply port.

Power source to install WordPress on Raspberry Pi.

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.

Raspberry Pi with case.

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.

Pi with cooler.

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.

Ethernet linked to 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.

All ports connected to install WordPress on Raspberry Pi.

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.

Download Raspberry Pi imager.

Open and run the Raspberry Pi Imager on your device. I’m using a Mac, so I’ll add the Imager to my Applications.

Install Raspberry Pi imager.

Then, I’ll click on the new app to open it.

Open the imager.

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:

  • Device
  • OS
  • Storage

Click Choose Device.

Pick 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.

Choose the right Raspberry Pi.

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.

Pick the OS.

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.

Pick the storage to install WordPress on Raspberry Pi.

With your selections made, click Next.

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.

Click on No.

Confirm Yes to erase all existing data on your MicroSD. A fresh SD card is required to install a new Raspberry Pi OS.

Erase SD card.

Wait for the Raspberry Pi Imager to write the operating system onto the MicroSD card.

Writing to install WordPress on Raspberry Pi.

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.

Continue button.

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.

Plug in MicroSD card to Raspberry Pi.

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
All plugs attached to Raspberry Pi.

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.

Raspberry Pi OS interface.

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.

Adding network connection.

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.

Using the terminal to install WordPress on Raspberry Pi.

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.

Raspberry Pi configuration.

Open the Interfaces tab. Turn on the option for SSH.

SSH active to install WordPress on Raspberry Pi.

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 startCode 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 apache2Code language: JavaScript (javascript)

For the next prompt, type in Y and click Enter/Return.

Yes or no.

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.

Find Raspberry Pi IP.

In the browser, type the IP address into the address bar using this format (replace Xs with numbers):

http://X.X.X.XCode language: JavaScript (javascript)

You should see a Debian2 Apache Default Page that indicates Apache was installed properly.

Apache default page test to install WordPress on Raspberry Pi.

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 phpCode language: JavaScript (javascript)
Install php command.

Type in Y, then click Enter/Return.

Yes or no commands.

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/htmlCode language: JavaScript (javascript)

Then, create and start editing a test file called test.php. Then run this command in the Terminal:

sudo nano test.phpCode language: CSS (css)
Nano test command to install WordPress on Raspberry Pi.

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:

<?php echo "Hi there!";  ?>Code language: HTML, XML (xml)

⚠️ Note: Feel free to change the “Hi there!” message.

Make a message to test PHP.

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.

Confirm yes.

Finally, click Return/Enter to confirm.

Write file name to install WordPress on Raspberry Pi.

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://X.X.X.X/test/phpCode language: JavaScript (javascript)

If you see the message displayed on the screen, PHP is active!

Hi there message from active PHP.

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-serverCode language: JavaScript (javascript)
Install mariadb to install WordPress on Raspberry Pi.

Type Y and hit Enter/Return.

Yes or no.

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
Sudo mysql command.

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)
Make a user to install WordPress on Raspberry Pi.

Run yet another command in the terminal (this makes a new WordPress database):

CREATE DATABASE wordpress;
Create WordPress database.

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)
Grant all command.

When you’re done, run this in the Terminal to quit.

quit
Quit command.

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-mysqlCode language: JavaScript (javascript)
Install php to install WordPress on Raspberry Pi.

Type Y and click Enter/Return to move forward.

Yes or no.

Finally, run this command in the Terminal (which restarts Apache and completes the connection):

sudo service apache2 restart
Apache restart to install WordPress on Raspberry Pi.

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
Mysql command to install WordPress on Raspberry Pi.

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.

Enter password.

Also in the Terminal, run this (to see if the user can view the database):

SHOW DATABASES;
Show database command while we install WordPress on Raspberry Pi.

You should see at least one WordPress database:

Check on databases.

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
View databases to install WordPress on Raspberry Pi.

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://wordpress.org/latest.zip -O /var/www/html/wordpress.zipCode language: JavaScript (javascript)
Install WordPress on Raspberry Pi.

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.zipCode language: JavaScript (javascript)
Unzip files.

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
Permissions commands to install WordPress on Raspberry Pi.

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://X.X.X.X/wordpressCode language: JavaScript (javascript)

That brings you to the WordPress configuration wizard. Pick a language and click Continue.

Pick language on WordPress.

Click Let’s Go on the next page.

Lets go.

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.

Database name after you install WordPress on Raspberry Pi.

Click Run the installation.

Run 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.

Create a WordPress user.

You’ll get a success message that WordPress has been installed! Click the Log In link to access your dashboard.

Log in after you install WordPress on Raspberry Pi.

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 site
  • http://X.X.X.X/wordpress/wp-admin takes you to the backend dashboard for your WordPress site
Admin page of local WordPress.

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.

Login in after I install WordPress on Raspberry Pi.

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.

Editing themes after I install WordPress on Raspberry Pi.

You can also use the Block Editor for a visual editing experience.

Editing design on WordPress after I install WordPress on Raspberry Pi.

Developers, designers, and even writers will enjoy the ability to test all types of WordPress plugins.

Testing plugins on WordPress.

You might even create private, locally stored blog posts or pages, or to publish on the internet later.

Adding posts to WordPress.

Congrats! You’re done. 🥳

Frontend view after I install WordPress on Raspberry Pi.

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.

Don’t forget to join our crash course on speeding up your WordPress site. Learn more below:

 
Yay! 🎉 You made it to the end of the article!
Joe Warnimont

0 Comments
Inline Feedbacks
View all comments

Or start the conversation in our Facebook group for WordPress professionals. Find answers, share tips, and get help from other WordPress experts. Join now (it’s free)!

0
Would love your thoughts, please comment.x

Most Searched Articles

Best JavaScript Libraries and Frameworks: Try These 14 in 2024

In this post, we look at the best JavaScript libraries and frameworks to try out this year. Why? Well, with JavaScript being available in every web browser, this makes it the most accessible programming language of ...

20 Best Free WordPress Themes for 2024 (Responsive, Mobile-Ready, Beautiful)

If you're looking for only the best free WordPress themes in the market for this year, then you're in the right place. We have more than enough such themes for you right ...

12 Best WordPress Hosting Providers of 2024 Compared and Tested

Looking for the best WordPress hosting that you can actually afford? We did the testing for you. Here are 10+ best hosts on the market ...

Handpicked Articles

How to Make a WordPress Website: Ultimate Guide for All Users – Beginners, Intermediate, Advanced

Many people wonder how to make a WordPress website. They’ve heard about WordPress, its incredible popularity, excellent features and designs, and now they want to join the pack and build a WordPress website of their own. So, where does one get ...

How to Start an Ecommerce Business: Ultimate Guide for 2024

Is this going to be the year you learn how to start an eCommerce business from scratch? You’re certainly in the right place! This guide will give you a roadmap to getting from 0 to a fully functional eCommerce business. ...