How to Install Grocy on Ubuntu 24.04 Grocy is an open-source household management application that helps you track your pantry, manage shopping lists, plan meals, and organize household tasks. Running Grocy on your own server ensures full control over your data, unlike cloud-based alternatives. This self-hosted solution is perfect for anyone looking to reduce food waste, maintain privacy, and keep their household organized. The following guide walks you through installing Grocy on Ubuntu 24.04. Prerequisites Before you start, ensure you have: Ubuntu 24.04 installed SSH access to your server Basic command-line knowledge Step 1: Update System Packages Update your package lists and upgrade installed packages: sudo apt update sudo apt upgrade -y Step 2: Install Required Dependencies Grocy requires Nginx, PHP, PostgreSQL, and other utilities: sudo apt install -y nginx php8.3-fpm php8.3-cli php8.3-curl php8.3-gd \ php8.3-intl php8.3-mbstring php8.3-pgsql php8.3-sqlite3 php8.3-xml \ php8.3-zip php-common wget tar unzip postgresql postgresql-contrib \ python3-psycopg2 Step 3: Set Up PostgreSQL Database Create a PostgreSQL user and database for Grocy: sudo -u postgres psql -c "CREATE USER grocy WITH PASSWORD 'GrocyDefaultPass123!';" sudo -u postgres psql -c "CREATE DATABASE grocydb OWNER grocy ENCODING 'UTF8';" Step 4: Download and Install Grocy Download the latest release and extract it to /var/www/grocy: sudo mkdir -p /var/www/grocy sudo wget https://releases.grocy.info/latest -O /tmp/grocy_latest.zip sudo unzip /tmp/grocy_latest.zip -d /var/www/grocy Step 5: Configure Grocy Copy the sample configuration file: sudo cp /var/www/grocy/config-dist.php /var/www/grocy/data/config.php Edit the configuration to add your database details: sudo nano /var/www/grocy/data/config.php Update the database section: 'database' => [ 'database' => 'grocydb', 'username' => 'grocy', 'password' => 'GrocyDefaultPass123!', 'hostname' => 'localhost', 'adapter' => 'pgsql' ], Save and exit the editor. Step 6: Set File Permissions Ensure proper ownership and permissions: sudo chown -R www-data:www-data /var/www/grocy sudo chmod -R 755 /var/www/grocy/data Step 7: Configure Nginx Create a new Nginx site configuration: sudo nano /etc/nginx/sites-available/grocy Add the following: server { listen 80; server_name your_server_ip; root /var/www/grocy/public; index index.php index.html index.htm; location / { try_files $uri $uri/ /index.php$is_args$args; } location ~ \.php$ { try_files $uri =404; fastcgi_pass unix:/var/run/php/php8.3-fpm.sock; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name; include fastcgi_params; } } Enable the site and restart Nginx: sudo ln -s /etc/nginx/sites-available/grocy /etc/nginx/sites-enabled/ sudo rm /etc/nginx/sites-enabled/default sudo nginx -t sudo systemctl restart nginx Step 8: Restart Services Restart PHP-FPM and PostgreSQL to apply all changes: sudo systemctl restart php8.3-fpm sudo systemctl restart postgresql Step 9: Access Grocy Open your web browser and navigate to your server’s IP address: http://your_server_ip You should now see the Grocy dashboard ready for setup and use.