How to install Odoo 11 on Ubuntu 16.04

s2 0

Odoo is one of the most popular business software in the world. Depending on the desired application, there are several options for installing Odoo.

The easiest and fastest way to install Odoo
is through the use of their official repositories.

If you want more control over versions and updates, or want to run multiple Odoo versions on your computer, this approach won’t work for you as the Odoo package doesn’t allow multiple Odoo installations on the same computer. In this case you can either use docker and docker compose or install Odoo in a virtual Python environment.

This guide describes the steps required to install and configure Odoo using Git source code and the Python virtual environment on Ubuntu 16.04.

before you start

Before proceeding with this tutorial, make sure that you are logged in as a user with sudo permissions.

Update the package index and any installed packages to the latest packages:

sudo apt update && sudo apt upgrade

Install Git, Pip, Node.js and the tools needed to create Odoo dependencies:

sudo apt install git python3-pip build-essential python3-dev libxslt-dev libzip-dev libldap2-dev libsasl2-dev node-less

Create Odoo user

Create a new system user and a new group with a home directory /opt/odoo which will run the Odoo service:

useradd -m -d /opt/odoo -U -r -s /bin/bash odoo
You can name the user anything you want, just make sure you create a PostgreSQL user with the same name.

Install and configure PostgreSQL

Install the PostgreSQL package from Ubuntu’s standard repositories:

sudo apt install postgresql

After the installation is complete, create a new PostgreSQL user with the same name as the previously created system user, so in our case odoo:

sudo su - postgres -c "createuser -s odoo"

Install Wkhtmltopdf

To print PDF reports, you need the wkhtmltopdf Tool. The recommended version of Wkhtmltopdf is 0.12.1 which is not available in the official Ubuntu 16.04 repositories. We will download and install the recommended version from the official Wkhtmltopdf site.

Download the package with the following wget command:

wget https://builds.wkhtmltopdf.org/0.12.1.3/wkhtmltox_0.12.1.3-1~xenial_amd64.deb

Once the download is complete, install the package by typing:

sudo apt install ./wkhtmltox_0.12.1.3-1~xenial_amd64.deb

Install and configure Odoo

We’ll be installing Odoo from the GitHub repository in an isolated Python environment so we have more control over versions and updates.

Before starting the installation, make sure that you switch to the “odoo” user:

sudo su - odoo

To confirm that you are logged in as a user odoo, use the following command:

whoami

Start the installation process by cloning the Odoo source code from the GitHub repository:

git clone https://www.github.com/odoo/odoo --depth 1 --branch 11.0 /opt/odoo/odoo11
  • If you want to download and install a different Odoo version, just change the version number after the --branch Counter.
  • For example, you can download the Odoo source code at will odoo11 You can use your domain name.

virtualenv is a tool for creating isolated Python environments. To install it use:

pip3 install virtualenv

Create a new virtual Python environment for the Odoo installation with:

cd /opt/odoovirtualenv odoo11-venv

Activate the environment:

source odoo11-venv/bin/activate

Install any required Python modules:

pip3 install -r odoo11/requirements.txt
If you encounter compilation errors during the installation, make sure you have installed all of the required dependencies from the list Before you begin Section.

Once the installation is complete, disable the environment and switch back to your sudo user using the following commands:

deactivate
exit

If you plan to install additional modules, it is best to put those modules in a separate directory. To create a new directory for the additional modules, do the following:

sudo mkdir /opt/odoo/odoo11-custom-addonssudo chown odoo: /opt/odoo/odoo11-custom-addons

Next we need to create a configuration file. We can either create a new one from scratch or copy the included configuration file:

sudo cp /opt/odoo/odoo11/debian/odoo.conf /etc/odoo11.conf

Open the file and edit it as follows:

sudo nano /etc/odoo11.conf
/etc/odoo11.conf
[options]
; This is the password that allows database operations:
admin_passwd = my_admin_passwd
db_host = False
db_port = False
db_user = odoo
db_password = False
addons_path = /opt/odoo/odoo11/addons
; If you are using custom modules
; addons_path = /opt/odoo/odoo11/addons,/opt/odoo/odoo11-custom-addons

When you’re done, close and save the file.

Don’t forget to change them my_admin_passwd on something safer and set the addons_path if you are using custom modules.

Create a systemd unit file

To run odoo as a service we need to a odoo11.service unit file in the /etc/systemd/system/ Directory.

Open your text editor and paste the following lines:

sudo nano /etc/systemd/system/odoo11.service
/etc/systemd/system/odoo11.service
[Unit]
Description=Odoo11
Requires=postgresql.service
After=network.target postgresql.service

[Service]
Type=simple
SyslogIdentifier=odoo11
PermissionsStartOnly=true
User=odoo
Group=odoo
ExecStart=/opt/odoo/odoo11-venv/bin/python3 /opt/odoo/odoo11/odoo-bin -c /etc/odoo11.conf
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target

Notify systemd that a new unit file has been created and start the Odoo service by running:

sudo systemctl daemon-reloadsudo systemctl start odoo11

Check the service status with the following command:

sudo systemctl status odoo11

The output should look something like this to indicate that the Odoo service is up and running.

● odoo11.service - Odoo11
   Loaded: loaded (/etc/systemd/system/odoo11.service; disabled; vendor preset: enabled)
   Active: active (running) since Tue 2018-01-23 21:09:25 UTC; 1s ago
 Main PID: 14146 (python3)
   CGroup: /system.slice/odoo11.service
           └─14146 /opt/odoo/odoo11-venv/bin/python3 /opt/odoo/odoo11/odoo-bin -c /etc/odoo11.conf

Activate the Odoo service so that it starts automatically when booting:

sudo systemctl enable odoo11

If you want to see the messages logged by the Odoo service, you can use the following command:

sudo journalctl -u odoo11

Test the installation

Open your browser and enter: https://<your_domain_or_IP_address>:8069

If the installation is successful, you will see a screen similar to the following:

At this point you have a working Odoo 11 installation. You can complete the installation by creating a new database and starting working on your project.

diploma

That’s it! This tutorial walked you through the installation of Odoo 11 on Ubuntu 16.04 in a virtual Python environment.

To learn how to configure your Odoo with Nginx as a reverse proxy and how to access your Odoo installation via HTTPS, you can read the following post:

Configure Odoo as a reverse proxy with Nginx

You can also read our tutorial on creating automatic daily backups of your Odoo databases.

If you have any problems please leave a comment below.

Tags: