How to install Grocy on OpenBSD

Grocy is an open-source, self-hosted solution for managing your groceries and household tasks. Here's how to install Grocy on OpenBSD.

Step 1: Install PHP and PHP-FPM

Grocy is built with PHP, so you'll need to install PHP and PHP-FPM to run it on OpenBSD. You can do this using the pkg_add command:

sudo pkg_add php php-fpm

Step 2: Install the required PHP extensions

Grocy requires a number of PHP extensions to function properly. You can install them with the following command:

sudo pkg_add php-pdo_mysql php-dom php-gd php-mbstring php-zip php-curl php-json php-session php-gettext

Step 3: Install MariaDB

Grocy requires a database to store your data, and MariaDB is a great option. You can install it with the following command:

sudo pkg_add mariadb-server

Step 4: Configure MariaDB

Now you'll need to configure MariaDB. Start by creating a new database and user for Grocy:

sudo mysql -u root -p
> CREATE DATABASE grocy;
> CREATE USER 'grocy'@'localhost' IDENTIFIED BY 'password';
> GRANT ALL PRIVILEGES ON grocy.* TO 'grocy'@'localhost';
> FLUSH PRIVILEGES;
> EXIT;

Replace password with a secure password of your choosing.

Step 5: Download and extract Grocy

Download the latest version of Grocy from the website. Once it's downloaded, extract it to a directory of your choosing:

sudo tar xvf grocy-x.x.x.tar.gz -C /var/www/

Replace x.x.x with the version number you downloaded.

Step 6: Configure PHP-FPM

OpenBSD uses pfctl to manage network traffic, so you'll need to adjust the default settings for PHP-FPM. Add the following lines to your PHP-FPM configuration file:

sudo nano /etc/php-fpm.conf
security.limit_extensions = .php
listen = /var/www/run/php-fpm.sock
listen.owner = www
listen.group = www
listen.mode = 0660

Step 7: Start the services

Start the MariaDB and PHP-FPM services:

sudo rcctl enable mysqld
sudo rcctl set mysqld flags -u _mysql
sudo rcctl start mysqld
sudo rcctl enable php_fpm
sudo rcctl start php_fpm

Step 8: Configure Grocy

Finally, navigate to http://localhost/setup in your web browser to configure Grocy. Follow the instructions to set up your database connection and create your admin account.

That's it! You should now have a working installation of Grocy on OpenBSD.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!