How to Install Open Food Network on Ubuntu Server


Open Food Network is a free and open-source e-commerce platform designed to connect farmers, local producers, and communities. It allows farmers and local food producers to sell their products to consumers directly. In this tutorial, we will show you how to install Open Food Network on Ubuntu 20.04 server.


Before starting with the installation process, make sure that you have the following prerequisites:

Step 1 - Update Ubuntu Server

The first step is to update and upgrade your Ubuntu server. Connect to your server via SSH and run the following command:

sudo apt update
sudo apt upgrade

Step 2 - Install Required Dependencies

Open Food Network requires some dependencies to be installed on your server. You can install them using the following command:

sudo apt install -y build-essential postgresql postgresql-contrib libpq-dev nodejs npm redis imagemagick libxml2-dev libxslt1-dev libv8-dev libjemalloc-dev libffi-dev libgmp-dev libssl-dev libncurses-dev libreadline-dev libyaml-dev libsqlite3-dev

This command will install all the necessary dependencies on your server.

Step 3 - Install Ruby

Open Food Network is built with Ruby programming language. The next step is to install Ruby on your server. You can use the rbenv tool to install Ruby. Run the following commands to install rbenv.

sudo apt-get update
sudo apt-get install -y git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev software-properties-common libffi-dev libgmp-dev libncurses-dev libjemalloc-dev libssl-dev libreadline-dev libyaml-dev

Next, install rbenv and add it to your bash profile:

curl -fsSL | bash

echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc

source ~/.bashrc

Now, install the latest version of Ruby by running the following command:

rbenv install 2.7.3
rbenv global 2.7.3

Step 4 - Install Open Food Network

Before installing Open Food Network, you need to create a new PostgreSQL database and user. Run the following commands to create a new database and user:

sudo -i -u postgres
createdb openfoodnetwork

psql -c "CREATE USER ofn WITH PASSWORD 'ofn';"
psql -c "GRANT ALL PRIVILEGES ON DATABASE openfoodnetwork TO ofn;"

To install Open Food Network, clone the application repository from Github:

git clone
cd openfoodnetwork
git checkout v2.4.x

Next, install bundler and all the required dependencies:

gem install bundler
bundle install

After installing the dependencies, run the following command to setup Open Food Network:

bundle exec rake db:create db:migrate db:seed

Finally, start Open Food Network using the following command:

foreman start -p 3000

Step 5 - Access Open Food Network

Open your web browser and navigate to http://<server-ip>:3000. You should see the Open Food Network homepage.


Congratulations! You have successfully installed Open Food Network on your Ubuntu server. You can now start selling your products and connecting with your local community.

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 a try!