How to Easy Install Odoo 16 on Ubuntu 22.04 hosted on a Digitalocean Droplet
Published: 2023-04-11 12:54:37

---
title: How to Easy Install Odoo 16 on Ubuntu 22.04 hosted on a Digitalocean Droplet
published: true
date: 2023-04-11 06:22:27 UTC
tags: 
canonical_url: https://blog.chetanmittaldev.com/how-to-easy-install-odoo-16-on-ubuntu-2204-hosted-on-a-digitalocean-droplet
---

![Odoo 16 on Ubuntu 22.04 on Digital Droplet](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/v1pdxbrfkmv3p4oh7quf.jpg)

[Odoo](https://en.wikipedia.org/wiki/Odoo), previously known as OpenERP, is one of the earlier open-source ERP systems launched in 2008 by Belgian software programmer Fabien Pinckaers.

Fabien started developing an ERP system, TinyERP, based on Python in 2005 which was later renamed to OpenERP in 2008 and then later renamed to Odoo in 2014.

I experienced OpenERP for the first time in mid-2010 when I needed to install it for a client of mine who was in the business of wine manufacturing in Italy. This client of mine had many of his business friends and competitors using OpenERP at the time.

I still remember marketing India-based [ERPNext](https://blog.chetanmittaldev.com/how-to-easy-install-erpnext-14-on-ubuntu-2204-lts-on-digitalocean-droplet) to the client but she was really interested in getting OpenERP for her business. [ERPNext](https://blog.chetanmittaldev.com/how-to-easy-install-erpnext-14-on-ubuntu-2204-lts-on-digitalocean-droplet) lacked many features at that time and didn't have a nice responsive UI.

Since then both ERPNext and Odoo have grown into full-fledged ERP systems competing with SAP, and the like.

The only thing I don't like about [Odoo](https://www.odoo.com/) is that it is not 100% Open Source like [ERPNext](https://erpnext.com/). I would always prefer using ERPNext myself over Odoo because I get almost all the features Odoo Enterprise has in ERPNext for free.

However, it is always a personal choice to pick one software over the other.

Let us move on to installing Odoo on Ubuntu 22.04 hosted on a Digitalocean droplet:-

## Preparation

The very first thing we will do is to create a new droplet on Digitalocean. If you already have an account on Digitalocean then just open it in a new browser window and login into your account.

If you are new to [Digitalocean](https://m.do.co/c/5007c53b92d9) then I would recommend you to [sign up](https://m.do.co/c/5007c53b92d9) on it as it is the best VPS provider with a nice and easy dashboard to manage and monitor your virtual servers, also called droplets.

### **Create new droplet**

Once you are inside your account dashboard on Digitalocean then just hit the _"Create"_ button and select "Droplet" from the dropdown as shown in the image below:-

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681194929114/cdabe5d1-1abb-4044-b950-d756d3b3bf3b.png)

For this step-by-step guide, to installing Odoo version 16 on Ubuntu 22.04 LTS on a Digitalicean droplet, I will create a droplet in my Digitalocean account and then later delete it once the guide is complete.

On the "Create Droplet" page you can configure your virtual server. I usually recommend using a regular droplet with 4GB RAM, however, for this guide I will use a regular droplet with 2GB RAM and a SWAP of 4GB.

First, select the region where you want Digitalocean to host your server. I usually select either Bangalore or Singapore because these 2 locations are closest to me.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681195356197/20c3193d-e76f-4c57-9132-c6ce15b85cc3.png)

Second, select Ubuntu 22.04 LTS as the operating system for your droplet. I usually pick the LTS version of Ubuntu for the server because it receives updates for a long time of 5 years.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681195444615/3bb2f54f-3a43-43fd-a5da-289748b9d8eb.png)

Third, select the size of the droplet. I usually select a "Basic" and "Regular" server with 4GB of RAM, however, for this guide we will go for a 2GB RAM droplet as shown in the image below:-

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681195745858/e49c9003-2e3d-4a59-b9ad-7c8b8ada9d52.png)

Fourth, add your SSH public key to access the server using Putty if you are on Windows or by simply running `ssh username@-your-server-ip-address-` on your Terminal, if you are on Linux or Mac.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681195903366/5577d8af-16b6-4b5d-8780-2bd1018b55d5.png)

Finally, we will hit the _"Create Droplet"_ button to create our 2GB virtual server with Ubuntu 22.04 LTS on Digitalocean to install Odoo 16.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681195999763/7915c18a-f37c-4b75-95c7-de82d95b5548.png)

You can add tags to your droplet if you have many droplets and you need to differentiate this one from the others for an easy search. And, also change the hostname provided by Digitalocean by default. I just leave it as it is.

Next move on to the next step which is installing preliminary software such as Python, etc. required to install Odoo on Ubuntu.

### **Login to your droplet using SSH**

Once your droplet is created then login into it using `ssh root@-your-droplet-ip-address-` as shown in the image below:-

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681196468069/487d562e-859c-4afd-968a-bc157fedd6ee.png)

Before installing software from scratch on my droplets I usually prefer creating a SWAP image of twice the size of server RAM to be on the safe side just in case some software process needs more memory power to execute.

### **Create a SWAP image of 4GB for your droplet**

**Follow the guide here to add swap:** [https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-22-04](https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-22-04).

Verify if you already have a SWAP by running `free -h` on your server:-

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681196737505/850ba623-c40e-451f-862d-9cd5fccaa502.png)

As you can see we don't have any SWAP image as yet. Let's create one.

Create a 4GB SWAP image by running the commands as shown below along with images:-

`$ sudo fallocate -l 4G /swapfile`

`$ ls -lh /swapfile`

`$ sudo chmod 600 /swapfile`

`$ ls -lh /swapfile`

`$ sudo mkswap /swapfile`

`$ sudo swapon /swapfile`

`$ sudo swapon --show`

`$ free -h`

`$ sudo cp /etc/fstab /etc/fstab.bak`

`$ echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681196971902/99a22cab-e896-4358-99ce-b2a1e3aa23fd.png)

You can also tune your SWAP image by updating its values of "Swappiness" and "Cache Pressure".

### **Update and Upgrade your Ubuntu Server Droplet**

First, let us check if your server is on Ubuntu 22.04 or not by running the following command inside your server's terminal.

`$ lsb_release -a`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681198017276/69fced08-3bf7-44ac-ac5c-bb3a2c07e1ff.png)

Once we have confirmed that our server is running Ubuntu 22.04 update your server by running:-

`$ sudo apt update && sudo apt upgrade`

After your server update, reboot it and then log in again.

`$ reboot`

`$ ssh root@-your-droplet-ip-address-`

### **Add a System User to Install Odoo 16 on your Ubuntu 22.04 Server Droplet**

`$ sudo useradd -m -d /opt/odoo16 -U -r -s /bin/bash odoo16`

### **Install Software Dependencies for Odoo 16**

`$ sudo apt install build-essential wget git python3-pip python3-dev python3-venv python3-wheel libfreetype6-dev libxml2-dev libzip-dev libsasl2-dev python3-setuptools libjpeg-dev zlib1g-dev libpq-dev libxslt1-dev libldap2-dev libtiff5-dev libopenjp2-7-dev`

### **Install PostgreSQL Database**

`$ sudo apt install PostgreSQL`

Add the system user odoo16 we created earlier to the PostgreSQL database to manage our Odoo 16 database:-

`$ sudo su - postgres -c "createuser -s odoo16"`

### **Install wkhtmltopdf for generating PDFs such as Invoices**

`$ sudo apt install wkhtmltopdf`

Now, our Ubuntu 22.04 droplet is created, configured, and prepared to install Odoo 16. Let's install it next.

## **Install Odoo 16**

The default software installer in Ubuntu 22.04 installs Odoo 14 but we need to install Odoo 16, right? As we already know Odoo is built using Python software programming language thus let us install Odoo version 16 by using a feature in Python called _"Virtual Environment"_.

To do this you will need to login into your system by logging in using the system user _odoo16_ we created earlier:-

`$ sudo su - odoo16`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681199448155/7eb7b793-649d-4831-9522-ea41754b43b0.png)

Once you are logged in using _odoo16_ system user, you will need to download Odoo16 software from its Github repo located at [https://www.github.com/odoo/odoo](https://www.github.com/odoo/odoo).

`$ git clone https://www.github.com/odoo/odoo --depth 1 --branch 16.0 odoo16`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681199682621/5945ac54-ec64-4f67-8eb3-ff0f579699b8.png)

Now, create a new Python Virtual Environment inside which we will run Odoo 16:-

`$ python3 -m venv odoo16-venv`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681199772069/60715206-5a3f-46cd-acc9-3769b8f9e5e9.png)

Once you have your Python Virtual Environment for Odoo 16 installed you will need to activate it:-

`$ source odoo16-venv/bin/activate`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681199896246/3dd10f8b-94aa-40f0-bdca-8af8fc8e55b3.png)

Finally, let us move ahead with installing Odoo 16. Run the following:-

_(odoo16-venv) odoo16@ubuntu-s-1vcpu-2gb-blr1-01:~_`$ pip3 install wheel`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681199997252/52fedeb8-250b-4b8d-a964-e0544df3d1de.png)

_(odoo16-venv) odoo16@ubuntu-s-1vcpu-2gb-blr1-01:~_`$ pip3 install -r odoo16/requirements.txt`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681200210146/6a576a84-7379-406c-b384-f9e219c1900f.png)

If the above steps have run successfully on your Ubuntu 22.04 server to install Odoo 16 then you need to deactivate your Python Virtual Environment:-

_(odoo16-venv) odoo16@ubuntu-s-1vcpu-2gb-blr1-01:~_`$ deactivate`

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681200347295/ee2c3f52-0fb0-43f9-ab39-dcb750d2c7be.png)

Next, you can create a custom-addons folder inside the `/opt` directory at the exact location `/opt/odoo16/odoo16/custom-addons` for Odoo 16 installation to access any custom addons you will use if any.

`$ mkdir /opt/odoo16/odoo16/custom-addons`

Logout from the _odoo16_ system user:-

`$ exit`

## **Configure Odoo 16**

Now, you will need to configure your Odoo 16 to make it run.

### **Create Odoo 16 config file**

Open the Odoo 16 config file using a text editor such as _nano:-_

`$ sudo nano /etc/odoo16.conf`

Paste the following inside the file:-

```
[options]
admin_passwd = passW0rd
db_host = False
db_port = False
db_user = odoo16
db_password = False
addons_path = /opt/odoo16/odoo16/addons,/opt/odoo16/odoo16/custom-addons
xmlrpc_port = 8069

```

You can change the admin\_password above as per your likeliness, however, passW0rd is easy to remember for me for this guide. This is your Odoo 16's master password which you will need to create or delete databases.

### **Create a systemd unit file for your Odoo 16**

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

Paste the following inside the file:-

```
[Unit]
Description=Odoo16
Requires=postgresql.service
After=network.target postgresql.service

[Service]
Type=simple
SyslogIdentifier=odoo16
PermissionsStartOnly=true
User=odoo16
Group=odoo16
ExecStart=/opt/odoo16/odoo16-venv/bin/python3 /opt/odoo16/odoo16/odoo-bin -c /etc/odoo16.conf
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target

```

Hurray! Your Odoo 16 is now ready to run. Let's run it.

## **Run your Odoo 16 server**

Run to reload the Odoo 16 server with the above configuration:-

`$ sudo systemctl daemon-reload`

Now, start the Odoo 16 server:-

`$ sudo systemctl start odoo16`

If you want to see the status of the Odoo 16 server then you can run:-

`$ sudo systemctl status odoo16`

Below is the screenshot of the Odoo 16 server running on my droplet created above:-

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681201524371/04d83944-2fd2-4582-9897-a9835702f3bd.png)

Below are the details I filled in to create my first database on my Odoo 16 server. I hope you can fill the same, just replace my master password _(the one you entered in the_ `/etc/odoo16.conf` _config previously)_, username, email, phone, and country with yours:-

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681208400724/166ff14f-43c6-49c0-be01-d939b176eb6d.png)

After creating the database successfully you will see a login page as below. Here, you will enter your email id and password _(filled above)_:-

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681210039425/fc3705e3-6127-4143-adfe-d95ee10bad81.png)

After successful login, you will see your Odoo 16 Dashboard. I am using demo data so my dashboard might look different than yours.

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681210486031/17f1e729-95f7-4249-8f33-36199d229e40.png)

You can see in the image above, the very first time you will log in you will see a dashboard listing multiple applications for you to install inside your Odoo 16 database. I installed the _"CRM"_ application on my instance as seen in the above image.

**_Note:-_** _You can create and delete many databases in a single Odoo 16 instance. You can consider a database as a separate company or business._

## **Install NGINX for Setting up Reverse Proxy**

If you are using it for internal use then accessing it through http://IP\_address:Port would also be fine, however, you won't be able to make use of HTTPS leaving your private company data accessible to hackers.

I would recommend you use a domain name (a subdomain would be fine too e.g. erp.your\_domain\_name.com) to use HTTPS and make your Odoo 16 server more secure.

### **Install NGINX Web Server**

For this you will need a Web Server either Apache or NGINX and then make it run your Odoo 16 server behind a proxy. I prefer NGINX. Login to your droplet using SSH and run the following command to install NGINX.

`$ sudo apt -y install nginx`

Once NGINX is installed successfully, open your droplet's IP address in your browser. You will see a page with a message saying, "Welcome to nginx!".

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681212127297/03cabd61-cb20-4a17-8297-61748f3096df.png)

As the droplet being used for this guide will be deleted thus I won't be configuring any domain on it, however, for the instructions below I will use the _"-your-domain-name-"_ placeholder. You can replace it with your real domain name while setting up your production Odoo 16 server.

### **Setup your Odoo 16 Server with NGINX Web Server**

To set up your Odoo 16 server with NGINX you will need to create an NGINX site and then enable it with some configuration.

As you can see in the image below we only have 1 NGINX site enabled `default` that shows the HTML page which says, "Welcome to nginx!".

![](https://cdn.hashnode.com/res/hashnode/image/upload/v1681214610669/7322bb2d-f82e-44de-8455-22365438c60e.png)

Now, create an NGINX site for your Odoo 16 server:-

`$ sudo nano /etc/nginx/sites-enabled/-your-domain-name-.com`

And, paste the following config in it before saving:-

```
upstream odoo16 {
server 127.0.0.1:8069;
}

upstream odoochat {
server 127.0.0.1:8072;
}

server {
listen 80;
server_name -your-domain-name-.com;

access_log /var/log/nginx/odoo.access.log;
error_log /var/log/nginx/odoo.error.log;

proxy_buffers 16 64k;
proxy_buffer_size 128k;

location / {
     proxy_pass http://odoo16;
     proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
     proxy_redirect off;
     proxy_set_header Host $host;
     proxy_set_header X-Real-IP $remote_addr;
     proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
     proxy_set_header X-Forwarded-Proto https;
     }

location /longpolling {
     proxy_pass http://odoochat;
     }

location ~* /web/static/ {
     proxy_cache_valid 200 60m;
     proxy_buffering on;
     expires 864000;
     proxy_pass http://odoo16;
     }
}

```

Save the file and reload your NGINX server:-

`$ sudo systemctl restart nginx`

### **Access your Odoo 16 Server on -your-domain-name-.com**

Voila, now you can access your Odoo 16 server on -your-domain-name-.com and start maintaining your company data.

Remember, the Open Source version (Community Edition) of Odoo doesn't have as many features as the Paid version (Enterprise Edition).

The downside is that Odoo Accounting App doesn't even allow you to maintain Journals and Ledgers in its Open Source version.

I personally prefer [ERPNext](https://blog.chetanmittaldev.com/how-to-easy-install-erpnext-14-on-ubuntu-2204-lts-on-digitalocean-droplet).

If you want to set up HTTPS on your Odoo 16 server running on -your-domain-name-.com then you can follow this article on Digitalocean on [how to configure SSL for NGINX on Ubuntu 22.04 by using Letsencrypt](https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-22-04).

If you seem to find something not working for you then let me know in the comments below.