How to Install Grocy on OpenSUSE Latest

Grocy is a self-hosted web application that lets you track your groceries, household items, and more. It is a perfect solution for anyone who wants to organize their shopping and household management. In this tutorial, we will show you how to install Grocy on OpenSUSE Latest.

Prerequisites

Before we get started, make sure you have the following prerequisites installed on your OpenSUSE machine:

Step 1 - Download the Grocy Package

First, you need to download the Grocy package to your OpenSUSE machine. You can download it from the Grocy website grocy.info/#download">here.

wget https://releases.grocy.info/latest

Step 2 - Install Required Dependencies

Next, you need to install some required dependencies for Grocy to work properly. Run the following command to install the required dependencies:

sudo zypper install apache2 mysql-server php7 php7-mysqlnd php7-gd php7-json php7-mbstring php7-session php7-zip

Step 3 - Configure Apache and PHP

After installing the required dependencies, you need to configure Apache and PHP settings for Grocy. Edit the apache2 configuration file /etc/apache2/httpd.conf and add the following lines at the end of the file:

<Directory "/srv/www/htdocs">
    Options Indexes FollowSymLinks
    AllowOverride All
    Require all granted
</Directory>

Next, edit the PHP configuration file /etc/php7/apache2/php.ini and make changes to the following settings:

upload_max_filesize = 100M
post_max_size = 100M
max_execution_time = 360

Step 4 - Create the Database

Next, you need to create a database for Grocy. Run the following command to log in to the MySQL server:

mysql -u root -p

Then, create a new database called grocy:

CREATE DATABASE grocy;

Create a new user grocyuser with full privileges to the grocy database:

GRANT ALL PRIVILEGES ON grocy.* TO 'grocyuser'@'localhost' IDENTIFIED BY 'password';

Replace password with a secure password that you choose.

Step 5 - Install Grocy

Now, you can install Grocy by unzipping the downloaded package to the /srv/www/htdocs directory:

sudo unzip latest -d /srv/www/htdocs/grocy

Change the ownership of the grocy directory to Apache user:

sudo chown -R wwwrun:www /srv/www/htdocs/grocy

Step 6 - Configure Grocy

Next, create a new file config.php in the /srv/www/htdocs/grocy/data directory:

sudo nano /srv/www/htdocs/grocy/data/config.php

Add the following lines to the file:

<?php
define('GROCY_DATAPATH', '/srv/www/htdocs/grocy/data/');
define('GROCY_LOCALE', 'en_GB'); // Change to your locale
define('GROCY_TZ', 'Europe/London'); // Change to your timezone
define('GROCY_PRODUCT_ENDPOINT', 'https://barcodesdatabase.org/');
define('GROCY_GETTEXT_LOCALE_PATH', '/usr/share/locale');
define('GROCY_MAIL_FROM', 'grocy@example.com');
define('GROCY_MAIL_TRANSPORT', 'sendmail'); // Change to yours
define('GROCY_MAIL_TRANSPORT_OPTIONS', '');
define('GROCY_MAIL_SMTP_HOST', '');
define('GROCY_MAIL_SMTP_PORT', '');
define('GROCY_MAIL_SMTP_ENCRYPTION', '');
define('GROCY_MAIL_SMTP_USERNAME', '');
define('GROCY_MAIL_SMTP_PASSWORD', '');
define('GROCY_MAINDOMAIN', ''); // Change to your URL
define('GROCY_REGISTERSTOCKDAILYROUTINECRONEXPR', '0 3 * * *');
define('GROCY_STOCK_BESTBEFORE_WARNING_DAYS', '2');
define('GROCY_FEATURE_FLAG_STOCK_PRODUCT_OPENED_TRACKING', false);
?>

Make sure to replace the values on GROCY_LOCALE, GROCY_TZ, GROCY_MAIL_FROM, GROCY_MAINDOMAIN, GROCY_REGISTERSTOCKDAILYROUTINECRONEXPR, and GROCY_STOCK_BESTBEFORE_WARNING_DAYS to fit your needs.

Save and close the file.

Step 7 - Access Grocy

Finally, you can access Grocy by opening your web browser and navigating to http://your-server-IP-address/grocy.

You will be prompted to set a password for the admin user. After setting the password, you can start using Grocy to manage your groceries, household items, and more.

Congratulations! You have successfully installed and configured Grocy on OpenSUSE Latest.

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!