How to Install Grocy on Void Linux

Grocy is a self-hosted web-based application that helps you manage your household and grocery-related tasks, including inventory tracking and meal planning. This tutorial will guide you through the process of installing Grocy on Void Linux.

Prerequisites

Before we begin, make sure that you have the following prerequisites:

Installation

To install Grocy on Void Linux, we will use the xbps-install command, which is the default package manager for Void Linux.

  1. Open a terminal window and update the package list by running the following command:

    sudo xbps-install -S
    
  2. Install the required dependencies for Grocy. Run the following command:

    sudo xbps-install nginx mariadb mariadb-client mariadb-libs php php-fpm php-mysqli php-pdo_mysql php-json php-gd php-zip php-curl php-mbstring
    
  3. Download the latest version of Grocy from the grocy.info/">official website or run the following command:

    wget https://releases.grocy.info/latest -O grocy-latest.zip
    
  4. Extract the downloaded file by running the following command:

    unzip grocy-latest.zip
    
  5. Move the extracted folder to the Nginx web directory:

    sudo mv grocy/* /var/www/localhost/htdocs/
    
  6. Create a new configuration file for Nginx by running the following command:

    sudo nano /etc/nginx/conf.d/grocy.conf
    

    Paste the following configuration code and save the file:

    server {
        listen          80 default_server;
        listen          [::]:80 default_server;
        server_name     your-domain.com;
        root            /var/www/localhost/htdocs;
        index           index.php index.html;
        location / {
            try_files $uri $uri/ /index.php?$args;
        }
        location ~ \.php$ {
            fastcgi_pass unix:/run/php-fpm.sock;
            fastcgi_index index.php;
            fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
            include fastcgi_params;
        }
    }
    

    Replace your-domain.com with your actual domain name.

  7. Start and enable Nginx and PHP-FPM services by running the following commands:

    sudo rc-update add nginx default
    sudo rc-update add php-fpm default
    sudo service nginx start
    sudo service php-fpm start
    
  8. Create a new MySQL database for Grocy by running the following commands:

    sudo mysql -u root -p
    CREATE DATABASE grocy;
    CREATE USER 'grocyuser'@'localhost' IDENTIFIED BY 'password';
    GRANT ALL PRIVILEGES ON grocy.* TO 'grocyuser'@'localhost';
    FLUSH PRIVILEGES;
    EXIT;
    
  9. Navigate to the Grocy installation directory and create a new configuration file by running the following command:

    cd /var/www/localhost/htdocs
    cp config-dist.php config.php
    sudo nano config.php
    

    Edit the configuration file to specify your MySQL database credentials:

    $DB_NAME = 'grocy';
    $DB_USER = 'grocyuser';
    $DB_PASSWORD = 'password';
    
  10. Access your Grocy instance by opening a web browser and navigating to http://your-domain.com. You will be prompted to create an admin user and customize your Grocy settings.

Congratulations! You have successfully installed Grocy on Void Linux!

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!