Step by step guide to install WordPress on a Raspberry Pi

I will present here an ultimate guide allowing you to have WordPress installed and functional on Raspberry Pi from scratch

How to install WordPress on a Raspberry Pi?
Installing WordPress on Raspberry Pi is possible.
Start by installing a classic web server: Apache, MySQL, PHP.
Then, a WordPress archive is available on the official website.

I’m going to assume that your Raspberry Pi is empty, or that you want to reinstall one just for WordPress
So, you have here all the necessary information from scratch
If this is not the case, and there are already steps you have completed, I let you use the summary below to start where you left off.

Install Raspbian

Download Raspbian

Firstly, you need to download the latest version of Raspbian from the official website

If you only want to install WordPress, the lite version may be enough, you have to do it without the GUI, but it should not be too complicated

Download the image and continue

Raspberry Pi Bootcamp
Take it to the next level.
I'm here to help you get started on Raspberry Pi.
Learn all the skills you need in the correct order.

Flash an SD Card with Raspbian

I then recommend using Etcher
If you have not installed it yet, get it from the official website
It’s a tool that allows you to flash an SD card very easily on Linux, Mac, or Windows

  • Start Etcher
  • Select the location of the Raspbian image
  • Choose your SD card
  • Click on Flash

flash raspbian with etcher

Once the SD card is ready, eject it and insert in your Raspberry Pi

First Boot

The installation is automatic, you just have to start your Raspberry Pi, and Raspbian will launch


If you chose the Desktop version, a welcome menu will open:

  • Choose your language preferences
  • Change the default password
  • Connect to the wifi if necessary
  • Accept system updates
  • Reboot the Raspberry Pi

If everything worked fine, move on
Otherwise, it will be required at least to succeed to connect the network and to change the password (the following paragraph can help you)


If you chose the lite version, you would have to do the same thing but by hand

  1. Login
    1. Default login: pi
    2. Default password:  raspberry
  2. Change the password
  3. Use raspi-config to configure network and change language preferences if needed (nothing to do if Ethernet with DHCP)
    sudo raspi-config
  4. Once connected to the Internet, update your system
    sudo apt-get update
    sudo apt-get upgrade
  5. Reboot

If everything is ok, move on

Enable SSH

SSH is a secure remote connection protocol, which allows you to launch commands from another computer on the network

Unless it’s not possible for you, I strongly recommend using SSH for the rest of this guide
It will be much simpler to copy commands, test, etc … from your usual computer

By default, the service is not started on Raspberry Pi
So we will enable SSH and connect to it before continuing


To enable SSH through the GUI, go to the applications menu, then Preferences > Raspberry Pi Configuration > Interfaces
Check Enabled for the SSH line


You can also launch the terminal and type this command:

sudo service ssh start

Autorun at each boot

The SSH service is not started automatically when the Raspberry Pi is started
If necessary you can start it with each reboot, by typing this command:

sudo crontab -e

And adding this line:

@reboot /usr/sbin/service ssh start


You can now connect to your Raspberry Pi in SSH

If you are not familiar with SSH, I recommend you read my two articles about it before continuing:
How to connect in SSH?
What is the IP address of my Raspberry Pi?

Install a web server (Apache, PHP)


WordPress is a web application, written in PHP
We need a web server to make it available so that we will set up all the components of a LAMP server:
L: Linux (Raspbian)
A: Apache
M: Mysql (MariaDB)

We already have the “L” in place with our Raspbian installation, let’s go to Apache

Master your Raspberry Pi in 30 days
Download the eBook.
Uncover the secrets of the Raspberry Pi in a 30 days challenge.
Learn useful Linux skills and practice multiples projects.

Install Apache

Apache is the most popular web server on the internet
Its role is to provide visitors with HTML files that will then be interpreted by browsers

Install Apache with apt :

sudo apt-get install apache2

It works!

You can now navigate to the default web page by typing the IP address of the Raspberry Pi into a browser (http: //X.X.X.X)

You should see something like this :

Install PHP

PHP is a programming language, which will allow you to create dynamic web pages (e.g. display to add your name dynamically in the page)

We need to install PHP and allow Apache to use it

sudo apt-get install php

Hello world

To make sure that PHP is active, we will do the following test:

  • Go to the folder /var/www/html
    cd /var/www/html
  • Create and edit the test.php file
  • sudo nano test.php
  • Paste the following PHP code
    echo "Hello World!"; 
  • Save and close

Then go to http://X.X.X.X/test.php and watch

It should be displayed only “Hello World!”
If so, everything works fine so far; you can move on as a result

Install a database server (MariaDB)


We are now able to create a website in HTML and PHP
But WordPress needs a little more; it requires a database to store all posts, pages, and configurations

For that, we will install MariaDB, a free fork of MySQL which exists since the acquisition of MySQL by Oracle


To install it, nothing more simple, let’s use again apt:

sudo apt-get install mariadb-server

It takes a little longer than the previous ones 🙂


Access to the database is protected by a password, which may be different from the one of the user

By default only the root user has access without a password from his account, so we will connect to it and create a new account for WordPress

  • Connect to the MySQL CLI
    sudo mysql -uroot -p
  • Create a new user
    CREATE USER 'wordpress'@'localhost' IDENTIFIED BY 'password';
  • Create a new database
    CREATE DATABASE wordpress;
  • Give WordPress user all privileges on the new database
    GRANT ALL ON wordpress.* TO 'wordpress'@'localhost';
  • Quit the MySQL CLI

PHP MySQL package

To allow PHP to connect to MySQL, a last small package must be installed

sudo apt-get install php-mysql

Restart Apache to apply

sudo service apache2 restart


Again, let’s do a quick test to make sure the connection is functional:

  • Try to connect to MySQL
    mysql -u wordpress -p
  • Enter the user password
  • Check if the user can view the new database
  • Quit

If you see at least the WordPress database, then it’s okay, you can continue and move to the WordPress installation itself

Install WordPress


WordPress offers its software under two versions

  • A version hosted on their servers,
  • A version to download,

So you have to use the second option to use it on your Raspberry Pi

Download WordPress from the official website
Copy the link (right click on it) and download it to the Raspberry Pi via SSH:

sudo wget -O /var/www/html/


Move to the web folder and uncompress the file:

cd /var/www/html
sudo unzip


To avoid permissions problems with WordPress, and also to no longer need the sudo later, we can modify the rights on the WordPress files

sudo chmod 755 wordpress -R
sudo chown www-data wordpress -R

This will give full rights to Apache, and read/execution to others


The code of WordPress is now in place; it remains only to configure it, i.e.:

  • Configure the connection to the database
  • Create a login for the administration of WordPress

Access the installation wizard by pointing your browser at http://X.X.X.X/wordpress

Click Let’s Go Button
On the next screen, fill the form with the MySQL user created before
You should have something like this

Validate, and the wizard will ask you to run the installation
Click the button and wait

On the next screen you have to choose the site name, and create the administrator user

Fill in the fields with what you want, then validate
It will still take a few moments

Here we are!

The configuration is complete; you can go back to the address http://X.X.X.X/wordpress to see your WordPress website live!
The wizard offers you to go directly to the administration page; we’ll talk about it right after

Extra Tips for WordPress

WordPress introduction

I will not go into much detail in using WordPress; this is not the goal here
But now that it is installed, I will give you 2/3 tips to get started

Admin and Front

WordPress is composed of two parts:

  • Administration: accessible by adding / wp-admin to the URL, it allows you to configure your site and add content
  • Front: this is the part visible to all visitors

When you are logged in, the top bar allows you to switch from one to the other easily


WordPress comes with a basic design, but it is possible to customize your site as you wish
To get started, go to Appearance> Themes
Here you can add free themes from the list

In the Appearance menu, you can also manage the menus of your site, and the widgets
A widget is a block that can be integrated into the sidebar for example to display a search engine or an image


A bit like Raspberry Pi, WordPress provided a scalable foundation
It is indeed possible to install plugins, to add additional features to your website or your admin

Go to Plugins > Add new to see a list of all plugins available

Pages and Posts

Once your site is personalized, it’s time to add content

For this you can create two types of content:

  • Pages: These are static pages, which contain for example your homepage or a contact form
  • Posts: that’s all the rest of the content, they are grouped into categories to make it easier for them to search later

You will be able to add your pages and categories to your menus, and the posts will appear automatically

Services management

Let’s go back to our services that allow you to run WordPress: Apache, PHP, and MySQL

You need to know that there are commands to start or stop them
This may be useful in case of a crash, or if you want to stop them to cut access to the site
Here are the commands:

sudo service apache2 start | stop | restart | reload
sudo service mysql start | stop | restart | reload

As I said above PHP is a module of Apache, so there is no particular command to launch
If Apache is running, the PHP pages will be displayed correctly

Services configuration files

I will also tell you where to find the configuration files if you ever want to make changes

Apache : /etc/apache2
PHP : /etc/php
MySQL : /etc/mysql

In the case of a WordPress installation, you normally do not need to touch it
But maybe if this article makes you want to try other things it could be useful


PHPMyAdmin is a handy tool that you can use on a LAMP installation
This is a web interface that will allow you to access your MySQL databases in a more intuitive way
You will be able to view and modify the data, create users, manage rights and supervise the MySQL server.

To install it, use the following command

sudo apt-get install phpmyadmin

Choose apache2 as your web server when asked
You can skip database configuration

Once the installation is complete, the interface is available at http://X.X.X.X/phpmyadmin
Log in with your wordpress account to see the WordPress database

Share the website on the Internet

If you want to share this newly created website on the internet, it is quite possible

You simply have to redirect a port from your internet box on the port 80 of Raspberry Pi = to be able to connect to the site by using the public IP address of your Internet connection
Public IP:PORT => Raspberry Pi IP: 80

So you can access the website with http://Y.Y.Y.Y:PORT/wordpress
Y.Y.Y.Y is your public IP, and PORT the port you choose

If you do not have a fixed IP address, you can inquire about dynamic DNS services that allow you to use a web address that will be constantly updated with your new IP address


So you learned to install a LAMP server on Raspberry Pi and to install WordPress to use it
You also had some tips to go further with your installation of WordPress

I was pleasantly surprised to see that WordPress works pretty well on Raspberry Pi, while it happens to be rather slow on some professional web hosting
Can be a project idea to think about …

This tutorial doesn't work anymore? Report the issue here, so that I can update it!

Patrick Fromaget

I'm the lead author and owner of My goal is to help you with your Raspberry Pi problems using detailed guides and tutorials. In real life, I'm a Linux system administrator with a web developer experience.

18 thoughts on “Step by step guide to install WordPress on a Raspberry Pi

  1. Hi,
    Thanks for the notes. everything worked as expected but if I try to access the web server WordPress site on the local LAN I seem to get the webpage but without any formatting. Do you have any suggestions as to what I’m doing wrong?

    1. Hi Howard
      I don’t know if this is it, but I googled a bit (“broken wordpress site serves pages without formatting”) and found this page with a few tips as the first hit. There are more hits that might help. Also, as you’re on a local LAN maybe a firewall rule on your LAN client or router or WordPress server is blocking remote content from the WAN or your WordPress server to your LAN client, or blocking insecure content while letting secure content through, or maybe SSL is required to send/receive secure content but you don’t have SSL working.
      * Find out what the error is
      * Insecure content from CDN
      * Security restriction
      * 404 on minified files

  2. Hi,
    Thank you for taking the time and the trouble to produce this guide. Glad you included the MariaDB instructions that while probably transparent to the user using MySQL, making it explicit helps reduce anxiety.
    I had an issue with “Your PHP installation appears to be missing the MySQL extension which is required by WordPress.” Searching for solutions for this problem was hard as the information available is for php5 or php7. Several attempts at apt-get update and install were unsuccessful. Only when I ventured into changing the CLI request to php7.3, the one running in my installation, was I able to get the installation going.

    One question remains in my future, if you have the time. Is it possible to make this WordPress installation answer to traffic coming in via wifi? I plan to use it in areas of low economic resources an am hoping to this can serve as a communication tool in a small isolated community. I would appreciate if you shared how to do this.

    1. Hi Eusebio,

      Yes, it works the same via Wi-Fi
      Just use the Wi-Fi IP address to access the WordPress website

      If you have any issue let me know, I may have misunderstood your question

  3. Hello,
    Thanks again for your work and for the reply. I set up a new site using your instructions. Everything went well. Actually, you understood what I wanted to know, yet my question could have been more specific.

  4. How do I set this up so I can get the site to work without the /worpress?

    I can remotely access the wordpress site from my domain name/wordpress.

    I tired, with a fresh installation, following all the instructions, the only difference is I unzipped the wpfolder contents directly in /var/www/html.

    Changed –

    sudo chmod 755 html -R
    sudo chown www-data html -R

    In wp-admin I changed

    WordPress Address (URL)= http://myowndomainname
    Site Address (URL)= http://myowndomainname

    But I cannot connect to it from the internet. Only on my LAN.

    Please help

    1. Hi Dan,

      So http://IP is working but not ?

      Did you change your DNS and router configuration to make this works?

      If this is ok, the issue probably comes from the Apache configuration (maybe it doesn’t respond on any IP address, or the domain name is not correctly configured in the sites-enabled folder

  5. At “Install a database server (MariaDB)”
    In “Connect to the MySQL CLI” is:

    sudo mysql -uroot -p


  6. I have install like this guide for a few weeks ago and everything is working but wordpress say i run on an old php version of PHP (7.3.22-1+0~20200909.67+debian10~1.gbpdd7b72) and i have installed a new version (7.4.10) and my raspberry pi says it is installed but wordpress still say i have the old installed and i don´t know how i will get wordpress to take the new version!
    I have try på restart raspberry, apache2 and mariadb but no change! What do ido wrong?

    1. Hi,
      Maybe if you still have both versions, you need to tell Apache which one to use
      Something like:

      sudo a2dismod php7.3
      sudo a2enmod php7.4

      Or uninstall PHP 7.3 if you don’t need it anymore

  7. It´s works!
    Now i have some other questions…
    1) How to uninstall the php7.3 installations?
    2) Now my wordpress alarming on missing php modules:
    curl, mbstring, imagick, zip and gd is not installed or disactivated.
    How can i installed them?

    1. 1/ “sudo apt remove php7.3 php7.3-common” should do the job
      2/ if you added a repository for php7.4, you can install them with “sudo apt install php7.4-curl php7.4-zip etc.”.
      If no repository, I recommended adding one, for example:

      1. It works, now i have only php7.4 installed and all the modules are installed and running and wordpress don´t alarming anymore…
        Thanx for quick and easy explained for a newbie on this!
        The most guides here on internet are for thoose how already knows how the terminal is working and knows all commands.
        Thanx again for doing this easy!

  8. how can one change the index of the website… every time i do it it ether errors out or removes all the graphics on the wordpress website

Leave a Reply

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

Recent Posts

Master your Raspberry Pi - 10% off