Odoo is a popular open-source business management software suite that includes a wide range of applications for various business needs, such as CRM, accounting, inventory management, and more. If you're looking to deploy Odoo 13 on your Ubuntu 22.04 server, this comprehensive guide will walk you through the installation process step by step.
In this tutorial, you'll learn how to set up a clean Ubuntu 22.04 environment, prepare your server for Odoo installation, and then install Odoo 13. We'll cover all the necessary prerequisites, including setting up a PostgreSQL database, configuring a virtual environment, and installing required Python packages.
Below is a guide for you to install Odoo in the Ubuntu 22.04 LTS server.
Step 1 : Update and Upgrade System Packages
sudo apt-get update
sudo apt-get upgrade
Step 2 : Install Python3.7 and Prerequisites
# Install Prerequisites sudo apt install build-essential zlib1g-dev libncurses5-dev libgdbm-dev libnss3-dev libssl-dev libsqlite3-dev libreadline-dev libffi-dev wget libbz2-dev # Add deadsnakes PPA sudo add-apt-repository ppa:deadsnakes/ppa # Install Python 3.7 sudo apt install python3.7
Step 3 : Install PostgreSQL and Create User
#Creating the ODOO PostgreSQL User
sudo apt-get install postgresql -y sudo su - postgres -c "createuser -s odoo13" 2> /dev/null || true
sudo -u postgres psql -c "ALTER USER odoo13 PASSWORD 'odoo';" 2> /dev/null || true
Step 4 : Install wkhtmltopdf
wkhtmltopdf is used to convert html content into pdf format. Odoo
generates the reports in html format and this is then converted to pdf
using the wkhtmltopdf package.
sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb
sudo apt install ./wkhtmltox_0.12.6.1-2.jammy_amd64.deb
Step 5 : Create ODOO system user
sudo adduser --system --quiet --shell=/bin/bash --home=/opt/odoo --gecos 'ODOO' --group odoo
# The user should also be added to the sudo'ers group.
sudo adduser odoo sudo
Step 6 : Create Log Directory
We will be storing the logs of our Odoo instance in this directory.
sudo mkdir /var/log/odoo
sudo chown odoo:odoo /var/log/odoo
Step 7 : Cloning Odoo to Server
Now we need to get the source code of Odoo so that we can run it in our server.
sudo git clone --depth 1 --branch 13.0 https://github.com/odoo/odoo /opt/odoo/odoo13/server-addons
Step 8 : Setup python virtual environment
We will be installing the required python packages for Odoo in a
python virtual environment. Let us create and activate a python virtual
environment.
sudo apt install python3.7-venv
sudo -u odoo -i
cd /opt/odoo/odoo13
python3.7 -m venv .venv
source .venv/bin/activate
Step 9 : Install python packages/requirements
sudo apt-get install libsasl2-dev python3.7-dev libldap2-dev libssl-dev
python3 -m pip install -r https://github.com/odoo/odoo/raw/13.0/requirements.txt
Step 10 : Setting permissions on home folder
sudo chown -R odoo:odoo /opt/odoo/*
Step 11 : Create custom module directory
sudo su odoo -c "mkdir /opt/odoo/odoo13/odoo-custom-addons"
Step 12 : Create server config file
Details of the database, port number to run Odoo, logfile location
etc. can be listed in a config file which will be used by Odoo during
the run time.
sudo touch /etc/odoo13.conf
sudo nano /etc/odoo13.conf
[options]
; Database operations password:
admin_passwd = PASSWORD
db_host = localhost
db_user = odoo13
db_password = False
http_port = 8069
logfile = /var/log/odoo/odoo13-server.log
data_dir = /opt/odoo/odoo13/.local/share/Odoo
addons_path = /opt/odoo/odoo13/server-addons/addons,/opt/odoo/odoo13/odoo-custom-addons
Step 13 : Set permission for config file
sudo chown odoo:odoo /etc/odoo13.conf
sudo chmod 640 /etc/odoo13.conf
Step 14 : Create service file
This service file will ensure that our Odoo system is up and running after every server restart.
sudo nano /etc/systemd/system/odoo13.service
[Unit]
Description=Odoo
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo
PermissionsStartOnly=true
User=odoo
Group=odoo
ExecStart=/opt/odoo/odoo13/.venv/bin/python3.7 /opt/odoo/odoo13/server-addons/odoo-bin -c /etc/odoo13.conf
StandardOutput=journal+consolepip3 install psycopg2-binary pdfminer.six num2words ofxparse dbfread ebaysdk firebase_admin pyOpenSSL
[Install]
WantedBy=multi-user.target
Step 15 : Set permission for service file
sudo chmod 755 /etc/systemd/system/odoo13.service
sudo chown root: /etc/systemd/system/odoo13.service
Step 16 : Service Commands
sudo systemctl start odoo13.service
sudo systemctl status odoo13.service
sudo systemctl restart odoo13.service
sudo systemctl daemon-reload
Step 17 : Enable the Odoo service on system startup
sudo systemctl enable odoo13.service