In this blog post we’ll explain how to install Odoo 17 on Ubuntu 22.04, step-by-step.
Odoo is an open-source and self-hosted application written in Python and Javascript. The latest stable version of Odoo is Odoo 17 and it offers a variety of features, such as managing customers, products, sales, inventories, accounts, project management, and orders, covering the most important parts of your business. Odoo 17 stores its data in the PostgreSQL database, which will be installed during our installation of Odoo.
Installing Odoo 17 on Ubuntu 22.04 is straigforward process that may take up to 15 minutes. Let’s get things done!
Table of Contents
Prerequisites
- A Linux server with Ubuntu 22.04 and at least 2GB of RAM
- User privileges: root or non-root user with sudo privileges
How to Install Odoo 17: Step 1. Update the System
Every fresh installation of Ubuntu 22.04 needs the packages to be updated to the latest versions available. To do that, execute the following command:
sudo apt-get update -y && sudo apt-get upgrade -y
Step 2. Install Python and Required Libraries
Before we start with the installation, we need to install some dependencies for PostgreSQL and Odoo itself.
sudo apt-get install -y python3-pip python3-dev python3-venv 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 -y
Step 3. Install NPM and CSS plugins
Once the dependencies are installed, we will install package management for the JavaScript programming language:
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
Step 4. Install Wkhtmltopdf
In this step we will install the Wkhtmltopdf
command line tool, used for converting HTML pages to PDF files. Run these three commands one by one:
sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb sudo dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb sudo apt install -f
Step 5. Install PostgreSQL
Step by step, we are getting closer to the Odoo installation. Before we install Odoo, we will need to install the PostgreSQL service which is responsible for storing Odoo’s data.
sudo apt-get install postgresql -y
Once installed, start and enable the PostgreSQL service.
sudo systemctl start postgresql && sudo systemctl enable postgresql
To check the status execute the following command:
sudo systemctl status postgresql
You should receive the following output:
root@host:/# sudo systemctl status postgresql ● postgresql.service - PostgreSQL RDBMS Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor preset: enabled) Active: active (exited) since Thu 2023-11-23 03:42:11 CST; 18s ago Main PID: 20712 (code=exited, status=0/SUCCESS) CPU: 3ms Nov 23 03:42:11 host.test.vps systemd[1]: Starting PostgreSQL RDBMS... Nov 23 03:42:11 host.test.vps systemd[1]: Finished PostgreSQL RDBMS.
Step 6. Create Odoo and PostgreSQL users
Next we will create Odoo and PostgreSQL users. To create the Odoo user, execute the following command:
useradd -m -U -r -d /opt/odoo17 -s /bin/bash odoo17
Set the user password for odoo17
:
passwd odoo17 New password: YourStrongPasswordHere Retype new password: YourStrongPasswordHere passwd: password updated successfully
Make sure to replace YourStrongPasswordHere
with a strong password. To create a PostgreSQL user, execute the following command:
sudo su - postgres -c "createuser -s odoo17"
Step 7. Install and Configure Odoo 17
First log in as the Odoo user and clone the latest version of Odoo in the /opt/
directory:
su - odoo17 git clone https://www.github.com/odoo/odoo --depth 1 --branch 17.0 /opt/odoo17/odoo17
Next, activate the Python virtual environment and begin installing the Odoo requirements.
cd /opt/odoo17 python3 -m venv odoo17-venv source odoo17-venv/bin/activate pip install --upgrade pip pip3 install wheel pip3 install -r odoo17/requirements.txt
Once done, deactivate the environment and create the Odoo add-on directories and Odoo log file.
deactivate mkdir /opt/odoo17/odoo17-custom-addons chown -R odoo17:odoo17 /opt/odoo17/odoo17-custom-addons sudo mkdir -p /var/log/odoo17 sudo touch /var/log/odoo17.log sudo chown -R odoo17:odoo17 /var/log/odoo17
Step 8. Create Odoo 17 configuration file
Next we need to create the configuration file for Odoo’s configuration.
sudo touch /etc/odoo17.conf
Open the configuration file with your favorite editor and paste the following lines of code, remembering to change YourStrongPasswordHere
to a strong password:
[options] admin_passwd = YourStrongPasswordHere db_host = False db_port = False db_user = odoo17 db_password = False xmlrpc_port = 8069 logfile = /var/log/odoo17/odoo17.log addons_path = /opt/odoo17/odoo17/addons,/opt/odoo17/odoo17-custom-addons
Save the file and close it.
Step 9. Create an Odoo systemd unit file
We now need a Systemd service unit file in order to control our Odoo instance more easily. This lets us easily start, stop and set Odoo to run on system boot. To create the Odoo systemd unit file, execute the following command:
sudo touch /etc/systemd/system/odoo17.service
Open the systemd unit file with your preferred text editor and paste the following lines of code:
[Unit] Description=odoo17 After=network.target postgresql@14-main.service [Service] Type=simple SyslogIdentifier=odoo17 PermissionsStartOnly=true User=odoo17 Group=odoo17 ExecStart=/opt/odoo17/odoo17-venv/bin/python3 /opt/odoo17/odoo17/odoo-bin -c /etc/odoo17.conf StandardOutput=journal+console [Install] WantedBy=multi-user.target
Reload the daemon, then start and enable the Odoo service:
sudo systemctl daemon-reload sudo systemctl start odoo17 && sudo systemctl enable odoo17
To check the status of the service, execute the command below:
sudo systemctl status odoo17
You should get the following output:
root@host:~# sudo systemctl status odoo17 ● odoo17.service - odoo17 Loaded: loaded (/etc/systemd/system/odoo17.service; enabled; vendor preset: enabled) Active: active (running) since Thu 2023-11-23 06:34:36 CST; 6s ago Main PID: 44663 (python3) Tasks: 4 (limit: 4558) Memory: 72.0M CPU: 2.406s CGroup: /system.slice/odoo17.service └─44663 /opt/odoo17/odoo17-venv/bin/python3 /opt/odoo17/odoo17/odoo-bin -c /etc/odoo17.conf Nov 23 06:34:36 host.test.vps systemd[1]: Started odoo17.
As you can see, the service is up and running. To access your Odoo website, you need to access your server’s IP address in your web browser on port 8069.
http://YourServerIPAddress:8069
Congratulations! You successfully installed Odoo 17 on Ubuntu 22.04. Now you can install modules, add your personal details and get your business up and running through Odoo.
Alternatively, you wouldn’t have to spend your time installing Odoo 17 on Ubuntu 22.04 if you had a managed Odoo VPS hosting plan hosted with us. If you did, you’d simply ask our support team to install Odoo 17 on Ubuntu 22.04 for you, and they’d take care of the rest. They are available 24/7 and will be able to help you with the installation of Ubuntu 22.04 as well as any additional requirements that you may have. Try us out – we’re positive you won’t regret it.
Thanks for reading this tutorial – please share it with your peers if you found this guide helpful. You can also leave a comment if you liked the post or if you have any suggestions or concerns.
Not right like this:
Step 4. Install Wkhtmltopdf
sudo wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
sudo dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb
sudo apt install -f
Right like this:
cd /tmp
wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6.1-3wkhtmltox_0.12.6.1-3.jammy_amd64.deb
sudo gdebi -n wkhtmltox_0.12.6.1-3.jammy_amd64.deb
rm wkhtmltox_0.12.6.1-3.jammy_amd64.deb
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin/
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin/
Feel free to use those commands as well for the installation of the “wkhtmltopdf”
Or you can use this:
sudo apt install wkhtmltopdf
The wkhtmltopdf is included in the Ubuntu 24.04 repository
If wkhtmltopdf is not readable
sudo ln -s /usr/local/bin/wkhtmltopdf /usr/bin
sudo ln -s /usr/local/bin/wkhtmltoimage /usr/bin
Apr 06 08:43:14 vps-56aca941 odoo17[8318]: File “/opt/odoo17/odoo17/odoo/modules/graph.py”, line >
Apr 06 08:43:14 vps-56aca941 odoo17[8318]: import odoo.tools as tools
Apr 06 08:43:14 vps-56aca941 odoo17[8318]: File “/opt/odoo17/odoo17/odoo/tools/__init__.py”, line>
Apr 06 08:43:14 vps-56aca941 odoo17[8318]: from . import _monkeypatches
Apr 06 08:43:14 vps-56aca941 odoo17[8318]: File “/opt/odoo17/odoo17/odoo/tools/_monkeypatches.py”>
Apr 06 08:43:14 vps-56aca941 odoo17[8318]: from werkzeug.datastructures import FileStorage
Apr 06 08:43:14 vps-56aca941 odoo17[8318]: ModuleNotFoundError: No module named ‘werkzeug’
Apr 06 08:43:14 vps-56aca941 systemd[1]: odoo17.service: Main process exited, code=exited, status=1>
Apr 06 08:43:14 vps-56aca941 systemd[1]: odoo17.service: Failed with result ‘exit-code’.
Apr 06 08:43:14 vps-56aca941 systemd[1]: odoo17.service: Consumed 1.479s CPU time.
keep stopping after somtime
knowing that werkzeug installed correctly from requirements
Make sure that your Odoo is using the virtual environment in which you installed the requirements.
have you tried following this tutorial? some command require elevated privileges and odoo17 user is not in the sudoers group: useradd -m -U -r -d /opt/odoo17 -s /bin/bash odoo17
If you need to add the odoo17 user to the sudo group, you can do it with the following command:
usermod -aG sudo odoo17
You can check our full tutorial on how to create a sudo user at:
https://www.rosehosting.com/blog/how-to-create-a-sudo-user-on-ubuntu-22-04/
In step 7, After pip3 install -r odoo17/requirements.txt I get the following error:
src/lxml/etree.c: In function ‘__Pyx_PyInt_As_long’:
src/lxml/etree.c:269960:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
269960 | const digit* digits = ((PyLongObject*)x)->ob_digit;
| ^~
src/lxml/etree.c:270015:53: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
270015 | const digit* digits = ((PyLongObject*)x)->ob_digit;
| ^~
src/lxml/etree.c: In function ‘__Pyx_PyIndex_AsSsize_t’:
src/lxml/etree.c:270403:45: error: ‘PyLongObject’ {aka ‘struct _longobject’} has no member named ‘ob_digit’
270403 | const digit* digits = ((PyLongObject*)b)->ob_digit;
| ^~
Compile failed: command ‘/usr/bin/x86_64-linux-gnu-gcc’ failed with exit code 1
creating tmp
cc -I/usr/include/libxml2 -I/usr/include/libxml2 -c /tmp/xmlXPathInit4_94cqzo.c -o tmp/xmlXPathInit4_94cqzo.o
cc tmp/xmlXPathInit4_94cqzo.o -lxml2 -o a.out
error: command ‘/usr/bin/x86_64-linux-gnu-gcc’ failed with exit code 1
[end of output]
note: This error originates from a subprocess, and is likely not a problem with pip.
ERROR: Failed building wheel for lxml
Running setup.py clean for lxml
Failed to build greenlet lxml
ERROR: Could not build wheels for greenlet, lxml, which is required to install pyproject.toml-based projects
You can try installing lxml manually with the command: pip3 install lxml and please make sure you are running the commands in a Python virtual environment.
I don’t have the same end result (Active: failed )
root@raymond-Standard-PC-i440FX-PIIX-1996:/opt/odoo17# sudo systemctl status odoo17
× odoo17.service – odoo17
Loaded: loaded (/etc/systemd/system/odoo17.service; enabled; preset: enabled)
Active: failed (Result: exit-code) since Thu 2024-06-20 10:13:30 WAT; 26min ago
Duration: 2.708s
Process: 14269 ExecStart=/opt/odoo17/odoo17-venv/bin/python3 /opt/odoo17/odoo17/odoo-bin -c /etc/odoo17.conf (code=>
Main PID: 14269 (code=exited, status=1/FAILURE)
CPU: 1.531s
juin 20 10:13:30 raymond-Standard-PC-i440FX-PIIX-1996 odoo17[14269]: File “/usr/lib/python3.12/configparser.py”, line>
juin 20 10:13:30 raymond-Standard-PC-i440FX-PIIX-1996 odoo17[14269]: self._read(fp, filename)
juin 20 10:13:30 raymond-Standard-PC-i440FX-PIIX-1996 odoo17[14269]: File “/usr/lib/python3.12/configparser.py”, line>
juin 20 10:13:30 raymond-Standard-PC-i440FX-PIIX-1996 odoo17[14269]: raise MissingSectionHeaderError(fpname, lineno>
juin 20 10:13:30 raymond-Standard-PC-i440FX-PIIX-1996 odoo17[14269]: configparser.MissingSectionHeaderError: File conta>
juin 20 10:13:30 raymond-Standard-PC-i440FX-PIIX-1996 odoo17[14269]: file: ‘/etc/odoo17.conf’, line: 1
juin 20 10:13:30 raymond-Standard-PC-i440FX-PIIX-1996 odoo17[14269]: ‘admin_passwd = odoo17 \n’
juin 20 10:13:30 raymond-Standard-PC-i440FX-PIIX-1996 systemd[1]: odoo17.service: Main process exited, code=exited, sta>
juin 20 10:13:30 raymond-Standard-PC-i440FX-PIIX-1996 systemd[1]: odoo17.service: Failed with result ‘exit-code’.
juin 20 10:13:30 raymond-Standard-PC-i440FX-PIIX-1996 systemd[1]: odoo17.service: Consumed 1.531s CPU time, 3.8M memory>
lines 1-18/18 (END)
Check your /etc/odoo17.conf and ensure it’s configured as shown in the tutorial. Your “admin_password” parameter on /etc/odoo17.conf seems to have an error.
I have installed using your process. However, it is not allowing me to open the odoo project in vscode or any other IDE. I want to install it for development such that I can make new modules when I want to.
Hello, I want to install for development. When I try to open it on VSCode, it says you do not have permission to open it. How do I solve it? Also, is this a right way for development?
Yes, it can be used for development as well. Please make sure that you have full access to your application VSCode on your local computer. The installation has nothing with the IDE applications. You will have to investigate this issue on your local computer or on your server.
Hi – I followed your process and Odoo17 is up and running perfectly – thank you for your guide. I do have one question: I would now like to write some sql queries against the postgresql database. To connect to the database I am using the command:
psql -h localhost -U odoo17 -d my_database_name
What password should I be using? I’ve tried the password created in step 6, but I’m getting a “password authentication faile for user odoo17” error.
Please note, that password is for the system user “odoo17”, and not for the PostgreSQL user.
To log in the database via the command line you can use the following command:
sudo -u postgres psql
Then to list the database:
\l
To select your database:
\c “name of your database”
This post does not work, installing and executing all these commands takes time, there are many errors
We are able to install and access a test instance. What errors are you facing?
I tried it and it is working fine, can you please explain why you used xmlrpc_port = 8069 not http_port = 8069
I notice in Yenthe script he is using http_port for version > 11
We need to install NGINX for a domain.
If that way work for you then you can use http_port instead of xmlrpc_port.