Ubuntu 22.04 has built in Odoo 14 package in its repository, but when you install and run it give this error message:
/usr/bin/odoo Traceback (most recent call last): File "/usr/bin/odoo", line 5, in <module> import odoo File "/usr/lib/python3/dist-packages/odoo/__init__.py", line 115, in <module> from . import osv File "/usr/lib/python3/dist-packages/odoo/osv/__init__.py", line 4, in <module> from . import osv File "/usr/lib/python3/dist-packages/odoo/osv/osv.py", line 5, in <module> from ..models import Model, TransientModel, AbstractModel File "/usr/lib/python3/dist-packages/odoo/models.py", line 6372, in <module> collections.Set.register(BaseModel) AttributeError: module 'collections' has no attribute 'Set'
These error happened because collections module on Python 3.10 on Ubuntu 22.04 has some deprecated attributes.
The solution is to install previous version of Python such as Python 3.9 or older version.
Here we are going to install Python 3.9 then running Odoo 14 from Git website.
- Install some packages
sudo apt -y install software-properties-common sudo add-apt-repository -y ppa:deadsnakes/ppa sudo apt update sudo apt -y upgrade sudo apt install -y wget git python3.9 python3.9-distutils build-essential python3.9-dev python3.9-venv xfonts-75dpi xfonts-base fontconfig libxrender1 node-less libjpeg-dev gdebi postgresql build-essential wget libxslt-dev libzip-dev libldap2-dev libsasl2-dev node-less libjpeg-dev gdebi libpq-dev libxml2-dev libxslt1-dev libldap2-dev libsasl2-dev libffi-dev
-
Create OS user and DB user sudo useradd -d /odoo -s /bin/bash odoo sudo su - postgres -c "createuser -s odoo"
-
Download Odoo 14 git clone --depth 1 --branch 14.0 https://www.github.com/odoo/odoo /odoo/odoo-server
-
Create virtual environment for Python 3.9 and install some requirement modules python3.9 -m venv /odoo /odoo/bin/pip3 install -r /odoo/odoo-server/requirements.txt
-
Install wkhtmltox wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-2/wkhtmltox_0.12.6.1-2.jammy_amd64.deb sudo dpkg -i wkhtmltox_0.12.6.1-2.jammy_amd64.deb rm wkhtmltox_0.12.6.1-2.jammy_amd64.deb
-
Create directory custom addons and log sudo mkdir -p /odoo/custom/addons sudo chown -R odoo:odoo /odoo sudo mkdir /var/log/odoo sudo chown odoo:odoo /var/log/odoo
-
Edit first line of Odoo startup script file to use Python 3.9 # nano /odoo/odoo-server/odoo-bin #!/usr/bin/env python3 change to #!/odoo/bin/python3
-
Create Odoo configuration file # nano /etc/odoo-server.conf [options] admin_passwd = admin logfile = /var/log/odoo/odoo-server.log addons_path=/odoo/odoo-server/addons,/odoo/custom/addons
-
Change file owner sudo chown odoo:odoo /etc/odoo-server.conf
-
Run this just for testing /odoo/odoo-server/odoo-bin -c /etc/odoo-server.conf
-
-
Create Odoo Init file in order to automatically run Odoo ever reboot # nano /etc/init.d/odoo-server #!/bin/sh ### BEGIN INIT INFO # Provides: odoo-server # Required-Start: $remote_fs $syslog # Required-Stop: $remote_fs $syslog # Should-Start: $network # Should-Stop: $network # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: Enterprise Business Applications # Description: ODOO Business Applications ### END INIT INFO PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/bin DAEMON=/odoo/odoo-server/odoo-bin NAME=odoo-server DESC=odoo-server # Specify the user name (Default: odoo). USER=odoo # Specify an alternate config file (Default: /etc/openerp-server.conf). CONFIGFILE="/etc/odoo-server.conf" # pidfile PIDFILE=/var/run/${NAME}.pid # Additional options that are passed to the Daemon. DAEMON_OPTS="-c $CONFIGFILE" [ -x $DAEMON ] || exit 0 [ -f $CONFIGFILE ] || exit 0 checkpid() { [ -f $PIDFILE ] || return 1 pid=`cat $PIDFILE` [ -d /proc/$pid ] && return 0 return 1 } case "${1}" in start) echo -n "Starting ${DESC}: " start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER --background --make-pidfile --exec $DAEMON -- $DAEMON_OPTS echo "${NAME}." ;; stop) echo -n "Stopping ${DESC}: " start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo echo "${NAME}." ;; restart|force-reload) echo -n "Restarting ${DESC}: " start-stop-daemon --stop --quiet --pidfile $PIDFILE --oknodo sleep 1 start-stop-daemon --start --quiet --pidfile $PIDFILE --chuid $USER --background --make-pidfile --exec $DAEMON -- $DAEMON_OPTS echo "${NAME}." ;; *) N=/etc/init.d/$NAME echo "Usage: $NAME {start|stop|restart|force-reload}" >&2 exit 1 ;; esac exit 0
-
Run odoo-server service sudo chmod 755 /etc/init.d/odoo-server sudo chown root: /etc/init.d/odoo-server sudo update-rc.d odoo-server defaults sudo service odoo-server start
-
Check Odoo log file tail -f /var/log/odoo/odoo-server.log
-
Use web browser to access Odoo http://serveripaddress:8069
Install Odoo 14 on Ubuntu 22.04