Skip to content

Latest commit

 

History

History
205 lines (154 loc) · 5.09 KB

README.md

File metadata and controls

205 lines (154 loc) · 5.09 KB

Documentation for Setting up Odoo

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.

Updating the System to Latest Packages

  1. 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

Installing Odoo Dependencies

  1. 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

Creating a System User for Odoo

  1. 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

Enabling PostgreSQL Apt Repository, Installing and Configuring PostgreSQL

  1. 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 -
  1. 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'
  1. Refresh the local package index and install the PostgreSQL server with PostgreSQL contribution package:
$ sudo apt update
$ sudo apt install postgresql postgresql-contrib
  1. Verify PostgreSQL installation by running the following command:
$ sudo -u postgres psql -c "SELECT version();"
  1. 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.

Installing Wkhtmlopdf tool

  1. 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
  1. Install the wkhtmlox package:
$ sudo apt install ./wkhtmltox_0.12.1.3-1~bionic_amd64.deb

Installing and Configuring Odoo

  1. Switch to odoo12 user:
$ sudo su - odoo12
  1. Clone Odoo 12 community version from Git source:
$ git clone https://www.github.com/odoo/odoo --depth 1 --branch 12.0 /opt/odoo12/odoo
  1. Creating a new Python Virtual Environment:
$ cd /opt/odoo12
$ python3 -m venv odoo-venv
  1. Activate the virtual environment:
$ source odoo-venv/bin/activate
  1. 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.

  1. Deactivate the virtual environment:
(venv) $ deactivate
  1. Create a new directory for custom addons:
$ mkdir /opt/odoo12/odoo-custom-addons
  1. Switch back to sudo user:
$ exit
  1. Create a configuration file:
$ sudo cp /opt/odoo12/odoo/debian/odoo.conf /etc/odoo12.conf
  1. Open the configuration file:
$ sudo nano /etc/odoo12.conf
  1. 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!

Create a Systemd Unit File

  1. 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
  1. 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
  1. Notify systemd that a new unit file exists and start the Odoo service by:
$ sudo systemctl daemon-reload
$ sudo systemctl start odoo12

Check the odoo service status and enable service at start

$ sudo systemctl status odoo12
  1. If you wish to enable Odoo service to be automatically started at boot time:
$ sudo systemctl enable odoo12

Deployment

  1. Check out http://localhost:8069/ on your favorite browser.