Installing Drupal on OpenBSD

Provides instruction of how to install Drupal CMS, version 8, on OpenBSD 6.4 using Postgresql and Nginx.

This guide provides instruction of how to install Drupal CMS, version 8, on OpenBSD 6.4 using Postgresql and Nginx. There are additional steps you should look into such as permissions for your Drupal installation.


  1. Install required packages. Take your choice of PHP version, however I have tested only with php-7.0.32p1. In step number 6 and 7 adjust the file path accordingly based on the PHP version you choose.
pkg_add libxml php xz php-gd png jpeg gettext libiconv postgresql-server php-pgsql php-pdo_pgsql nginx
  1. These packages are only needed during installation and initial setup of additional plugins and/or themes. They can be later removed.
pkg_add wget unzip
  1. Setup the database and create a drupal user.
# su - _postgresql
$ mkdir -p /var/postgresql/data
$ initdb -D /var/postgresql/data -U postgres -A scram-sha-256 -E UTF8 -W
$ exit
# rcctl -f start postgresql
# createuser -U postgres --pwprompt --no-superuser --createdb --no-createrole drupal
# createdb -U drupal -E UTF8 drupal
  1. For the nginx config you can refer to Nginx config generator to generate a config. A helpful reference is also the Drupal recipe on the nginx website.
vi /etc/nginx/nginx.conf
  1. Enable the services to start on boot
rcctl enable nginx php70_fpm postgresql
  1. Edit /etc/php-7.0.ini and add the following line under the “Dynamic Extensions” section:
extension=pgsql.so
extension=pdo_pgsql.so
extension=gd.so
extension=opcache.so
  1. Then change the timezone as well if desired in /etc/php-7.0.ini
date.timezone = Canada/Central
  1. Download latest Drupal
wget https://www.drupal.org/download-latest/zip
  1. Unzip or expand the Drupal zip we just downloaded
unzip zip
  1. Delete the left over zip file
rm zip
  1. Copy the Drupal folder to the htdocs folder and also rename it to just Drupal
cp -R drupal-8.6.9/ /var/www/htdocs/
mv /var/www/htdocs/drupal-8.6.9/ /var/www/htdocs/drupal
  1. Set the ownership of the Drupal files to the web server user
chown -R www:www /var/www/htdocs/drupal
  1. Start the nginx and php services
rcctl start nginx php70_fpm postgresql

At this point you can access http://server name or http://server IP and complete the installation.

updatedupdated2023-11-212023-11-21
Load Comments?