Introduction
Odoo is a suite of business management software tools including, for example, CRM, e-commerce, billing, accounting, manufacturing, warehouse, project management, and inventory management. The Community version is a libre software, licensed under the GNU LGPLv3. The Enterprise version has proprietary extra features and services. The source code for the framework and core ERP modules is curated by the Belgium-based Odoo S.A. Odoo is available for both on-premise and ready to use SaaS environment.
Update the server
First, update the server before we start with the Odoo installation:
apt-get update && apt-get upgrade
Install PostgreSQL
Odoo requires PostgreSQL. To install it, run this command:
apt-get install postgresql
Install Odoo
We’ll be using the nightly packaged installer for Odoo. Run the following commands:
root@unixcop:~# wget -O - https://nightly.odoo.com/odoo.key | apt-key add -
--2021-09-05 08:17:43-- https://nightly.odoo.com/odoo.key
Resolving nightly.odoo.com (nightly.odoo.com)... 178.33.123.40
Connecting to nightly.odoo.com (nightly.odoo.com)|178.33.123.40|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 3112 (3.0K) [application/octet-stream]
Saving to: ‘STDOUT’
- 100%[=======================================================================>] 3.04K --.-KB/s in 0s
2021-09-05 08:17:49 (206 MB/s) - written to stdout [3112/3112]
OK
root@unixcop:~#
Then run this command:
echo "deb http://nightly.odoo.com/14.0/nightly/deb/ ./" >> /etc/apt/sources.list.d/odoo.list
This adds the repository.
Then install the community edition of Odoo with all its dependencies with the following command:
apt-get install odoo
Start Odoo
Odoo may already be running. You can check the status with the following command:
root@unixcop:~# systemctl status odoo
● odoo.service - Odoo Open Source ERP and CRM
Loaded: loaded (/lib/systemd/system/odoo.service; enabled; vendor preset: enabled)
Active: active (running) since Sun 2021-09-05 08:32:49 PDT; 1min 45s ago
Main PID: 12345 (odoo)
Tasks: 4 (limit: 2281)
Memory: 77.8M
CGroup: /system.slice/odoo.service
└─12345 /usr/bin/python3 /usr/bin/odoo --config /etc/odoo/odoo.conf --logfile /var/log/odoo/odoo-server.log
Sep 05 08:32:49 unixcop systemd[1]: Started Odoo Open Source ERP and CRM.
root@unixcop:~#
If it’s not running, you can start it with :
systemctl start odoo
Then enable Odoo to start at boot, run this command:
systemctl enable odoo
Access Odoo
Visit your server’s IP address within port 8069. which is the default port for Odoo.
http://your_servers_ip:8069
Also fill out the details required. This step creates a database and you can optionally fill it up with demo data.
After that you can start using Odoo and installing apps.
NOTE:
If you want to use a domain name instead of your server’s IP address and the default port of Odoo , you need to set up a reverse proxy. here we can use nginx as a reverse proxy for Odoo.
Install Nginx as a reverse proxy (Optional step)
First, install nginx with command:
apt-get install nginx -y
Then, start the nginx service with:
systemctl start nginx
systemctl enable nginx
Then edit the Odoo configuration file
vim /etc/odoo/odoo.conf
And change proxy_mode from False to True as following:
proxy_mode = True
Also create an Nginx config file for Odoo:
vim /etc/nginx/conf.d/odoo.conf
Then add the following:
upstream odoo {
server 127.0.0.1:8069;
}
server {
listen 80;
server_name odoo.unixcop.com;
root /usr/share/nginx/html;
index index.html index.htm;
access_log /var/log/nginx/odoo-odoo.unixcop.com-local.access.log;
error_log /var/log/nginx/odoo-odoo.unixcop.com-local.error.log;
location / {
proxy_pass http://odoo;
# force timeouts if the backend dies
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
# set headers
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;
}
# cache some static data in memory for 60mins
location ~* /web/static/ {
proxy_cache_valid 200 60m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo;
}
}
Restart Nginx and start using your domain:
systemctl restart nginx
In our case, you can use your domain to access odoo
visit http://odoo.unixcop.com as shown below:
Conclusion
In this tutorial We showed you how to install Odoo 14 on an Ubuntu server with and without Nginx as a reverse proxy.