Grocy is a self-hosted web-based application that allows you to manage your groceries, recipes, inventory, and more. In this tutorial, we will guide you on how to install Grocy on NetBSD.
Before installing Grocy, you need to ensure that your NetBSD system meets the following requirements:
Update the system package repository by running the following command:
sudo pkgin update
Then, proceed to install the required packages for Grocy by running the following command:
sudo pkgin install php74-apache php74-pdo_mysql php74-json php74-curl php74-mbstring php74-mysql php74-simplexml composer unzip
Create a directory where you want to install Grocy. For example:
sudo mkdir /var/www/grocy
Change to the newly created directory.
cd /var/www/grocy
Download the latest version of Grocy from the official website by running the following command:
sudo wget https://releases.grocy.info/latest
Extract the downloaded archive by running the following command:
sudo unzip latest -d /var/www/grocy
Change the owner of the Grocy directory to the web server user.
sudo chown -R www:www /var/www/grocy
Log in to your MySQL/MariaDB server using the following command:
mysql -u root -p
Create a new database for Grocy by running the following command:
CREATE DATABASE grocy;
Create a new user for Grocy and grant all privileges to the grocy database. Replace grocyuser
and password
with your desired username and password.
CREATE USER 'grocyuser'@'localhost' IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON grocy.* TO 'grocyuser'@'localhost';
FLUSH PRIVILEGES;
Exit the MySQL/MariaDB console by running the following command:
exit
Copy the example configuration file to a new file.
sudo cp /var/www/grocy/config-dist.php /var/www/grocy/data/config.php
Open the newly created config.php
file using a text editor.
sudo nano /var/www/grocy/data/config.php
Modify the following lines to reflect your MySQL/MariaDB configuration:
define('GROCY_DB_HOST', 'localhost');
define('GROCY_DB_NAME', 'grocy');
define('GROCY_DB_USERNAME', 'grocyuser');
define('GROCY_DB_PASSWORD', 'password');
Save and close the file.
Change to the Grocy directory.
cd /var/www/grocy
Install the required dependencies by running the following command:
sudo composer install --no-dev
You should see some output in the terminal. Wait for the process to complete.
Open the Apache configuration file using a text editor.
sudo nano /usr/pkg/etc/httpd/httpd.conf
Find the following lines and uncomment them by removing the #
character:
LoadModule deflate_module lib/httpd/mod_deflate.so
LoadModule rewrite_module lib/httpd/mod_rewrite.so
LoadModule php7_module lib/php/20200930/php7apache2_4.so
Scroll down to the end of the file and add the following lines:
<Directory "/var/www/grocy">
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
Save and close the file.
Restart the Apache server using the following command:
sudo /etc/rc.d/apache restart
Open your web browser and navigate to the following URL:
http://localhost/grocy
You should see the Grocy login screen. Use the default username admin
and password admin
to log in.
Congratulations! You have successfully installed Grocy on NetBSD. You can now start using Grocy to manage your groceries, recipes, inventory, and more.
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!