4 C
Texas

How To Install Odoo 14 with Let’s Encrypt SSL On Ubuntu 20.04

In this tutorial you’ll learn that how to install Odoo 14 on Ubuntu 20.04. Odoo is an open source platform of web based business applications. It provides the facility to manage all the applications from a single console. You can find variety of business applications available on Odoo. These includes Open Source CRM, Website Builder, eCommerce, Warehouse Management, Project Management, Billing & Accounting, Point of Sale, Human Resources, Marketing, Manufacturing, Purchase Management, and many others. Simply follow the below steps to install Odoo 14 On Ubuntu 20.04.

Step 1: Update Your System

First of all, update your system to have the latest packages installed.

sudo apt update && sudo apt upgrade -y

Once the update finished, reboot your system.

- Advertisement -
sudo systemctl reboot

Step 2: Install PostgreSQL On Ubuntu 20.04

As Odoo needs a Database server to store it’s data. I recommend you to choose PostgreSQL for this purpose. So, install the PostgreSQL from the Ubuntu repositories by hitting the below command.

sudo apt install postgresql postgresql-client -y

Make sure that the service has been started successfully.

sabi@Ubuntu20:~$ systemctl status postgresql*
● postgresql.service - PostgreSQL RDBMS
Loaded: loaded (/lib/systemd/system/postgresql.service; enabled; vendor pr>
Active: active (exited) since Mon 2020-11-30 07:03:41 PKT; 45s ago
Main PID: 4072 (code=exited, status=0/SUCCESS)
Tasks: 0 (limit: 2285)
Memory: 0B
CGroup: /system.slice/postgresql.service
نومبر 30 07:03:41 Ubuntu20 systemd[1]: Starting PostgreSQL RDBMS…
نومبر 30 07:03:41 Ubuntu20 systemd[1]: Finished PostgreSQL RDBMS.
● [email protected] - PostgreSQL Cluster 12-main
Loaded: loaded (/lib/systemd/system/[email protected]; enabled-runtime; >
Active: active (running) since Mon 2020-11-30 07:03:51 PKT; 46s ago
Main PID: 4323 (postgres)
Tasks: 7 (limit: 2285)
Memory: 20.1M
CGroup: /system.slice/system-postgresql.slice/[email protected]
├─4323 /usr/lib/postgresql/12/bin/postgres -D /var/lib/postgresql/>
├─4325 postgres: 12/main: checkpointer
├─4326 postgres: 12/main: background writer
├─4327 postgres: 12/main: walwriter
├─4328 postgres: 12/main: autovacuum launcher

Step 3: Install wkhtmltopdf on Ubuntu 20.04

Make sure to install wkhtmltopdf for the purpose of printing of documents. To install wkhtmltopdf, follow the below guide as the default version available on Ubuntu does not support. So, follow the below guide to install it on your system.

How To Install wkhtmltopdf On Ubuntu 20.04

Step 4: Install Odoo 14 On Ubuntu 20.04

To install Odoo 14 on Ubuntu 20.04, add the Odoo repository by typing the below commands.

wget -O - https://nightly.odoo.com/odoo.key | sudo apt-key add -
echo "deb http://nightly.odoo.com/14.0/nightly/deb/ ./" | sudo tee /etc/apt/sources.list.d/odoo.list

Once added, run the update command, and then install Odoo 14.

sudo apt update
sudo apt install odoo

Press “Y” when prompted to continue the installation process.

python-xlrt-doc
The following NEW packages will be installed:
docutils-common fonts-font-awesome fonts-inconsolata fonts-roboto-unhinted
graphviz javascript-common libann0 libcdt5 libcgraph6 libgts-0.7-5
libgts-bin libgvc6 libgvpr2 libjs-jquery libjs-underscore liblab-gamut1
libpathplan4 libsass1 odoo python-babel-localedata python3-aiohttp
python3-appdirs python3-async-timeout python3-attr python3-babel python3-bs4
python3-cached-property python3-decorator python3-defusedxml
python3-distutils python3-docutils python3-feedparser python3-freezegun
python3-gevent python3-greenlet python3-html2text python3-html5lib
python3-isodate python3-jinja2 python3-ldap python3-lib2to3 python3-libsass
python3-lxml python3-mako python3-markupsafe python3-mock python3-multidict
python3-ofxparse python3-openssl python3-passlib python3-pbr python3-polib
python3-psutil python3-psycopg2 python3-pyasn1 python3-pyasn1-modules
python3-pydot python3-pygments python3-pyinotify python3-pyparsing
python3-pypdf2 python3-qrcode python3-requests-toolbelt python3-roman
python3-serial python3-setuptools python3-soupsieve python3-stdnum
python3-suds python3-usb python3-vobject python3-webencodings
python3-werkzeug python3-xlrd python3-xlsxwriter python3-xlwt python3-yarl
python3-zeep
0 upgraded, 78 newly installed, 0 to remove and 0 not upgraded.
Need to get 85.3 MB of archives.
After this operation, 681 MB of additional disk space will be used.
Do you want to continue? [Y/n]Y

Verify the status of Odoo 14 with the help of below command.

systemctl status odoo
How To Install Odoo 14 with Let's Encrypt SSL On Ubuntu 20.04

To start the Odoo on system boot, type

sudo systemctl enable --now odoo

Odoo service is started on 8069 port. You can verify by the below command.

ss -tunelp | grep 8069

Step 5: Configure Nginx Proxy for Odoo 14

Make sure you’ve installed nginx on your system. If not installed, run the given command to install it.

sudo apt -y install nginx

Here we’ll see two different methods to configure Nginx.

  • Configure Nginx HTTP Proxy For Odoo
  • Configure Nginx Using Let’s Encrypt SSL Certificate for Odoo

Step 6: Configure Nginx HTTP Proxy For Odoo

Run the below command to create a new config file for Odoo.

sudo nano /etc/nginx/conf.d/odoo.conf

Modify the below data to fit your setup.

# Odoo Upstreams
upstream odooserver {
server 127.0.0.1:8069;
}

server {
listen 80;
server_name erp.osradar.com;
access_log /var/log/nginx/odoo_access.log;
error_log /var/log/nginx/odoo_error.log;

# Proxy settings
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
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;

# Request for root domain
location / {
proxy_redirect off;
proxy_pass http://odooserver;
}

# Cache static files
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://odooserver;
}

# Gzip
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
}

Note: Replace erp.osradar.com with your own service domain.

And verify the config syntax.

sabi@Ubuntu20:~$ sudo nginx -t
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

If everything ok, simply restart nginx services.

sudo systemctl restart nginx

You’ll face no error on restart if all settings are ok.

Step 7: Configure Nginx Using Let’s Encrypt SSL Certificate for Odoo

As for security reasons, it is recommended to use SSL certificate for production deployments. Let’s Encrypt provides free SSL that can be used in order to enhance security.

To obtain Let’s Encrypt SSL certificate for your domain, type

wget https://dl.eff.org/certbot-auto
chmod +x certbot-auto
sudo mv certbot-auto /usr/local/bin/certbot-auto
sudo systemctl stop nginx

export DOMAIN="erp.osradar.com"
export EMAIL="[email protected]"
sudo /usr/local/bin/certbot-auto certonly --standalone -d ${DOMAIN} --preferred-challenges http --agree-tos -n -m ${EMAIL} --keep-until-expiring

You’ll see the similar output.

IMPORTANT NOTES:
Congratulations! Your certificate and chain have been saved at:
/etc/letsencrypt/live/erp.osradar.com/fullchain.pem
Your key file has been saved at:
/etc/letsencrypt/live/erp.osradar.com/privkey.pem
Your cert will expire on 2020-01-17. To obtain a new or tweaked
version of this certificate in the future, simply run certbot-auto
again. To non-interactively renew all of your certificates, run
"certbot-auto renew"
Your account credentials have been saved in your Certbot
configuration directory at /etc/letsencrypt. You should make a
secure backup of this folder now. This configuration directory will
also contain certificates and private keys obtained by Certbot so
making regular backups of this folder is ideal.
If you like Certbot, please consider supporting our work by:
Donating to ISRG / Let's Encrypt: https://letsencrypt.org/donate
Donating to EFF: https://eff.org/donate-le

Now, add a cron job to renew certificate.

15 3 * * * /usr/local/bin/certbot-auto renew --pre-hook "systemctl stop nginx" --post-hook "systemctl start nginx"

Then create Nginx configuration file.

sudo nano /etc/nginx/conf.d/odoo.conf

Modify the given data to fit your setup.

# Odoo Upstreams
upstream odooserver {
server 127.0.0.1:8069;
}

# http to https redirection
server {
listen 80;
server_name erp.osradar.com;
return 301 https://erp.osradar.com$request_uri;
}
server {
listen 443 ssl;
server_name erp.osradar.com;
access_log /var/log/nginx/odoo_access.log;
error_log /var/log/nginx/odoo_error.log;

# SSL
ssl_certificate /etc/letsencrypt/live/erp.osradar.com/fullchain.pem;
ssl_certificate_key /etc/letsencrypt/live/erp.osradar.com/privkey.pem;
ssl_trusted_certificate /etc/letsencrypt/live/erp.osradar.com/chain.pem;

# Proxy settings
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
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;

# Request for root domain
location / {
proxy_redirect off;
proxy_pass http://odooserver;
}

# Cache static files
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://odooserver;
}

# Gzip Compression
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
}

Note: Make sure to replace erp.osradar.com with your own domain.

Then, restart Nginx

sudo systemctl restart nginx

Step 8: Access Odoo Web Interface On Ubuntu 20.04

Acess the Odoo Web Page on your domain name from a web browser by typing your IP or domain name with port 8069.

How To Install Odoo 14 with Let's Encrypt SSL On Ubuntu 20.04

Provide the mentioned details to create database. After you click “Create Database”, you’ll be directed to the Admin page. On that page you can easily install Odoo business applications.

How To Install Odoo 14 with Let's Encrypt SSL On Ubuntu 20.04

So, this is how you can install Odoo 14 on Ubuntu 20.04

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article