Deploying Odoo

Introduction

Deploying Odoo ERP on Digital Ocean provides a scalable, cost-effective solution for businesses of all sizes. With its straightforward droplet system and competitive pricing, Digital Ocean is an excellent choice for hosting your Odoo instance.

Why Choose Digital Ocean?

Digital Ocean offers several advantages for Odoo deployment:

  • Affordable pricing with predictable costs
  • Simple setup and management
  • Scalable resources as your business grows
  • Global data centers for optimal performance
  • Robust security features

Step 1: Create a Digital Ocean Account

If you don't already have one, sign up for a Digital Ocean account. They offer a $100 credit for new users, which is more than enough to get started.

Step 2: Create a New Droplet

Navigate to the Droplets section in your Digital Ocean dashboard and click "Create Droplet". Choose the following options:

  • Ubuntu 20.04 LTS
  • Regular Intel with SSD (Choose plan based on your needs)
  • Datacenter region closest to your users
  • Add your SSH keys for secure access

Step 3: Install Required Dependencies

Once your droplet is created, SSH into your server and run the following commands:

sudo apt update
sudo apt upgrade -y
sudo apt install -y git python3-pip build-essential wget python3-dev python3-venv \
python3-wheel libfreetype6-dev libxml2-dev libzip-dev libldap2-dev libsasl2-dev \
python3-setuptools node-less libjpeg-dev zlib1g-dev libpq-dev \
libxslt1-dev libldap2-dev libtiff5-dev libjpeg8-dev libopenjp2-7-dev \
liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev

Step 4: Install PostgreSQL

Odoo requires PostgreSQL as its database backend:

sudo apt install -y postgresql postgresql-client
sudo -u postgres psql -c "CREATE USER odoo WITH CREATEDB PASSWORD 'strongpassword';"
sudo -u postgres createdb odoo

Step 5: Install Odoo

Now we'll install Odoo in a virtual environment:

sudo useradd -m -d /opt/odoo -U -r -s /bin/bash odoo
sudo su - odoo -s /bin/bash
git clone https://www.github.com/odoo/odoo --depth 1 --branch 16.0 /opt/odoo/odoo
cd /opt/odoo
python3 -m venv odoo-venv
source odoo-venv/bin/activate
pip install -r odoo/requirements.txt
deactivate
exit

Step 6: Configure Odoo

Create a configuration file for Odoo:

sudo nano /etc/odoo.conf

Add the following configuration:

[options]
admin_passwd = superadmin_password
db_host = localhost
db_port = 5432
db_user = odoo
db_password = strongpassword
addons_path = /opt/odoo/odoo/addons
logfile = /var/log/odoo/odoo.log

Step 7: Create a Systemd Service

Create a service file to manage Odoo:

sudo nano /etc/systemd/system/odoo.service

Add the following content:

[Unit]
Description=Odoo
After=postgresql.service

[Service]
Type=simple
User=odoo
Group=odoo
ExecStart=/opt/odoo/odoo-venv/bin/python3 /opt/odoo/odoo/odoo-bin -c /etc/odoo.conf

[Install]
WantedBy=multi-user.target

Step 8: Start Odoo Service

Finally, start and enable your Odoo service:

sudo systemctl daemon-reload
sudo systemctl start odoo
sudo systemctl enable odoo

Conclusion

You now have a fully functional Odoo instance running on Digital Ocean! Access it through your browser using your server's IP address on port 8069 (http://your_server_ip:8069). Remember to configure your domain name and SSL certificate for production use.

Back to Blog Next Post: Understanding Odoo ERP