How to Install Grocy on Kali Linux

Grocy is a free and open-source web-based self-hosted grocery and household management solution. This guide will help you install Grocy on Kali Linux.

Prerequisites

Before you begin the installation, make sure you have the following:

Install MariaDB/MySQL

  1. Install MariaDB or MySQL by running the following command:
sudo apt-get update
sudo apt-get install mariadb-server mariadb-client -y
  1. Once the installation is complete, start the MariaDB/MySQL server and enable it to start on system boot:
sudo systemctl start mariadb
sudo systemctl enable mariadb

Create MariaDB/MySQL Database and User

  1. Log in to MariaDB/MySQL as the root user:
sudo mysql -u root
  1. Create a new database using the following command:
CREATE DATABASE grocy;
  1. Create a new database user and grant privileges to the database using the following command:
GRANT ALL ON grocy.* to 'grocyuser'@'localhost' IDENTIFIED BY 'password';

Note: Replace password with your desired password.

  1. Flush the privileges and exit MariaDB/MySQL:
FLUSH PRIVILEGES;
exit;

Install Grocy

  1. Download the latest version of Grocy from the official Github repository:
wget https://github.com/grocy/grocy/releases/download/v3.2.4/grocy_3.2.4.zip

Note: Replace v3.2.4 with the latest version.

  1. Unzip the downloaded file and move it to the web root directory:
unzip grocy_3.2.4.zip -d /var/www/html/
cd /var/www/html/grocy
  1. Use curl to download dependencies:
sudo apt install curl
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
sudo apt install php-gd php-curl php-mbstring php-mysql php-xml
  1. Install the necessary dependencies for Grocy by running the following command:
sudo composer install --no-dev
  1. Copy the configuration file and open it using your favourite text editor:
cp config-dist.php config.php
nano config.php
  1. Find the line that says define('GROCY_DATABASE_NAME', 'your_database_name'); and replace your_database_name with the database name you created earlier.

  2. Find the line that says define('GROCY_DATABASE_USER', 'your_database_username'); and replace your_database_name with the username you created earlier.

  3. Find the line that says define('GROCY_DATABASE_PASSWORD', 'your_database_password'); and replace your_database_password with the password you created earlier.

  4. Save and exit the configuration file.

Configure the Web Server

  1. Configure the web server. Here is an example for Apache:
sudo a2enmod rewrite
sudo nano /etc/apache2/sites-available/grocy.conf
  1. Add the following lines to the configuration file:
<VirtualHost *:80>
    ServerAdmin admin@yourdomain.com
    ServerName yourdomain.com
    ServerAlias www.yourdomain.com
   
    DocumentRoot /var/www/html/grocy
    <Directory /var/www/html/grocy>
        Options FollowSymLinks
        AllowOverride All
        Order allow,deny
        allow from all
    </Directory>
   
    ErrorLog ${APACHE_LOG_DIR}/grocy_error.log
    CustomLog ${APACHE_LOG_DIR}/grocy_access.log combined
</VirtualHost>

Note: Replace yourdomain.com with your domain name.

  1. Enable the site:
sudo a2ensite grocy.conf
  1. Reload the Apache web server:
sudo systemctl reload apache2

Access Grocy

  1. Open your web browser and go to your domain name or IP address:
http://yourdomain.com/
  1. Fill in the required information and complete the setup.

Congratulations! You have successfully installed Grocy on Kali 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!