how-to-install-odoo-16-on-ubuntu-2004-lts

How to Install Odoo 16 on Ubuntu 20.04 LTS?

Getting Started with Odoo 16 on Ubuntu 20.04 LTS

If you’re looking to deploy a robust ERP solution for your business, Odoo 16 is one of the best choices available. Installing Odoo 16 on Ubuntu 20.04 LTS can seem daunting, but it’s a smooth process with the proper steps. This guide will take you through every stage, from preparing your server to running Odoo in your browser.

Whether you’re a developer, system administrator, or business owner with technical knowledge, this step-by-step tutorial will help you set up a fully functional Odoo environment ready for development or production use.

We’ll cover everything from basic server setup, PostgreSQL configuration, Python dependencies, and creating system services for Odoo while ensuring your installation is secure and efficient. Let’s begin your journey with Odoo 16!

How to Install Odoo 16 on Ubuntu 20.04 LTS: A Step-by-Step Guide

Step 1: Log in to the Ubuntu Server via SSH

Connect to your server via SSH:

				
					ssh username@IP_Address -p Port_number
				
			

Example:

				
					ssh root@127.0.0.1 -p 22
				
			

Step 2: Update Your Server

Ensure the server is up-to-date:

				
					sudo apt-get update
sudo apt-get upgrade

				
			

Step 3: Secure Your Server

Install Fail2Ban to protect against SSH attacks:

				
					sudo apt-get install openssh-server fail2ban
				
			

Start and enable Fail2Ban:

				
					sudo systemctl start fail2ban
sudo systemctl enable fail2ban

				
			

To verify that Fail2Ban is running:

				
					sudo systemctl status fail2ban
				
			

Step 4: Create a System User

Let’s now create a user to run Odoo:

				
					sudo adduser --system --home=/opt/odoo16 --group odoo16
				
			

Step 5: Install Required Packages and Libraries

Install Python and other essential libraries that Odoo needs to function:

Install Python packages:

				
					sudo apt-get install -y python3-pip
				
			

Install dependencies:

				
					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

				
			

Install web dependencies:

				
					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 6: Configure PostgreSQL

Install and configure PostgreSQL, the default database used by Odoo.

				
					sudo apt-get install postgresql
				
			

Create a PostgreSQL user for Odoo:

				
					sudo su - postgres
Psql

				
			

Inside the PostgreSQL shell:

				
					createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo16
ALTER USER odoo16 WITH SUPERUSER;
\q
exit

				
			

Step 7: Download Odoo 16 Community Edition

Install Git and clone the official Odoo 16 repository:

				
					sudo apt-get install git
				
			

Switch as odoo user:

				
					sudo su - odoo16 -s /bin/bash
				
			

Clone the Odoo repository:

				
					git clone https://www.github.com/odoo/odoo --depth 1 --branch 16.0 --single-branch .
exit

				
			

Step 8: Install Required Python Packages

Install all required Python packages using pip3:

				
					sudo pip3 install -r /opt/odoo16/requirements.txt
				
			

Step 9: Install Wkhtmltopdf for PDF Reports

Odoo uses Wkhtmltopdf to generate PDF reports. The version depends on your system architecture.

For AMD64:

				
					sudo dpkg -i wkhtmltox_0.12.5-1.bionic_amd64.deb
sudo apt install -f

				
			
				
					sudo dpkg -i wkhtmltox_0.12.6-1.focal_arm64.deb
sudo apt install -f -y

				
			

Step 10: Configure Odoo

Create a configuration file:

				
					sudo nano /etc/odoo16.conf
				
			

Add the following:

				
					[options]
admin_passwd = "Set DB Admin Password"
db_host = localhost
db_port = 5432
db_user = odoo16
db_password = "password created before"
addons_path = /opt/odoo16/addons
logfile = /var/log/odoo/odoo16.log

				
			

Set proper permissions:

				
					sudo chown odoo16: /etc/odoo16.conf
sudo chmod 640 /etc/odoo16.conf
sudo mkdir /var/log/odoo
sudo chown odoo16:root /var/log/odoo

				
			

Step 11: Create Odoo Service File

Set up Odoo as a systemd service:

				
					sudo nano /etc/systemd/system/odoo16.service
				
			

Add the following:

				
					[Unit]
Description=Odoo16
Documentation=http://www.odoo.com
[Service]
Type=simple
User=odoo16
ExecStart=/opt/odoo16/odoo-bin -c /etc/odoo16.conf
[Install]
WantedBy=default.target

				
			

Set proper permissions:

				
					sudo chmod 755 /etc/systemd/system/odoo16.service
sudo chown root: /etc/systemd/system/odoo16.service

				
			

Step 12: Start and Enable Odoo Service

Start the Odoo service and enable it on system boot:

				
					sudo systemctl start odoo16.service
sudo systemctl status odoo16.service
sudo systemctl enable odoo16.service

				
			

Step 13: Access Odoo 16

Once the Odoo service is running, you can access the Odoo web interface by opening the following URL in your browser:

				
					http://:8069
				
			

Replace <your_domain_or_IP_address> with your actual server IP or domain.

You should see the Odoo 16 setup page ready to create your first database and start building your ERP system!

Your Odoo 16 is Ready!

Installing Odoo 16 on Ubuntu 20.04 is straightforward when you follow each step carefully. This guide ensures you’re set up with a secure, production-ready Odoo instance for your business.

You’ve successfully installed and configured Odoo 16 Community Edition on Ubuntu 20.04 LTS. With the backend services properly running and the front end accessible through your browser, you can explore the powerful features Odoo offers, from managing your CRM, inventory, and HR to handling accounting e-commerce.

This environment is production-ready, but always consider securing your instance further for public access, configuring domain names with HTTPS (using Let’s Encrypt), and setting up automated database backups.

Whether customising Odoo modules or running a business, you now have a stable foundation to build. So, if you face any issues during installation, feel free to contact us.

Picture of Alfred Joshi

Alfred Joshi

I’m Alfred Joshi, a Linux System Administrator passionate about system optimization, security, and automation. Here, I share insights and tips on Linux and open-source technologies.

Get a free quote