Install WordPress on OpenBSD 6.2


WordPress is the dominant content management system on the internet. It powers everything from blogs to complex websites with dynamic content. This tutorial will discuss getting WordPress up and running on OpenBSD 6.2.

Before we begin, there are some small housekeeping items that need to be taken care of in order for WordPress to function correctly. Please do not skip these steps, because if you do, you will get some very generic errors that are next to impossible to decipher. Remember that OpenBSD’s internal httpd server runs in a chroot environment and these housekeeping steps account for this.


Create the directory /var/www/etc and keep the default permissions.

Create a new file called hosts and add the following entries. This will allow WordPress to download updates, themes, and plugins.       localhost66.155.40.202 api.wordpress.org66.155.40.186 downloads.wordpress.org66.155.40.187 downloads.wordpress.org66.155.40.188

Install some prerequisite packages.

pkg_install php-5.6 php-fastcgi php-curl php-mysql php-zip mariadb-server mariadb-clientpkg_install wget unzip 

Copy the sample ini files from /etc/php-5.6.sample to /etc/php-5.6/.

Create an /etc/httpd.conf file similar to the one below. You can optionally replace the server name "default" with the actual name in DNS, but that is not strictly necessary.

types { include "/usr/share/misc/mime.types" }server "default" {    listen on egress port 80    root "/wordpress"    directory index index.php    location "*.php*" {            fastcgi socket "/run/php-fpm.sock"    }}

Now it is time to enable the necessary daemons so they launch at system startup.

rcctl enable php56_fpm rcctl enable httpdrcctl enable mysqld


Download WordPress, then move it into /var/www and set the correct permissions.

cd /tmpwget latest.zipmv wordpress /var/www/.chown -R www:www /var/www/wordpress/

Setup MariaDB to provide the database for WordPress. Running mysql_secure_installation is recommended because it can remove anonymous users and the test database. Furthermore, a root password for MariaDB is set.

mysql_install_dbrcctl start mysqldmysql_secure_installation

Create the WordPress database. Make certain to replace Password with the password that you intend to use.

mysql -u root -p <password goes here>CREATE DATABASE wordpress;CREATE USER 'wordpress'@'localhost' identified by 'Password';GRANT ALL PRIVILEGES ON wordpress.* TO 'wordpress'@'localhost' IDENTIFIED BY 'Password'; FLUSH PRIVILEGES;EXIT;

Now that you have created the WordPress database, it is time to start the web server and the fastcgi daemon.

rcctl start httpdrcctl start php56_fpm

From here, open up a web browser and browse to your website, e.g. You will see the WordPress Installation Wizard. On the next screen, you will be prompted for the database name, database username, database password, server, and the table prefix.

The database name defaults to “wordpress“. Make certain to set the database user to “wordpress” and use the same password as when you created the database previously. Finally, change the server to and leave the table prefix as-is.

The wizard should properly populate the database and then prompt you to create an “admin” user. Once this is completed, you are ready to download themes and plugins and begin your website design. On a closing note, be sure to keep an eye on new versions and keep your WordPress install up to date. The further you get away from the current version, the harder upgrades tend to be.

Want to contribute?

You could earn up to $300 by adding new articles

Submit your article
Suggest an update
Request an article

No comments

Powered by Blogger.