Odoo14 installation tutorial on virtual machine

Install Odoo14 on Ubuntu, CentOS

Odoo 14 installation tutorial on a virtual machine

Background Introduction to This Series

Odoo is open-source software built on the Python language, targeting enterprise application fields such as CRM and ERP. Its goal is to benchmark against large software providers such as SAP and Oracle, yet it satisfies all of an enterprise's management business needs through just one platform.

This series of articles targets Odoo 14 and, from the perspectives of system installation, development environment configuration, code structure, major feature upgrades, source code analysis, and key extensions to Odoo, introduces to everyone in advance this latest version that will be released in 2020.

Overview of This Article

The installation of Odoo 14 is similar to that of previous versions, and likewise includes multiple forms such as installation files, source code, Docker, etc. This article installs Odoo 14 on Ubuntu 18.04 via source code.

PostgreSQL database preparation

Install the database from the official PostgreSQL website or via the apt command.

https://www.postgresql.org/

https://www.postgresql.org/download/linux/ubuntu/

sudo apt update

sudo apt install postgresql postgresql-contrib

Since this is a development environment, use the current user and use PostgreSQL's createdb command to add a database:

Odoo 14 has been established

Install from source

Because Anodoo extends Odoo at the source-code level, this article prioritizes demonstrating the source code installation mode.

Download and prepare the Odoo 14 source code files from http://nightly.odoo.com/, use the tar or unzip command to decompress the source files, and extract them to the ~/odoo14 directory. In this case, further rename it to a directory in the form ~/odoo14/odoo.

Create a virtual environment

Since there are multiple Odoo or Python environments in the development environment, it is recommended to create a Python virtual environment. Create a virtual environment by running python3 -m venv python3 in the ~/odoo14 directory, and via

source python3/bin/activate to activate; note that the command to exit the virtual environment after finishing is deactivate

Install dependencies

Install all dependencies using the following command

sudo apt install libpq-dev libldap2-dev libsasl2-dev libxslt1-devsudo apt install python3-setuptools python3-wheelsudo apt-get install libsasl2-dev python-dev libldap2-dev libssl-dev python3-pypdf2pip3 install wheelpip3 install -r odoo/requirements.txtsudo apt install wkhtmltox_0.12.5-1.bionic_amd64.deb

Create configuration file

Create an odoo.conf file under ~odoo14/, with the following contents:

[options]db_host=Falsedb_port=Falsedb_name=odoo14db_user=odoodevdb_password=Falselogfile=/var/log/odoo/odoo14.logaddons_path=/home/lionger/odoo14/odoo/addons

Start Odoo 14

python3 odoo /odoo.py -c odoo.conf -i base

Note that, after activating the virtual environment, run python3 odoo /odoo.py -c odoo.conf -i base in the ~odoo14/ directory. The -i base is used to initialize the database on the first startup. It can be omitted on the second startup.

Preview Odoo 14 features

After starting Odoo 14 as described above, no modules are installed by default on the first run, so startup is very fast. After startup is complete, access it at http://localhost:8070; after clicking directly to enter the system for the first time, you will see the following interface.

Conclusion

From downloading the source code, creating a Python virtual environment, installing dependencies, and creating a configuration file to launching it—in just a few simple steps, you can quickly install the most powerful open-source CRM and ERP and give them a try. I recommend everyone try it as soon as possible.

The above is the tutorial on installing Odoo 14 from source on Ubuntu 18.04 that the editor introduced to everyone. I hope it is helpful to everyone!



Further reading:

Install Odoo 13 on CentOS 8


Odoo is the world's most popular all-in-one business software. It offers a range of business applications, including CRM, website, e-commerce, billing, accounting, industrial manufacturing, warehouse, project management, inventory management, and more, all seamlessly integrated.

This guide explains how to install Odoo 13 from source in a Python virtual environment on CentOS 8. We will compile the Odoo source code from GitHub and configure Nginx as a reverse proxy server.

1. Prerequisites

You need to log in as root or another user with sudo privileges to complete the entire installation process.

II. Install Dependencies

Install Python 3, Git, and the other libraries and tools required to compile Odoo from source: sudo dnf install python3 python3-devel git gcc redhat-rpm-config libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel

3. Create a system user

Create a system user and user group, with /opt/odoo as the home directory, to run the Odoo service: sudo useradd -m -U -r -d /opt/odoo13 -s /bin/bash odoo13

You can use any other name you want as the username, as long as you can ensure that a PostgreSQL user can be created with this name.

IV. Installing and Configuring PostgreSQL

We will install PostgreSQL 10 from the standard CentOS 8 repository. sudo dnf install @postgresql:10

Once installation is complete, create a PostgreSQL database: sudo postgresql-setup initdb

Enable and start the PostGreSQL service: sudo systemctl enable --now postgresql

Create a ProtgreSQL user, using the same name as the system user created earlier as the database username. In our example, this name is odoo13: sudo su - postgres -c "createuser -s odoo13"

V. Install Wkhtmltopdf

The Wkhtmltopdf software package provides a series of open-source command-line tools that can render HTML into PDF, as well as various image formats. To print PDF reports, you will need the Wkhtmltopdf tool. The version recommended by Odoo is 0.12.5, and this version is not in the official CentOS 8 software repository.

Install its RPM package from GitHub: sudo dnf install https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos8.x86_64.rpm

VI. Installing and Configuring Odoo 13

Before starting the installation, switch the user to odoo13:sudo su - odoo13

Start cloning the Odoo 13 source code from Odoo's GitHub source repository: git clone https://www.github.com/odoo/odoo --depth 1 --branch 13.0 /opt/odoo13/odoo

Switch to the /opt/odoo13 directory and create a new Python virtual environment for installing Odoo: cd /opt/odoo13

python3 -m venv venv

Use the source command to activate this environment:source venv/bin/activate

Install the necessary Python modules: pip3 install -r odoo/requirements.txt If you encounter any compilation errors during installation, please ensure you have installed all dependency software packages. For specific dependency packages, refer to `Installing Dependencies`

Once installation is complete, deactivate this environment: deactivate

Create a new directory for custom components: mkdir /opt/odoo13/odoo-custom-addons

Switch back to sudo user exit

Next, use a text editor to open and create the following configuration file: sudo nano /etc/odoo13.conf[options]

; This is the password that allows database operations:

admin_passwd = superadmin_passwd

db_host = False

db_port = False

db_user = odoo13

db_password = False

addons_path = /opt/odoo13/odoo/addons, /opt/odoo13/odoo-custom-addons

Save and close the file. Don't forget to change `superadmin_passwd` to a more secure password.

7. Create a Systemd Unit File

Open your text editor and create a file named odoo13.service in the /etc/systemd/system/ directory: sudo nano /etc/systemd/system/odoo13.service

Paste the following content into the file: [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 and close the editor.

Notify Systemd that there is a new unit file: sudo systemctl daemon-reload

Enable and start the Odoo service by running the following command: sudo systemctl enable --now odoo13

You can check the service status with the following command: sudo systemctl status odoo13● odoo13.service - Odoo13

Loaded: loaded (/etc/systemd/system/odoo13.service; enabled; vendor preset: disabled)

Active: active (running) since Wed 2019-12-11 20:04:52 UTC; 5s ago

Main PID: 28539 (python3)

Task: 4 (Limit: 11524)

Memory: 94.6M

CGroup: /system.slice/odoo13.service

└─28539 /opt/odoo13/venv/bin/python3 /opt/odoo13/odoo/odoo-bin -c /etc/odoo13.conf

To view the Odoo service logs, use the following command: sudo journalctl -u odoo13

8. Test Installation

Open your browser and enter: http://:8069

Assuming all installations are complete, you will see a screen like the following:

If you cannot access this page, it is likely that your firewall is blocking port 8069.

Use the following command to open the necessary port: sudo firewall-cmd --permanent --zone=public --add-port=8069/tcp

sudo firewall-cmd --reload

IX. Configure Nginx as an SSL Proxy Server

The default Odoo web server serves over HTTP. To make the Odoo deployment more secure, we will configure Nginx as an SSL proxy server so that the web server serves over HTTPS.

An SSL proxy server is a proxy server used to handle SSL encryption and decryption. This means that Nginx will handle and decrypt incoming TLS connections (HTTPS), and pass the unencrypted requests to the internal service (Odoo). Traffic between Nginx and Odoo will not be encrypted.

Using a reverse proxy server has many benefits, such as load balancing, SSL, caching, compression, static content serving, and more.

Make sure you meet the following prerequisites before continuing to the next step of installation and configuration: a domain name pointing to your server's public IP; we use example.com.

Install Nginx

SSL certificate for the domain. You can install a free Encrypt SSL certificate.

Open your text editor and create or edit the domain server configuration block: sudo nano /etc/nginx/conf.d/example.com

The following configuration will set up SSL, redirect HTTP to HTTPS, redirect WWW to non-www, cache static files, and enable GZip compression.# Odoo servers

upstream odoo {

server 127.0.0.1:8069;

}

upstream odoochat {

server 127.0.0.1:8072;

}

# HTTP -> HTTPS

server {

listen 80;

server_name www.example.com example.com;

include snippets/letsencrypt.conf;

return 301 https://example.com$request_uri;

}

# WWW -> NON WWW

server {

listen 443 ssl http2;

server_name www.example.com;

ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;

ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;

include snippets/ssl.conf;

return 301 https://example.com$request_uri;

}

server {

listen 443 ssl http2;

server_name example.com;

proxy_read_timeout 720s;

proxy_connect_timeout 720s;

proxy_send_timeout 720s;

# Proxy headers

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;

# SSL Parameters

ssl_certificate /etc/letsencrypt/live/example.com/fullchain.pem;

ssl_certificate_key /etc/letsencrypt/live/example.com/privkey.pem;

ssl_trusted_certificate /etc/letsencrypt/live/example.com/chain.pem;

include snippets/ssl.conf;

# Log File

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

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

# Handling Long Polling Requests

location /longpolling {

proxy_pass http://odoochat;

}

# Processing / Request

location / {

proxy_redirect off;

proxy_pass http://odoo;

}

# Cache Static Files

location ~* /web/static/ {

proxy_cache_valid 200 90m;

proxy_buffering on;

expires 864000;

proxy_pass http://odoo;

}

# Gzip

gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;

gzip on;

}Don't forget to replace example.com with your own Odoo domain name and set the correct SSL certificate address. For the configuration section in the certificate, please refer to: https://linuxize.com/post/secure-nginx-with-let-s-encrypt-on-centos-7/

Once you're done, restart the Nginx service: sudo systemctl restart nginx

Next, we need to tell Odoo to use a proxy server. To do this, open the configuration file and add the following content: /etc/odoo13.conf

Restart the Odoo service and apply the changes: sudo systemctl restart odoo13

At this point, the reverse proxy server is configured, and you can access Odoo via https://example.com.

10. Change the listening port

This step is optional, but it is a good practice.

By default, the Odoo service listens on port 8069 on all network interfaces. To prohibit direct access to Odoo, you can block port 8069 and force Odoo to listen only on local monitoring.

We will configure Odoo to only listen on 127.0.0.1. Open the configuration file and add the following content to the end of the file: /etc/odoo13.confxmlrpc_interface = 127.0.0.1

netrpc_interface = 127.0.0.1

Save the configuration file and restart the Odoo server for the changes to take effect: sudo systemctl restart odoo13

11. Enable Multiprocessing

By default, Odoo runs in multithreaded mode. For production-level deployments, we recommend changing to a multiprocess server to improve stability and fully utilize system resources.

To enable multiprocessing, you need to edit the Odoo configuration file and set a non-zero number of worker processes. The number of worker processes is calculated based on the number of CPU cores in the system and the available RAM memory.

To calculate the number of worker processes and the required RAM memory size according to the official Odoo documentation, you can use the following formula:

Worker process count calculation: theoretical maximum number of worker processes = (system_cpus * 2) + 1

1 worker process can serve approximately 6 concurrent clients.

The Cron process also needs CPU

RAM Memory Size Calculation We consider that 20% of requests are heavy requests, and 80% of requests are lightweight requests. Heavyweight requests use nearly 1GB of RAM, while lightweight requests use nearly 150MB of RAM.

Required RAM = number_of_workers * ( (light_worker_ratio * light_worker_ram_estimation) + (heavy_worker_ratio * heavy_worker_ram_estimation) )

If you don't know how many CPUs your system has, you can use the following grep command: grep -c ^processor /proc/cpuinfo

For example, you have a system with a 4-core CPU, 8GB RAM memory, and 30 concurrent Odoo users. 30 users / 6 = **5**(5 is the theoretical number of worker processes required)

(4 * 2) + 1 = **9** (9 is the theoretical maximum number of worker processes)

Based on the above calculation, you can use 5 processes + 1 process (Cron process), for a total of 6 processes.

Based on worker processes, calculate RAM memory: RAM = 6 * ((0.8*150) + (0.2*1024)) ~= 2 GB of RAM

The calculation results show that the Odoo installation will require approximately 2GB of memory.

To switch to multi-process mode, open the configuration file and add the calculated value: /etc/odoo13.conflimit_memory_hard = 2684354560

limit_memory_soft = 2147483648

limit_request = 8192

limit_time_cpu = 600

limit_time_real = 1200

max_cron_threads = 1

workers = 5

Restart the Odoo service for the changes to take effect: sudo systemctl restart odoo13

The remaining system resources will be allocated for use by other services on the system. In this guide, we install Odoo, PostgreSQL, and Nginx on the same server. Depending on your setup, there are other services on your server.

Twelve. Summary

This guide walked you through how to install Odoo 13 in a Python virtual environment on CentOS 8, using Nginx as a reverse proxy server. We demonstrated how to enable multiprocessing and optimize Odoo in a production environment.

关于我们

​我们致力于帮助中小企业实现数字化转型,我们的团队由一群充满激情和创新思维的专业人士组成,他们具备丰富的行业经验和技术专长。

扫一扫获取顾问以及手册

Sign in to leave a comment
Install Odoo11 and Odoo8 from source code
Install Odoo 11 from source, install Odoo 8.0 from source