Here we go as I started my journey with ERP initially on my personal Homelab, this article explains how to fully install and configure an Odoo environment for production purposes.
This is a true experience that I had on a Linux VPS instance running Ubuntu 20.04 LTS
while I am an extreme IT Expert, trust every step.
By the way, since I have been enjoying an instance on x4 CPU Cores with 8GB RAM
configuration from Contabo which is a german hosting service provider, let me tell you that it's the best price to features deal you will ever find.
Getting Started on Linux Ubuntu
Get remote access to your instance with root
credentials provided to you. Now, lets prepare this operating system environment with the software required for an Odoo ERP system.
Install Software Packages
apt update
apt install git postgresql python3-pip build-essential wget python3-dev python3-venv python3-wheel libfreetype6-dev libxml2-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less libjpeg-dev zlib1g-dev libpq-dev libxslt1-dev libldap2-dev libtiff5-dev libjpeg8-dev libopenjp2-7-dev liblcms2-dev libwebp-dev libharfbuzz-dev libfribidi-dev libxcb1-dev node-less node-clean-css nodejs npm
npm install -g rtlcss
Okay, we actually need to install a compatible "wkhtmltopdf" package for Odoo 14
instead of the one available in the official repositories.
sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
sudo apt install ./wkhtmltox_0.12.6-1.bionic_amd64.deb
That's like all the software packages required to proceed.
Create System User
useradd -m -d /opt/erp -U -r -s /bin/bash erp
passwd erp
usermod -aG sudo erp
su - erp
Note that we're setting /opt/erp
as home directory for the new user account. By now, your terminal should have switched user to erp
and thus we will start issuing commands with sudo.
sudo su - postgres -c "createuser -s erp"
The postgresql database system is the core for Odoo where all data will be stored, just make sure to create a database user with the same name as the one we created for the system itself.
Get Logging Directory
sudo mkdir /var/log/odoo
sudo chown erp:erp /var/log/odoo
This sums it up for a preparation plan! Now, the star of the show Odoo is awating.
Install Odoo Community Edition
Typically, you can pull the community version of Odoo ERP from GitHub that will gaurantee the latest updates and fixes. In fact, you should have Odoo 14
as the latest version availale on the stable branch, by the date we published this article.
Clone GitHub Repository
git clone https://www.github.com/odoo/odoo --depth 1 --branch 14.0 /opt/erp/odoo
cd /opt/erp
Install Python Requirements
python3 -m venv odoo-venv
source odoo-venv/bin/activate
Once created, you can proceed to install the python dependencies.
pip3 install wheel
pip3 install -r odoo/requirements.txt
deactivate
We're utilizing a Python Virtual Environment here. At its core, the main purpose is to create an isolated environment for Odoo itself and no other.
Configure Odoo Server
mkdir /opt/erp/odoo-addons
sudo nano /etc/odoo-server.conf
Given the above, please insert the following inside the configuration file created:
[options]
; General
admin_passwd = YOUR-MASTER-PASSWORD
#proxy_mode = True
longpolling_port = 8072
xmlrpc_port = 8069
#xmlrpc_interface = 127.0.0.1
#netrpc_interface = 127.0.0.1
; Database
db_host = False
db_port = False
db_user = erp
db_password = False
; Workers
#limit_memory_hard = 2684354560
#limit_memory_soft = 2147483648
#limit_request = 8192
#limit_time_cpu = 600
#limit_time_real = 1200
max_cron_threads = 1
workers = 0
; File Paths
logfile = /var/log/odoo/odoo-server.log
addons_path = /opt/erp/odoo/addons,/opt/erp/odoo-addons
Finalize your configuration process with giving odoo the permissions for access:
sudo chown erp:erp /etc/odoo-server.conf
sudo chmod 640 /etc/odoo-server.conf
Enable Odoo Server to Run on Startup
To summarise, you should have Odoo Server completely set and configured by this time, it's ready to work on serving business application for a website. Therefore, create a system service that works on system boot, and it will run the server automatically whithout any interaction.
Create System Service
sudo nano /etc/systemd/system/odoo.service
As a result, please insert the following inside the service file created:
[Unit]
Description=odoo
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo
PermissionsStartOnly=true
User=erp
Group=erp
ExecStart=/opt/erp/odoo-venv/bin/python3 /opt/erp/odoo/odoo-bin -c /etc/odoo-server.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
Run Odoo Server
sudo systemctl daemon-reload
sudo systemctl enable --now odoo
sudo systemctl status odoo
sudo journalctl -u odoo
In conclusion, ensure that Odoo Server is alive and running fine with commands stated above. To illustrate, open your browser and type in address bar http://<your_domain_or_IP_address>:8069
then enjoy your new life in business.