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:
- Void Linux installed on your system
- Basic knowledge of the command line interface
- Access to the internet
Installation
To install Grocy on Void Linux, we will use the xbps-install command, which is the default package manager for Void Linux.
Open a terminal window and update the package list by running the following command:
sudo xbps-install -SInstall 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-mbstringDownload the latest version of Grocy from the official website or run the following command:
wget https://releases.grocy.info/latest -O grocy-latest.zipExtract the downloaded file by running the following command:
unzip grocy-latest.zipMove the extracted folder to the Nginx web directory:
sudo mv grocy/* /var/www/localhost/htdocs/Create a new configuration file for Nginx by running the following command:
sudo nano /etc/nginx/conf.d/grocy.confPaste 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.comwith your actual domain name.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 startCreate 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;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.phpEdit the configuration file to specify your MySQL database credentials:
$DB_NAME = 'grocy'; $DB_USER = 'grocyuser'; $DB_PASSWORD = 'password';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!