This tutorial covers the steps needed for installing and configuring Odoo 16 Community version from Git source on a Python virtual environment on an Ubuntu 20.04 system.
- 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 the required python packages for Odoo:
sudo apt-get install -y python3-pip
sudo apt-get install python-dev python3-dev libxml2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev build-essential libssl-dev libffi-dev libmysqlclient-dev libjpeg-dev libpq-dev libjpeg8-dev liblcms2-dev libblas-dev libatlas-base-dev
sudo apt-get install -y npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install -g less less-plugin-clean-css
sudo apt-get install -y node-less
- Odoo supports printing reports as PDF files. Wkhtmltopdf helps to generate PDF reports from HTML data format. Moreover, the Qweb template reports are converted to HTML format by the report engine and Wkhtmltopdf will produce the PDF report:
sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.focal_amd64.deb
sudo apt install -f ./wkhtmltox_0.12.6-1.focal_amd64.deb
- Enable PostgreSQL Apt Repository by importing the GPG key for PostgreSQL packages:
sudo apt-get install postgresql
- Create a Database User Role for Handling Odoo Databases Next, a password for the distinctive user should be defined, which is needed later in the conf file:
sudo su - postgres
Next, a password for the distinctive user should be defined, which is needed later in the conf file:
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo16
The following command ensures that the user has superuser access rights:
psql
ALTER USER odoo16 WITH SUPERUSER;
Exit from psql and Postgres user:
\q
exit
- To clone source code from git have to install git, follow the below commands:
sudo apt-get install git
Configure your git
git config --global user.name "value"
git config --global user.email "value"
- Create a new system user named
odoo16
with a home directory/opt/odoo16
by:
sudo useradd -m -d /opt/odoo16 -U -r -s /bin/bash odoo16
- Switch to
odoo16
user:
sudo su - odoo16
- Clone Odoo 16 community version from Git source:
git clone https://www.github.com/odoo/odoo --depth 1 --branch 16.0 /opt/odoo16/odoo
- Creating a new Python Virtual Environment:
cd /opt/odoo16
python3 -m venv odoo16-venv
- Activate the virtual environment:
source odoo16-venv/bin/activate
- Install all of the required Python modules with pip3:
pip3 install wheel
pip3 install -r odoo/requirements.txt
- Deactivate the virtual environment:
deactivate
- Create a new directory for custom addons:
mkdir /opt/odoo16/odoo-custom-addons
- Switch back to sudo user:
exit
- Create a configuration file:
sudo cp /opt/odoo16/odoo/debian/odoo.conf /etc/odoo16.conf
- Open the configuration file:
sudo nano /etc/odoo16.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 = odoo16
db_password = False
addons_path = /opt/odoo16/odoo/addons,/opt/odoo16/odoo-custom-addons
Make sure to change the
enter-your-password
indicated above db_password changeFlase
to password you defined while creating postrgress user