How to Install Odoo 15 on Ubuntu 20.04

how to install Odoo 15 on Ubuntu 20.04

Odoo formerly known as OpenERP is an open-source and all-in-one ERP and CRM business application. It is designed for businesses and individuals who want to manage their customers, invoices, orders, products, inventories, sales, projects and more. It is written in the Python programming language and used by thousands of businesses worldwide to manage their CRM and ERP processes. It also provides human resources and accounting add-ons to manage the business employees and finances.

In this guide, we will show you how to install Odoo 15 on Ubuntu 20.04.

Prerequisites

  • An Ubuntu 20.04 (we’ll be using our SSD 2 VPS plan)
  • Access to the root user account (or access to an admin account with root privileges)

Log in and Update the Server:

Log in to your Ubuntu 20.04 VPS via SSH as user root (You can use a superuser account if the root is not available. Our VPSes come with root access included):

ssh root@IP_Address -p Port_number

Don’t forget to replace ‘IP_Address’ and ‘Port_number’ with the actual IP address of your server and the SSH service port. The default SSH port is 22.

Run the following commands to make sure that all installed packages on your Ubuntu 20.04 VPS are updated to their latest available versions:

apt-get update -y && apt-get upgrade -y

Install Necessary Dependencies

Next, you will need to install all necessary dependencies including, Node,js and Python in your server. Run the following command to install all the dependencies:

apt-get install python3-pip python-dev python3-dev libxml2-dev libpq-dev libjpeg8-dev liblcms2-dev libxslt1-dev zlib1g-dev libsasl2-dev libldap2-dev build-essential git libssl-dev libffi-dev libmysqlclient-dev libjpeg-dev libblas-dev libatlas-base-dev -y

Next, install the Node.js and NPM using the following command:

apt-get install npm
npm install -g less less-plugin-clean-css
apt-get install node-less

Next, download and install the wkhtmltopdf package by running the following command:

wget https://github.com/wkhtmltopdf/packaging/releases/download/0.12.6-1/wkhtmltox_0.12.6-1.bionic_amd64.deb
dpkg -i wkhtmltox_0.12.6-1.bionic_amd64.deb
apt-get install -f

Install PostgreSQL

Odoo uses PostgreSQL as a database backend. So you will need to install the PostgreSQL to your server. Run the following command to install the PostgreSQL server.

apt-get install postgresql -y

Once the PostgreSQL is installed, log in to PostgreSQL and create an Odoo user with the following command:

su - postgres
createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt odoo15
psql
ALTER USER odoo15 WITH SUPERUSER;

Next, exit from the PostgreSQL with the following command:

\q
exit

Install and Configure Odoo 15

First, create an Odoo user with the following command:

useradd -m -d /opt/odoo15 -U -r -s /bin/bash odoo15

Next, switch the user to Odoo 15 and download the Odoo 15 from the Git repository:

su - odoo15
git clone https://www.github.com/odoo/odoo --depth 1 --branch 15.0 /opt/odoo15/odoo

Next, exit from the Odoo 15 user and install all required Python dependencies using the following command:

exit
pip3 install -r /opt/odoo15/odoo/requirements.txt

Next, copy the Odoo 15 sample configuration file to the /etc directory:

cp /opt/odoo15/odoo/debian/odoo.conf /etc/odoo.conf

Next, edit the Odoo 15 configuration file using your favourite editor:

nano /etc/odoo.conf

Change the following lines:

[options]
   ; This is the password that allows database operations:
   admin_passwd = masterpassword
   db_host = False
   db_port = False
   db_user = odoo15
   db_password = False
   xmlrpc_interface = 127.0.0.1
   proxy_mode = True
   addons_path = /opt/odoo15/odoo/addons
   logfile = /var/log/odoo/odoo.log

Save and close the file then set proper ownership to the Odoo 15 configuration file.

chown odoo15: /etc/odoo.conf

Next, create a log directory for Odoo 15 and set proper ownership:

mkdir /var/log/odoo
chown odoo15:root /var/log/odoo

Create a Systemd Service File for Odoo 15

Next, you will need to create a systemd service file to manage the Odoo 15 service. You can create it using the following command:

nano /etc/systemd/system/odoo15.service

Add the following lines:

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

Save and close the file then reload the systemd daemon to apply the changes:

systemctl daemon-reload

Next, start and enable the Odoo 15 service:

systemctl start odoo15
systemctl enable odoo15

To verify the status of the Odoo 15 service, run the following command:

systemctl status odoo15

Output:

● odoo15.service - Odoo
     Loaded: loaded (/etc/systemd/system/odoo15.service; disabled; vendor preset: enabled)
     Active: active (running) since Mon 2021-10-11 10:35:36 UTC; 5s ago
       Docs: http://www.odoo.com
   Main PID: 21021 (python3)
      Tasks: 4 (limit: 4691)
     Memory: 66.9M
     CGroup: /system.slice/odoo15.service
             └─21021 python3 /opt/odoo15/odoo/odoo-bin -c /etc/odoo.conf
Oct 11 10:35:36 ubuntu2004 systemd[1]: Started Odoo.

Configure Nginx as a Reverse Proxy for Odoo 15

It is always a good idea to configure Nginx as a reverse proxy for Odoo. First, install the Nginx package using the following command:

apt-get install nginx -y

Next, create an Nginx virtual host configuration file:

nano /etc/nginx/conf.d/odoo15.conf

Add the following configuration:

upstream odoo {
 server 127.0.0.1:8069;
}
upstream odoochat {
 server 127.0.0.1:8072;
}
server {
 listen 80;
 server_name odoo15.example.com;
 proxy_read_timeout 720s;
 proxy_connect_timeout 720s;
 proxy_send_timeout 720s;
 # Add Headers for odoo proxy mode
 proxy_set_header X-Forwarded-Host $host;
 proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
 proxy_set_header X-Forwarded-Proto $scheme;
 proxy_set_header X-Real-IP $remote_addr;
 # log
 access_log /var/log/nginx/odoo.access.log;
 error_log /var/log/nginx/odoo.error.log;
 # Redirect longpoll requests to odoo longpolling port
 location /longpolling {
 proxy_pass http://odoochat;
 }
 # Redirect requests to odoo backend server
 location / {
   proxy_redirect off;
   proxy_pass http://odoo;
 }
 # common gzip
 gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
 gzip on;
}

Save and close the file then restart the Nginx to apply the changes:

systemctl restart nginx

Access the Odoo 15 Instance

Now when you know that the fresh Odoo installation is active and running on the server, you can access it using the URL http://odoo15.example.com. If the installation has been successfully completed, you will be able to see the Odoo screen as shown below and create your first database:

From here, you simply enter your master password and fill out the fields with the information that you need for your use case. Then, click on the Create database button. You should see the Odoo15 dashboard:

Of course, you don’t have to install Odoo 15 on Ubuntu 20.04 if you use one of our Odoo VPS Hosting services, in which case you can simply ask our expert Linux admins to install and configure Odoo 15 on Ubuntu 20.04 for you. They are available 24×7 and will take care of your request immediately.

PS. If you liked this post on how to install Odoo 15 on Ubuntu 20.04, please share it with your friends on the social networks using the buttons below or simply leave a reply. Thank you.

Leave a Comment

To prove you are human please solve the following *