WordPress on My Laptop Computer

wordpress laptop computerDays before I finally decided to reboot my website, I installed the WordPress content management system on my laptop computer. I run Linux Mint on this computer, by the way. Some people believe in segregating their various development environments, but I’m not one of them. I never use even half of the memory I have installed. I’m pretty sure I wouldn’t have issues with any computer with four or more gigabytes of memory. My online activities are very limited.

Since Internet connectivity isn’t always reliable, especially here in the Philippines, I’ve always preferred doing as much of my writing as possible offline. Mimicking the way I do it online is the easiest way. It’s also a great way to have individual articles backed up without having to deal with the database.

Why WordPress?

Although I don’t like a lot of the changes to the WordPress software that have occurred over the years, I can’t complain. It doesn’t cost me anything to use it. I’ve wasted a lot of my time examining alternatives, and I can’t find anything better. Besides, all the alternatives require me to become familiar with them, and I’m already familiar with WordPress.

WordPress can be a beast. Even though it’s used on more websites than any other content management system, it’s a bit too much for personal websites like mine. In my case, less is more, so I use as few plugins as I can and a theme that doesn’t try to do everything.

Setting Up

It doesn’t matter what some people think are the best server applications. I use what I’m familiar with. That means Nginx instead of Apache, MariaDB instead of MySQL and PHP instead of something else. The user and group names for Nginx and PHP on Debian-based distributions are assigned as “www-data”. I prefer using my own username.

These instructions are mainly for me because it’s easy to forget the details. If you wish, you can follow along as I describe the steps I took to set everything up. The first step is always:

sudo apt update && sudo apt upgrade

Nginx Web Server

This installed the web server and created the service that automatically starts it when booting or rebooting:

sudo apt install nginx

At the top of the Nginx configuration file at /etc/nginx/nginx.conf, I changed the user from “www-data” to my username.

I’m only using port 80 and plain HTTP on my laptop computer, so I changed the default configuration file for sites available at /etc/nginx/sites-available/default to read as follows:

server {
    listen 80 default_server;
    root /home/username/wordpress;
    index index.php;
    server_name _;
    location / {
        try_files $uri $uri/ /index.php?$args;
    location ~ \.php$ {
        include snippets/fastcgi-php.conf;
        fastcgi_pass unix:/var/run/php/php8.1-fpm.sock;

This isn’t something I would use online, of course. It’s just the bare minimum to run it locally.

MariaDB Database Server

This installed the database server, which is a drop-in replacement for MySQL, and created the service that automatically starts it when booting or rebooting:

sudo apt install mariadb-server

Although I didn’t need the next step since this isn’t online, it’s something I always do when setting up online:

sudo mysql_secure_installation

Regardless of where, I never assign a root password because I never use the root user for anything.

The MySQL prompt was still available, so I didn’t have to do this:

sudo mysql

I had to create a user for the database, grant all the privileges and then create the database. None of these words had to be in all caps. It just makes it easier to read. Of course I changed “wordpressuser” and “password”:

CREATE USER 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
SELECT User, Host, Password FROM mysql.user;
GRANT ALL PRIVILEGES ON *.* TO 'wordpressuser'@'localhost' IDENTIFIED BY 'password';
SHOW GRANTS FOR 'wordpressuser'@'localhost';


This installed the PHP 8.1 fast process manager, the command line interface and a bunch of modules. It also created the service that automatically starts it when booting or rebooting:

sudo apt install php8.1-fpm php8.1-imagick php8.1-bcmath php8.1-bz2 php8.1-curl php8.1-dev php8.1-gd php8.1-intl php8.1-mbstring php8.1-mysql php8.1-sqlite3 php8.1-tidy php8.1-xml php8.1-xmlrpc php8.1-zip

I edited /etc/php/8.1/fpm/php.ini and changed two lines:

post_max_size = 20M
upload_max_filesize = 20M

Searching for those lines is much faster than browsing line-by-line.

Next, I edited /etc/php/8.1/fpm/pool.d/www.conf and changed the four occurrences of “www-data” to my username.

user = username
group = username
listen.owner = username
listen.group = username


In the terminal and within my home directory, I executed these commands:

wget https://wordpress.org/latest.zip
unzip latest.zip

Once I was sure I had the “wordpress” directory in the right place, I deleted the zip file. Before installing WordPress, I restarted all three services:

sudo systemctl reload nginx
sudo systemctl reload mariadb
sudo systemctl reload php8.1-fpm

The WordPress Installation Wizard

While it’s not necessary to do it this way, it’s the easiest way. The alternative is to copy the wp-config-sample.php file to the wp-config.php file and edit it manually. I just type “localhost” in the web browser and let the wizard do the rest.

Since my laptop computer has 16 gigabytes of memory, I can leave the services running without affecting anything.

Image by Werner Moser from Pixabay

Leave a Comment