This tutorial covers the steps needed for installing and configuring Odoo 12 Community version from Git source on a Python virtual environment on an Ubuntu 18.04 system. The steps for Odoo installation were utilized from here and here for PostgreSQL to create this instruction set.
- Open up the Linux terminal as a sudo user and execute the commands below in a step by step manner:
$ sudo apt-get update
$ sudo apt-get upgrade
- Install git, pip, node.js and tools required to build odoo dependencies:
$ sudo apt install git python3-pip build-essential wget python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less
- Create a new system user named
odoo12
with a home directory/opt/odoo12
by:
$ sudo useradd -m -d /opt/odoo12 -U -r -s /bin/bash odoo12
- Enable PostgreSQL Apt Repository by importing the GPG key for PostgreSQL packages:
$ sudo apt-get install wget ca-certificates
$ wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
- Add the repository to your system:
$ sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
- Refresh the local package index and install the PostgreSQL server with PostgreSQL contribution package:
$ sudo apt update
$ sudo apt install postgresql postgresql-contrib
- Verify PostgreSQL installation by running the following command:
$ sudo -u postgres psql -c "SELECT version();"
- Creating a PostgreSQL user for the
odoo12
user:
$ sudo su - postgres -c "createuser -s odoo12"
Make sure that the name of PostgreSQL username is same as the Odoo system user.
- Download the
wkhtmlox
package by employing wget command:
$ wget https://builds.wkhtmltopdf.org/0.12.1.3/wkhtmltox_0.12.1.3-1~bionic_amd64.deb
- Install the
wkhtmlox
package:
$ sudo apt install ./wkhtmltox_0.12.1.3-1~bionic_amd64.deb
- Switch to
odoo12
user:
$ sudo su - odoo12
- Clone Odoo 12 community version from Git source:
$ git clone https://www.github.com/odoo/odoo --depth 1 --branch 12.0 /opt/odoo12/odoo
- Creating a new Python Virtual Environment:
$ cd /opt/odoo12
$ python3 -m venv odoo-venv
- Activate the virtual environment:
$ source odoo-venv/bin/activate
- Install all of the required Python modules with pip3:
(venv) $ pip3 install wheel
(venv) $ pip3 install -r odoo/requirements.txt
İf python3 version is higher than 3.7 then the PILLOW version inside odoo/requirements.txt need to be changed from 4.0.0 to the supported version. In my case it was 6.0.0.
- Deactivate the virtual environment:
(venv) $ deactivate
- Create a new directory for custom addons:
$ mkdir /opt/odoo12/odoo-custom-addons
- Switch back to sudo user:
$ exit
- Create a configuration file:
$ sudo cp /opt/odoo12/odoo/debian/odoo.conf /etc/odoo12.conf
- Open the configuration file:
$ sudo nano /etc/odoo12.conf
- Edit the configuration file as:
[options]
; This is the password that allows database operations:
admin_passwd = enter-your-password
db_host = False
db_port = False
db_user = odoo12
db_password = False
addons_path = /opt/odoo12/odoo/addons,/opt/odoo12/odoo-custom-addons
Make sure to change the
enter-your-password
indicated above
Don't proceed with the following step if you are to run Odoo from Pycharm IDE!
- To run Odoo as a service, there is a need to create a service unit file in the
/etc/systemd/system/
directory. For this, open the text editor:
$ sudo nano /etc/systemd/system/odoo12.service
- Paste the following to the editor:
[Unit]
Description=Odoo12
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo12
PermissionsStartOnly=true
User=odoo12
Group=odoo12
ExecStart=/opt/odoo12/odoo-venv/bin/python3 /opt/odoo12/odoo/odoo-bin -c /etc/odoo12.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
- Notify systemd that a new unit file exists and start the Odoo service by:
$ sudo systemctl daemon-reload
$ sudo systemctl start odoo12
$ sudo systemctl status odoo12
- If you wish to enable Odoo service to be automatically started at boot time:
$ sudo systemctl enable odoo12
- Check out http://localhost:8069/ on your favorite browser.