common.topBar.messagecommon.topBar.ctatop-bar-close-icon
articleSlug.creditBanner.imgAltarticleSlug.creditBanner.cta

The Ultimate Guide to Installing Grocy on Ubuntu Server 22.04

tutorials
The Ultimate Guide to Installing Grocy on Ubuntu Server 22.04

Are you tired of losing track of your groceries or household items? Looking for a self-hosted solution to manage your home inventory? Look no further! In this comprehensive guide, we'll walk you through the process of installing Grocy, an open-source home management solution, on Ubuntu Server 22.04 using CloudBlast's powerful VPS hosting.

What is Grocy and Why Should You Care?

Grocy is a web-based, self-hosted powerhouse for managing your home. From tracking groceries to monitoring household tasks, Grocy brings organization to your fingertips. By hosting it on your own Ubuntu server, you maintain complete control over your data while enjoying the benefits of a robust management system.

Prerequisites: Setting the Stage for Success

Before we dive in, ensure your CloudBlast VPS is equipped with:

- Ubuntu Server 22.04 LTS
- Root access or a user with sudo privileges
- A basic understanding of command-line operations

Step-by-Step Installation Guide

1. Update Your System: Fresh Start, Best Start

Begin by updating your system packages:


sudo apt update && sudo apt upgrade -y
 

2. Install the LAMP Stack: Your Grocy Foundation

Grocy thrives on a LAMP (Linux, Apache, MySQL, PHP) environment. Let's set it up:

Install Apache:

sudo apt install apache2 -y
 

Install MySQL:

sudo apt install mysql-server -y
 

Install PHP and Required Extensions:

sudo apt install php libapache2-mod-php php-mysql php-gd php-curl php-mbstring php-xml php-zip -y
 

3. Secure Your MySQL Installation

Run the MySQL secure installation script:

sudo mysql_secure_installation

Follow the prompts to set a root password and secure your MySQL installation.

4. Create a Database for Grocy

Log into MySQL:

sudo mysql -u root -p
 

Create a database and user for Grocy:

CREATE DATABASE grocydb;
CREATE USER 'grocyuser'@'localhost' IDENTIFIED BY 'your_secure_password';
GRANT ALL PRIVILEGES ON grocydb.* TO 'grocyuser'@'localhost';
FLUSH PRIVILEGES;
EXIT;
 

5. Install Grocy: The Main Event

Download and extract the latest Grocy release:

cd /var/www
sudo wget https://releases.grocy.info/latest -O grocy-latest.zip
sudo unzip grocy-latest.zip
sudo mv grocy-* grocy
 

Set proper permissions:

sudo chown -R www-data:www-data /var/www/grocy
 

6. Configure Grocy: Tailoring to Your Needs

Copy the sample configuration:

sudo cp /var/www/grocy/config-dist.php /var/www/grocy/data/config.php
 

Edit the configuration file:

sudo nano /var/www/grocy/data/config.php
 

Update the database settings:

'DB_DATABASE' => 'grocydb',
'DB_USER' => 'grocyuser',
'DB_PASSWORD' => 'your_secure_password',
 

7. Set Up Apache Virtual Host: Your Grocy Gateway

Create a new Apache configuration file:

sudo nano /etc/apache2/sites-available/grocy.conf
 

Add the following content:

<VirtualHost *:80>
    ServerName yourdomain.com
    DocumentRoot /var/www/grocy/public

    <Directory /var/www/grocy/public>
        Options Indexes FollowSymLinks
        AllowOverride All
        Require all granted
    </Directory>

    ErrorLog ${APACHE_LOG_DIR}/grocy_error.log
    CustomLog ${APACHE_LOG_DIR}/grocy_access.log combined
</VirtualHost>
 

Enable the new site and restart Apache:

sudo a2ensite grocy.conf
sudo systemctl restart apache2
 

Accessing Your Grocy Installation

You've done it! Access your new Grocy installation by navigating to `http://yourdomain.com` in your web browser. If you're using CloudBlast's VPS without a domain, use your server's IP address instead.

Conclusion: Embrace the Power of Home Management

Congratulations! You've successfully installed Grocy on your Ubuntu Server 22.04 hosted on CloudBlast's VPS. You're now equipped with a powerful tool to streamline your home management tasks.

Remember, this is just the beginning. Explore Grocy's features, customize it to your needs, and take control of your home inventory like never before.

Need help optimizing your Grocy installation or looking for more self-hosted solutions? CloudBlast's support team is always here to help you make the most of your VPS hosting experience.

Happy organizing!