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:
- Kali Linux installed with root privileges
- A web server such as Apache or Nginx
- PHP 7.2 or higher installed on the server
- MariaDB or MySQL installed on the server
Install MariaDB/MySQL
- Install MariaDB or MySQL by running the following command:
sudo apt-get update
sudo apt-get install mariadb-server mariadb-client -y
- 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
- Log in to MariaDB/MySQL as the root user:
sudo mysql -u root
- Create a new database using the following command:
CREATE DATABASE grocy;
- 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.
- Flush the privileges and exit MariaDB/MySQL:
FLUSH PRIVILEGES;
exit;
Install Grocy
- 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.
- 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
- Use
curlto 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
- Install the necessary dependencies for Grocy by running the following command:
sudo composer install --no-dev
- Copy the configuration file and open it using your favourite text editor:
cp config-dist.php config.php
nano config.php
Find the line that says
define('GROCY_DATABASE_NAME', 'your_database_name');and replaceyour_database_namewith the database name you created earlier.Find the line that says
define('GROCY_DATABASE_USER', 'your_database_username');and replaceyour_database_namewith the username you created earlier.Find the line that says
define('GROCY_DATABASE_PASSWORD', 'your_database_password');and replaceyour_database_passwordwith the password you created earlier.Save and exit the configuration file.
Configure the Web Server
- Configure the web server. Here is an example for Apache:
sudo a2enmod rewrite
sudo nano /etc/apache2/sites-available/grocy.conf
- Add the following lines to the configuration file:
<VirtualHost *:80>
ServerAdmin [email protected]
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.
- Enable the site:
sudo a2ensite grocy.conf
- Reload the Apache web server:
sudo systemctl reload apache2
Access Grocy
- Open your web browser and go to your domain name or IP address:
http://yourdomain.com/
- Fill in the required information and complete the setup.
Congratulations! You have successfully installed Grocy on Kali Linux.