How To Set Up Odoo As A System Service: Quick Tutorial

How to Set Up Odoo as a System Service on Ubuntu

Odoo is a powerful and flexible open-source ERP platform that supports various business needs. Setting up Odoo as a system service ensures it starts automatically when the server boots, making your deployment more robust and convenient. This guide will walk you through the process of setting up Odoo as a system service on an Ubuntu-based system.

Understanding the Init System

Before diving into the setup, it's important to understand the init system in use by your operating system. The init system is responsible for starting services when the system boots. Historically, Debian (and derived systems) used sysvinit, but more recent versions have adopted systemd.

Checking the Init System

To determine which init system you're using on an Ubuntu system, run the following command:

$ man init

This command opens the documentation for the currently used init system. If you're using a modern version of Ubuntu (16.04 or later), systemd is likely in use.

Setting Up Odoo as a System Service on Ubuntu 16.04 and Later

Creating the Service File

For newer systems like Ubuntu 16.04 and later, which use systemd, you can create a service file by following these steps:

  1. Create the service file:

bash $ sudo nano /lib/systemd/system/odoo.service

  1. Add the following content to the file:

```ini [Unit] Description=Odoo After=postgresql.service

[Service] Type=simple User=odoo Group=odoo ExecStart=/home/odoo/odoo-18/odoo-bin -c /etc/odoo/odoo.conf

(The line above assumes that we are running Odoo with the user and group Odoo, within /home/odoo/odoo-18 folder, using odoo.conf file that resides in the /etc/odoo folder. These parameters should be adjusted by the sys admin according to their actual setup/locations)

[Install] WantedBy=multi-user.target ```

  1. Copy the sample service file from Odoo's source code:

bash $ sudo cp /home/odoo/odoo-12/debian/odoo.service /lib/systemd/system/odoo.service

  1. Modify the ExecStart option if necessary to match your setup.
  2. Register the new service:

bash $ sudo systemctl enable odoo.service

  1. Start the service:

bash $ sudo systemctl start odoo

  1. Verify the service status:

bash $ sudo systemctl status odoo

  1. Stop the service if needed:

bash $ sudo systemctl stop odoo

Setting Up Odoo as a System Service on Older Systems

For older systems like Debian 7 or Ubuntu 15.04, which use sysvinit or Upstart, you can use the init script provided in the Odoo source code. Here's how:

Copy and modify the init script:

bash $ sudo cp /home/odoo/odoo-18/debian/init /etc/init.d/odoo $ sudo chmod +x /etc/init.d/odoo

Edit the init script to configure it for your environment:

After copying the init script into /etc/init.d/, you should review and, if needed, adjust the key parameters defined at the top of the file. A typical configuration looks like this:

PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin
DAEMON=/usr/bin/odoo
NAME=odoo
DESC=odoo
CONFIG=/etc/odoo/odoo.conf
LOGFILE=/var/log/odoo/odoo-server.log
PIDFILE=/var/run/${NAME}.pid
USER=odoo

These variables usually work as defaults, but they can be modified to fit your setup:

  • USER → defines the system user under which Odoo will run. Typically, this is the odoo user created earlier.
  • DAEMON → points to the Odoo executable. If your odoo-bin file is located elsewhere (for example, /home/odoo/odoo-12/odoo-bin), you can create a symbolic link to make it accessible at the expected location:
    sudo ln -s /home/odoo/odoo-12/odoo-bin /usr/bin/odoo
    sudo chown -h odoo /usr/bin/odoo
    
  • CONFIG → specifies the configuration file. In most cases, this should already exist in /etc/odoo/odoo.conf.
  • LOGFILE → defines the location where logs are written. Make sure the directory /var/log/odoo exists and is writable by the odoo user.

Starting and Stopping the Service

Once the script is configured, you can manage the service as follows:

Start Odoo:

sudo /etc/init.d/odoo start

Stop Odoo:

sudo /etc/init.d/odoo stop

On some distributions, you can also use the service command:

sudo service odoo start
sudo service odoo status
sudo service odoo stop

Enabling Automatic Startup

To make sure Odoo starts automatically when the server boots, register the service with:

sudo update-rc.d odoo defaults

From now on, Odoo will be launched automatically during system startup.

Verifying the Service

At this stage, you should confirm that your Odoo instance is running correctly:

  • Check if Odoo responds to HTTP requests from within the server:
    curl http://localhost:8069
    
    You should receive a redirect to /web.
  • Inspect the log file for errors or warnings:
    sudo less /var/log/odoo/odoo-server.log
    
  • Monitor the logs in real time:
    sudo tail -f /var/log/odoo/odoo-server.log
    

Conclusion

We have now covered how to configure Odoo as a system service using both systemd (for modern Ubuntu systems) and SysVinit/Upstart (for legacy systems).

Running Odoo as a service ensures:

  • Automatic startup when the server boots
  • Easier management with standard system commands
  • Centralized logging and monitoring

While this guide focuses on Ubuntu, the same procedures apply to most Debian-based distributions, since Ubuntu itself is derived from Debian. Therefore, whether you are running Ubuntu or Debian, you can rely on these instructions to set up Odoo as a robust and manageable service.


Raffaele Del Gatto September 7, 2025
Archive
Sign in to leave a comment
Not everything that glitters is gold: what is wrong with Odoo's partnership system