Linux Tactic

Mastering Odoo 13: Installation Configuration and Optimization

Odoo is an open-source software suite that allows businesses to manage their operations from various departments, including finance, sales, manufacturing, and more. With its user-friendly interface, customization options, and real-time data analysis, Odoo has become a popular choice for businesses worldwide.

However, installing and configuring Odoo 13 can be a daunting task, especially for those unfamiliar with the technical aspects. In this article, well guide you through the process step-by-step, starting with creating a system user and ending with testing the installation.

Well also cover configuring Nginx as an SSL termination proxy, which is essential for securing your Odoo site.

1) Installation of Odoo 13

Creating a System User

One of the first steps to installing Odoo 13 is creating a system user. This user will be responsible for running the Odoo 13 process, which ensures that your system remains secure.

To create the system user, use the following command on your terminal:

sudo adduser –system –home=/opt/odoo13 –group odoo13

The above command creates a user named odoo13 with a home directory of /opt/odoo13 and a group named odoo13. After creating the user, you should add the new user to the sudoers group:

sudo usermod -aG sudo odoo13

Installing and Configuring PostgreSQL

PostgreSQL is a popular open-source database back-end used in Odoo to store data. Its important to ensure that you have PostgreSQL installed and configured correctly before proceeding with the installation.

To install PostgreSQL, run the following command in your terminal:

sudo apt-get install postgresql

Once installed, youll need to create a new PostgreSQL user and database for Odoo. Use the following commands to create a new user named odoo13 and a new database named odoo13db:

sudo su – postgres

createuser –createdb –username postgres –no-createrole –no-superuser –pwprompt odoo13

createdb –encoding=unicode –username=postgres –owner=odoo13 odoo13db

Installing Wkhtmltopdf

Odoo 13 generates PDF reports using Wkhtmltopdf. Therefore, its essential to install and configure it correctly to avoid errors when trying to generate PDF reports.

Use the following commands to install Wkhtmltopdf:

sudo apt-get install wkhtmltopdf

To confirm that Wkhtmltopdf was installed correctly, type the following in the terminal:

wkhtmltopdf -V

If the installation was successful, you should see the version number of Wkhtmltopdf displayed.

Installing and Configuring Odoo 13

To install Odoo 13, youll need to set up a Python virtual environment and clone the Odoo repository from GitHub. Use the following commands:

sudo apt-get install git python3-pip build-essential libxml2-dev libxslt1-dev libzip-dev libldap2-dev libsasl2-dev libssl-dev

sudo pip3 install virtualenv

sudo mkdir /opt/odoo13

sudo virtualenv /opt/odoo13/venv

sudo chown -R odoo13:odoo13 /opt/odoo13/

Next, activate the virtual environment and clone the Odoo repository from GitHub:

sudo su – odoo13

source /opt/odoo13/venv/bin/activate

git clone https://www.github.com/odoo/odoo –depth 1 –branch 13.0 /opt/odoo13/odoo

After cloning the repository, you should install the Odoo dependencies by running the following command:

pip3 install -r /opt/odoo13/odoo/requirements.txt

Creating a Systemd Unit File

A systemd unit file will ensure that the Odoo service starts automatically when the system boots up. To create the unit file, use the following command:

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

After creating the file, enter the following configuration:

[Unit]

Description=Odoo13

Requires=postgresql.service

After=network.target postgresql.service

[Service]

Type=simple

SyslogIdentifier=odoo13

PermissionsStartOnly=true

User=odoo13

Group=odoo13

ExecStart=/opt/odoo13/venv/bin/python3 /opt/odoo13/odoo/odoo-bin -c /etc/odoo13.conf

StandardOutput=journal+console

[Install]

WantedBy=multi-user.target

Save the file by pressing Ctrl + X, then Y, and finally Enter.

Next, enable the service by running the following command:

sudo systemctl enable odoo13

Testing the Installation

After completing all the installation and configuration steps, you can test the installation by running your Odoo service and accessing it through a web browser. To start the service, use the following command:

sudo systemctl start odoo13

If the installation was successful, you should be able to access Odoo 13 by opening a web browser and typing in your servers IP address followed by port 8069 (http://:8069) into the browsers address bar.

2) Configuring Nginx as SSL Termination Proxy

SSL termination proxy is essential for securing your Odoo site using SSL encryption/decryption (HTTPS). Heres how to configure Nginx as an SSL termination proxy:

Prerequisites

Before proceeding with the configuration, you should ensure that you have the latest versions of Nginx and Odoo installed on your server.

Nginx

Configuration

To configure Nginx as an SSL termination proxy for Odoo, youll need to modify the Nginx configuration file (/etc/nginx/nginx.conf). Use the following command to open the file in a text editor:

sudo nano /etc/nginx/nginx.conf

Add the following lines to the http section of the file:

upstream odoo {

server 127.0.0.1:8069;

}

server {

listen 80;

server_name your-domain-name.com;

location / {

rewrite ^(.*) https://$host$1 permanent;

}

}

server {

listen 443 ssl;

server_name your-domain-name.com;

add_header Strict-Transport-Security “max-age=15768000; includeSubDomains; preload;”;

ssl_certificate /path/to/your/certificate;

ssl_certificate_key /path/to/your/private.key;

ssl_session_timeout 5m;

ssl_protocols TLSv1.2 TLSv1.3;

ssl_ciphers “ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES256-GCM-SHA384:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-CHACHA20-POLY1305:ECDHE-RSA-CHACHA20-POLY1305:DHE-RSA-AES128-GCM-SHA256:DHE-RSA-AES256-GCM-SHA384”;

ssl_prefer_server_ciphers on;

proxy_buffers 16 64k;

proxy_buffer_size 128k;

location / {

proxy_pass http://odoo;

proxy_set_header X-Forwarded-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 $scheme;

}

}

Save the file, then verify the syntax of the configuration file by running the following command:

sudo nginx -t

If there are no errors, restart Nginx:

sudo systemctl restart nginx

Odoo

Configuration

To configure Odoo to use your SSL termination proxy, update your Odoo configuration file (/etc/odoo13.conf) with the following configuration:

;proxy_mode = True

;proxy_db = False

;proxy_mode_forwarded_for = True

;proxy_forwarded_for_header = X-Forwarded-For

Remove the semicolon (;) from the beginning of the proxy_mode line to uncomment the setting. Save the changes and restart the Odoo service:

sudo systemctl restart odoo13

Conclusion

Following the steps outlined in this article will ensure that you install and configure Odoo 13 correctly, as well as configure Nginx as an SSL termination proxy for added security. Remember to perform regular maintenance on your system, including updating to the latest versions of software and securing your server to protect your data.

3) Changing the Binding Interface

By default, Odoo 13 listens on port 8069 and allows direct access to the instance. It is good security practice to disable direct access to the Odoo instance and instead allow access only through a reverse proxy or VPN.

This can be achieved by changing the binding interface on which Odoo listens for connections. In this section, well cover how to change the binding interface for Odoo 13.

Disabling Direct Access to Odoo Instance

To disable direct access to the Odoo instance, you need to modify the Odoo configuration file (/etc/odoo13.conf). Open the file in a text editor:

sudo nano /etc/odoo13.conf

Add the following lines at the end of the file:

xmlrpc_interface = 127.0.0.1

netrpc_interface = 127.0.0.1

The above lines set the XML-RPC and NET-RPC interfaces to listen only on the local loopback address (127.0.0.1) and not on any publicly accessible IP addresses.

Save the file and restart the Odoo service:

sudo systemctl restart odoo13

Now, the Odoo instance can only be accessed through a reverse proxy or VPN that forwards the necessary requests to the local loopback address.

Configuration

If you want to allow access to the Odoo instance over a specific IP address or subnet, you can change the binding interface accordingly. For example, to allow access over the IP address 192.168.0.100, you would modify the configuration file as follows:

xmlrpc_interface = 192.168.0.100

netrpc_interface = 192.168.0.100

Replace 192.168.0.100 with your preferred IP address or subnet.

4) Enabling Multiprocessing

Multiprocessing in Odoo 13 allows multiple workers to handle requests and processes simultaneously. Enabling multiprocessing can significantly improve the performance of your Odoo instance, especially when handling heavy traffic.

Calculation for Number of Workers and RAM Memory Consumption

Before enabling multiprocessing, its important to calculate how many workers your system can handle and the amount of RAM memory required for each worker. To calculate the number of workers, use the following formula:

number of workers = (2 x number of CPU cores) + 1

For RAM memory per worker, use the following formula:

RAM memory per worker = (total RAM / number of workers)

To determine the amount of total RAM on your system, run the following command:

sudo free -m

This will display the total amount of RAM on your system in megabytes.

Configuration

To enable multiprocessing in Odoo 13, open the Odoo configuration file (/etc/odoo13.conf) in a text editor:

sudo nano /etc/odoo13.conf

Add the following lines at the end of the file:

workers = 3

limit_memory_hard = 268435456

limit_memory_soft = 214748364

The above lines configure your Odoo instance to use 3 workers, with a hard memory limit of 256 MB per worker and a soft memory limit of 2048 MB per worker. Adjust these values according to your system specifications and the calculations you performed earlier.

Save the file and restart the Odoo service:

sudo systemctl restart odoo13

Enabling multiprocessing should significantly improve the performance of your Odoo instance and enable it to handle heavier traffic loads. If you notice any performance issues, you can adjust the number of workers and memory limits accordingly.

Conclusion

Changing the binding interface and enabling multiprocessing are essential configurations to improve the security and performance of your Odoo 13 instance. Use the guidelines provided in this article to make these changes and optimize your system to handle heavy traffic loads.

Remember to perform regular maintenance on your Odoo installation to ensure that its secure, up-to-date, and performing optimally. 5)

Conclusion

In this article, weve covered various configurations for installing and optimizing Odoo 13, including creating a system user, installing and configuring PostgreSQL, Wkhtmltopdf, and Odoo itself, and enabling multiprocessing.

Weve also covered how to configure Nginx as an SSL termination proxy and how to change the binding interface to improve security.

Summary of the Installation Process

To summarize the installation process, we first created a system user to run the Odoo 13 process and added it to the sudoers group. We then installed and configured PostgreSQL, created a new user and database for Odoo, and installed Wkhtmltopdf to enable PDF report generation.

Next, we set up a Python virtual environment and cloned the Odoo repository from GitHub, installed all the necessary dependencies, and created a systemd unit file to ensure that the Odoo service starts automatically on system boot. Finally, we tested the installation to ensure that everything was working as expected.

We also covered how to configure Nginx as an SSL termination proxy to secure your Odoo site and how to change the binding interface to prevent direct access to your Odoo instance. Enabling multiprocessing is another aspect of optimizing your Odoo instance.

By determining the number of workers your system can handle and the amount of RAM memory required per worker, you can significantly improve the performance of your Odoo instance and enable it to handle heavier traffic loads. In conclusion, following the guidelines provided in this article will ensure that you install and configure Odoo 13 correctly and optimize it for peak performance.

Remember to perform regular maintenance on your Odoo installation to ensure that its secure, up-to-date, and performing optimally. In conclusion, this article has provided a comprehensive guide to installing and configuring Odoo 13, including creating a system user, setting up PostgreSQL, installing Wkhtmltopdf, and configuring Nginx as an SSL termination proxy.

Additionally, we explored the importance of enabling multiprocessing for optimal performance. By following these steps, businesses can effectively implement and secure their Odoo 13 instance while enhancing its functionality.

Remember to regularly update and maintain your installation to ensure maximum security and efficiency. With this knowledge, you are equipped to leverage the power of Odoo 13 for streamlined operations and improved business outcomes.

Popular Posts