Linux Tactic

Streamline Your Business with Odoo 14: Installation Configuration and Nginx Set-Up

Installation and Configuration of Odoo 14

Odoo 14 is a robust ERP software that provides businesses with everything they need to manage their operations effectively. However, before you can use it, you need to install and configure it properly.

In this article, we will take you through the process of installing and configuring Odoo 14 on your system, step-by-step. 1.

Installing Prerequisites

The first step in installing Odoo 14 is to ensure that you have all the necessary prerequisites. You will need Python 3, PostgreSQL, Git, and GCC installed on your system.

These are essential components for running Odoo 14. To install these prerequisites, you will need to execute the following commands in your terminal:

sudo apt-get update

sudo apt-get install python3 git gcc postgresql -y

2. Creating a System User

For security reasons, it is essential to create a separate system user to run Odoo 14.

This user will act as a security boundary, and it will limit the amount of damage that an attacker can do if they compromise your system. To create a system user, execute the following command in your terminal:

sudo useradd -m -s /bin/bash -d /opt/odoo -U odoo

3.

Installing and Configuring PostgreSQL

Odoo 14 uses PostgreSQL as its database back-end. Therefore, you must install and configure it properly to ensure that it works seamlessly with Odoo.

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

sudo apt-get install postgresql -y

Once installed, you will need to configure PostgreSQL to create a user for Odoo. Execute the following command in your terminal to create a PostgreSQL user:

sudo su postgres -c “createuser -s odoo”

4.

Installing Wkhtmltopdf

Odoo 14 uses Wkhtmltopdf to generate PDF reports. Therefore, you must install it on your system.

To do this, execute the following command in your terminal:

sudo apt-get install wkhtmltopdf -y

Odoo requires a specific version of wkhtmltopdf. So, you need to download and install it from their website.

Navigate to the wkhtmltopdf website and download the appropriate package for your system. Extract the package and move the binary to the /usr/local/bin directory.

sudo mv wkhtmltopdf /usr/local/bin/

5. Installing and Configuring Odoo 14

Now that you have installed all the prerequisites, you can proceed to install and configure Odoo 14.

First, create a virtual environment for Odoo by executing the following command in your terminal:

sudo su – odoo

cd ~

git clone https://www.github.com/odoo/odoo –depth 1 –branch 14.0 –single-branch odoo-dev

cd odoo-dev

python3 -m venv ./venv

source ./venv/bin/activate

Next, install the required Python modules by executing the following command:

pip3 install wheel

pip3 install -r requirements.txt

Then, apply the necessary configuration changes by executing the following command:

chmod +x odoo-bin

./odoo-bin

6. Creating Systemd Unit File

To make Odoo 14 run automatically at system startup, you need to create a systemd unit file.

To create the unit file, execute the following command:

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

Copy and paste the following configuration into the file. [Unit]

Description=Odoo service

Requires=postgresql.service

After=network.target postgresql.service

[Service]

Type=simple

SyslogIdentifier=odoo

PermissionsStartOnly=true

User=odoo

Group=odoo

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

StandardOutput=journal+console

[Install]

WantedBy=multi-user.target

Save the file and then execute the following commands to reload systemd and start the Odoo service:

sudo systemctl daemon-reload

sudo systemctl start odoo.service

7. Test the Installation

To ensure that the installation was successful, open your web browser, and navigate to your server’s IP address with port 8069 appended to the end.

For example, http://your_server_ip:8069. If the installation was successful, you should see the Odoo 14 login screen.

Configuring Nginx as SSL Termination Proxy

Another crucial aspect of running Odoo 14 is configuring Nginx as an SSL termination proxy. This will allow you to secure web traffic to your Odoo server, protecting it from malicious attacks.

Here’s how you can configure Nginx as an SSL termination proxy. 1.

SSL Termination Proxy

A secure website’s essential component is SSL encryption. However, implementing SSL on a server that does not have the necessary tools can be challenging.

An SSL termination proxy acts as a bridge between the client browser and web server, allowing the server to provide SSL encryption regardless of whether it supports it. 2.

Configuring Nginx

To configure Nginx, install it using the following command:

sudo apt-get install nginx -y

Next, create an Nginx configuration file for your Odoo server. sudo nano /etc/nginx/sites-available/odoo

Copy and paste the following configuration into the odoo file:

upstream odoo {

server 127.0.0.1:8069;

}

server {

listen 80;

server_name your_server_name;

add_header Strict-Transport-Security max-age=15768000;

proxy_read_timeout 720s;

proxy_connect_timeout 720s;

proxy_send_timeout 720s;

keepalive_timeout 300s;

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

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

# Redirect HTTP requests to HTTPS

if ($scheme = http) {

return 301 https://$server_name$request_uri;

}

location / {

proxy_pass http://odoo;

proxy_redirect off;

proxy_buffering off;

proxy_set_header X-Real-IP $remote_addr;

proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;

proxy_set_header Host $http_host;

proxy_set_header X-NginX-Proxy true;

proxy_ssl_session_reuse off;

proxy_set_header X-Forwarded-Proto $scheme;

proxy_set_header X-Frame-Options SAMEORIGIN;

proxy_set_header X-Content-Type-Options nosniff;

proxy_set_header X-XSS-Protection “1; mode=block”;

}

}

Save the file and then activate the configuration by creating a symbolic link to the sites-enabled directory.

sudo ln -s /etc/nginx/sites-available/odoo /etc/nginx/sites-enabled/odoo

Next, delete the default Nginx configuration file to ensure that it does not conflict with your new configuration. sudo rm -f /etc/nginx/sites-enabled/default

sudo rm -f /etc/nginx/sites-available/default

Finally, restart Nginx to apply the changes.

sudo systemctl restart nginx.service

3. Changing the Binding Interface

To ensure the security of your Odoo server, you should bind it to the localhost (127.0.0.1) interface.

To make this change, execute the following command in your Odoo configuration file:

sudo nano /etc/odoo.conf

Find the line that starts with “xmlrpc_interface” and change it to:

xmlrpc_interface = 127.0.0.1

Save the file and restart Odoo to apply the changes. sudo systemctl restart odoo.service

4.

Enabling Multiprocessing

Multiprocessing is essential for the stability of your Odoo server. It allows your server to handle multiple requests simultaneously, ensuring that your customers do not experience downtime.

To enable multiprocessing, execute the following command in your Odoo configuration file:

sudo nano /etc/odoo.conf

Find the following lines and change them to:

workers = auto

max_cron_threads = 2

limit_time_real = 3600

limit_time_cpu = 6000

Save the file and restart Odoo to apply the changes. sudo systemctl restart odoo.service

Conclusion

In conclusion, installing and configuring Odoo 14 is a relatively easy process. However, it requires attention to detail to ensure that it works correctly.

Similarly, configuring Nginx to act as an SSL termination proxy is essential to secure your Odoo server. By following the steps outlined in this article, you should be able to install and configure Odoo 14 and configure Nginx as an SSL termination proxy with ease.

In our previous article, we discussed the installation and configuration of Odoo 14 and how to configure Nginx as an SSL termination proxy. In this article, we will expand on those topics, covering the key details in-depth.

We will also discuss multiprocessing and production environments, which are essential components of running Odoo 14.

Installation of Odoo 14 on CentOS 8

Odoo 14 is an open-source business management software that provides businesses with numerous functionalities such as accounting, inventory, and sales management. To install Odoo 14 on CentOS 8, you need to follow the steps outlined below:

1.

Update your system. To update your CentOS 8 system, execute the command:

sudo dnf update -y

2.

Install Odoo 14 prerequisites. Odoo requires the installation of various prerequisites before installation.

To install them, execute the command:

sudo dnf install git gcc redhat-rpm-config python3-devel nodejs-less python3-mod_wsgi libxslt-devel bzip2-devel openldap-devel -y

3. Create a virtual environment for Odoo.

To create a virtual environment for Odoo, execute the following command:

sudo mkdir /opt/odoo/

sudo useradd -m -r -d /opt/odoo -U -s /usr/bin/bash odoo

sudo su – odoo -c “python -m venv /opt/odoo/venv”

4. Activate the virtual environment.

To activate the virtual environment, execute the following command:

source /opt/odoo/venv/bin/activate

5. Install Odoo 14.

To install Odoo 14, execute the following commands:

cd /opt/odoo

git clone https://github.com/odoo/odoo.git -b 14.0 –depth=1

pip3 install setuptools wheel

pip3 install -r odoo/requirements.txt

6. Start Odoo 14.

To start Odoo 14, execute the following command:

/opt/odoo/venv/bin/python3 /opt/odoo/odoo/odoo-bin

Nginx as Reverse Proxy

Nginx is one of the most popular web servers and a reliable reverse proxy. In this section, we will discuss how to configure Nginx as a reverse proxy for Odoo 14.

1. Install Nginx.

To install Nginx, execute the following command:

sudo yum install nginx -y

2. Configure Nginx.

Configure Nginx by creating an Nginx server block for Odoo. To do this, create a file for the Odoo server block:

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

Copy and paste the following configuration into the file:

upstream odoo {

server 127.0.0.1:8069;

}

server {

listen 80;

server_name your_server_name;

add_header Strict-Transport-Security max-age=15768000;

location / {

proxy_pass http://odoo;

proxy_redirect off;

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;

}

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

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

}

Save and close the file, and then check the configuration:

sudo nginx -t

3. Restart Nginx.

To apply the changes and restart Nginx, execute the following command:

sudo systemctl restart nginx

Multiprocessing

Multiprocessing is the ability of an application to run multiple processes simultaneously. This feature is essential for applications such as Odoo, which have a high demand for server resources.

Enabling multiprocessing ensures that the server is more responsive, allowing it to handle multiple requests simultaneously. To enable multiprocessing on your Odoo server, you need to make the following changes to your configuration file:

1.

Increase worker processes. To achieve better performance, increase the number of worker processes in your Odoo configuration file:

workers = 4

2.

Increase the number of threads. To increase the number of threads, set the max_cron_threads parameter in the Odoo configuration:

max_cron_threads = 2

3.

Limit the CPU and real-time execution time. Limit the amount of time that Odoo processes can execute, making sure that they do not consume too much of the server’s resources:

limit_time_real = 3600

limit_time_cpu = 6000

Production Environment

Running Odoo 14 on CentOS 8 in a production environment requires additional setups. The following are the critical steps for configuring your Odoo in a production environment:

1.

Install and configure a database server. Before using Odoo, you need to install and configure PostgreSQL or any other supported database server.

2. Configure a firewall.

Configure your firewall to allow traffic to your Odoo server. FirewallD is the recommended firewall solution for CentOS systems.

3. Set up the SSL certificate.

Install an SSL certificate on your Odoo server, as this will provide secure access to your Odoo instance. You can either purchase an SSL certificate from a certificate authority or generate a self-signed certificate.

4. Create a backup strategy.

Configure a backup strategy to ensure that your data is safe, even in the event of a system failure.

Conclusion

In conclusion, installing Odoo 14 on CentOS 8 is a relatively straightforward process, but it requires attention to detail to ensure that it works correctly. Also, Nginx is a reliable reverse proxy that enables you to provide SSL encryption to your Odoo server.

Multiprocessing is essential to scale Odoo applications, and a production environment requires additional setups to ensure security and reliability. By following the steps outlined in this article, you should be able to install, configure Odoo 14, and set up a production environment to run Odoo securely and reliably.

In conclusion, the installation and configuration of Odoo 14, along with setting up Nginx as an SSL termination proxy, are crucial steps in harnessing the power of this ERP software. By following the detailed steps outlined in this article, from installing prerequisites and creating a virtual environment to configuring Nginx and enabling multiprocessing, you can ensure a smooth and secure Odoo setup.

Additionally, the importance of creating a production environment and implementing proper backup strategies cannot be overstated. Take the time to carefully set up and optimize your Odoo system to maximize its potential and enjoy the benefits of streamlined business management.

Remember, attention to detail and following best practices are key to achieving success with Odoo 14.

Popular Posts