Create a WordPress Website on RaspberryPi at Home!

Table of Contents

WordPress websites make up ~1/3 of the internet (including, they are incredibly easy to setup, and they are FREE! This tutorial covers how to setup and host your own WordPress website on a RaspberryPi at home. This is not only a great way to learn how websites work, but it can also be used as a dev site, allowing you to test things without breaking your main site.


WordPress is likely the most ubiquitous and easiest ways to setup and host your own website. When I started creating, it was a no-brainer that I would host it on WordPress because it is just so easy. A RaspberryPi actually makes an ideal local host for a WordPress site because they are cheap, low powered, and easily configurable. However, I cannot recommend them as a way to host a public website. There are simply too many security vulnerabilities for a consumer to worry about. However if you choose to forgo these risks, I have a section at the end of this tutorial on how to set that up.

Software Used

  • Apache2
    • Apache is the engine which actually runs the website
  • PHP
    • PHP is the code which Apache uses to handle web traffic
  • MarinaDB-10
    • MarinaDB is a better version of MySQL than MySQL is. Across the board almost all users of MySQL have migrated to MarinaDB. It is going to be controlling the database of the WordPress site, storing every post, comment, and configuration.
  • WordPress
    • WordPress brings all of these things together to make creating a website incredibly easy. It is open source and has thousands of templates, plugins, and widgets which allow you to do almost anything on your website without writing a single line of code.


You would actually be quite surprised by the performance possible with a RaspberryPi 4 hosting a WordPress site. For the RBP4’s launch Ada-fruit hosted the announcement site on a web cluster of RaspberryPi 4’s with shocking performance given the number of people hitting the site. In general for most websites, the more available RAM the faster the site will be to cache all of these files.

How to Setup RaspberryPi WordPress Site


All that you need to have setup before this tutorial is a RaspberryPi with the ability to SSH into and a static IP address.

Step 1: Install Required Software Packages

In order to host a WordPress site on a RaspberryPi you need three software packages; Apache2, PHP, and MarinaDB-10. They can all be installed using apt get with the following code:

sudo apt update

This will update your package links to make sure you are getting the most recent data. You should run this every time you install packages for the first time in a day.

sudo apt install apache2 -y

This will install our website engine, Apache2, which will handle web requests.

sudo apt install php -y

PHP is a common web codebase that Apache will use to actually perform actions on the website.

sudo apt install mariadb-server-10.3 php-mysql -y

MarinaDB is the database which we will be using to store all of the data within the WordPress site. Then PHP-MySQL is used to allow PHP to interface with MarinaDB (which is a fork of MySQL).

After this all of your software should be installed! If you type the IP address of your RaspberryPi into a web browser you should see the following page, which is the default placeholder for Apache2.

Step 2: Configure Database for WordPress

Now that you have all of the required packages, you are going to want to setup a MarinaDB database so that WordPress will be able to interface into the database. To do this, first we are going to initialize a new database by typing:

sudo mysql_secure_installation

Which will bring you to a setup menu asking you to enter the root password. Since this is a new database there is no password so just hit enter.

You will then be asked to create a new root password. This will become the password to your database, and will be stored in plain text within the WordPress config file.

Then simply say yes to the remaining options as your MarinaDB database will be initialized!

Now that the database is initialized we need to set it up sp that WordPress can interface into it. To do this we are actually going to interface directly into our database and execute some commands. To open up this interface type:

sudo mysql -uroot -p

and then enter the password you setup in the previous step. You should now be brought into MarinaDB’s interface. Any lines written here will be actions applied to the database.

The first thing to do is create a database named “WordPress” (default that WordPress will look for) with the following command:

create database wordpress;

Now you need to give the root user permissions to the WordPress database that was just setup. To do this type:

GRANT ALL PRIVILEGES ON wordpress.* TO ‘root’@’localhost’ IDENTIFIED BY ‘{password from last step in single quotes}’;

This single line of code is a database statement which tells MarinaDB to give the local root user access to all data tables within the database “wordpress” if they authenticate with the password in the single quotes.

These privileges are only going to be installed on a database startup. To force them to update type:


and you are now done! you can exit MarinaDB with a Ctrl+D.

Step 3: Install WordPress on you RaspberryPi

We now need to install the WordPress codebase on the RaspberryPi and place the code in the web root folder, /var/www/html.

The first step is to download the WordPress tarball. First cd into the user folder to ensure there is a clean place to download the tarball to:

cd ~

Now that you are in your home directory you can download the latest WordPress version by typing:

sudo wget

If you type ls you should now see a latest.tar.gz file in your home directory. This is a compressed “Tarball” which we need to extract by typing:

sudo tar xzf latest.tar.gz

Now you should have a wordpress directory within your home folder which contains all of WordPress! We are going to want to move it into the web root folder, /var/www/html, but first we need to remove the temp files that are stored there by typing:

sudo rm -r /var/www/html/*

The folder should now be empty! We can now copy the WordPress code into the web root folder by typing:

sudo cp -r wordpress/* /var/www/html/

The code should now be transferred in. We are ready to configure our WordPress site!

Step 4: Configure WordPress Site

The WordPress site should be all ready to go now. First you are going to want to restart Apache2 in order to make sure it will play nice with MarinaDB by typing:

sudo service apache2 restart

Your WordPress website should now be live. To access it all you have to do is connect to it by typing the IP address of your RaspberryPi into your web browser. You will then be brought to a WordPress setup menu shown below:

Select your language and hit continue. On the next page just hit Lets Go! and you will be brought to the database configuration page. Fill it out to match below, substituting password for the password you configured in Step 2.

Your WordPress site will now be able to directly communicate with the MarinaDB database you have configured. This means that all of your posts, comments, and configurations will be able to be saved.

The next menu page will bring you to the WordPress homepage settings. This is where you setup your Site title, admin username and password as well as your email address. If you are going to be opening up this site online make sure to have an extremely secure password.

Once you are done click Install WordPress and your WordPress site will become up and running. You will be brought into your WordPress admin page shown below.

This admin page is where you can do all of your configuration for your WordPress Site. Start by selecting a template and working your way though the menus. The RaspberryPi is now hosting a WordPress site that you can access from your local network just by typing in the IP address of your RaspberryPi.

Step 5: (optional) Opening up to the Internet

Opening up your RaspberryPi WordPress site is a risk that I would not recommend taking unless you have a strong router as well as a good understanding of security.

DDNS Server

If you choose to forgo the risks, you will want to setup a DDNS server which creates an address on the Internet which points to the IP address of your home IP address. This address will allow people to type in an address such as and have it point to your home’s IP address.

Port Forwarding

In order for people to access your WordPress site hosted on a RaspberryPi you need to allow them access through your router’s firewall. The two ports used for web traffic are 80 for HTTP and 443 for HTTPS. If you want people to access the site, you are going to setup your router (google your router name + Port forward) to forward port 80 (and 443 if you are using HTTPS) to the local IP address of your RaspberryPi.


You now have your RaspberryPi hosting a WordPress site! Since starting, I have become increasingly interested in WordPress and AWS as well. Stay tuned for more tutorials on WordPress and AWS!

Happy web-hosting!

Leave A Comment