Step-by-Step Guide to Installing Odoo on Alma Linux

Odoo stands out as a premier, open-source suite of business applications, aiding organizations in managing and optimizing their operations. Equipped with a plethora of features such as CRM, billing, accounting, manufacturing, inventory, and project management, Odoo is a comprehensive solution. Written in Python and utilizing PostgreSQL for its database backend, it offers a seamless blend of usability and flexibility, making it an ideal choice for businesses seeking an open-source CRM and ERP application.

This guide provides step-by-step instructions for installing Odoo with Nginx on AlmaLinux 8.

Prerequisites

  • A server running AlmaLinux 8.
  • A valid domain name linked to your server IP.
  • Root access to the server.

Install Required Dependencies

To kickstart the installation, you need to set up Python, PostgreSQL, and other necessary dependencies on your server. Begin by installing Python and associated dependencies with the following command:

dnf install python3 python3-devel git gcc git redhat-rpm-config libxslt-devel bzip2-devel openldap-devel libjpeg-devel freetype-devel -y

Then, proceed to install the wkhtmltopdf package:

dnf install https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos8.x86_64.rpm

Next, set up the PostgreSQL database server:

dnf install @postgresql:12 -y

Once installed, initialize the PostgreSQL database using:

/usr/bin/postgresql-setup initdb

Start and enable the PostgreSQL service:

systemctl start postgresql
systemctl enable postgresql

Create a PostgreSQL user for Odoo:

su - postgres -c "createuser -s odoo14"

Install Odoo14 on AlmaLinux 8

First, create a dedicated user for Odoo:

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

Download the Odoo14 source from the Git repository as this user:

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

Create and activate a Python virtual environment:

cd /opt/odoo
python3 -m venv odoo14-venv
source odoo14-venv/bin/activate

Install all required Python dependencies:

pip3 install -r odoo14/requirements.txt

Deactivate the Python virtual environment and exit the Odoo user:

deactivate
exit

Configure Odoo14

Create the necessary directories for Odoo:

mkdir /opt/odoo/odoo14-custom-addons
mkdir /var/log/odoo14 && touch /var/log/odoo14/odoo.log

Adjust permissions with:

chown odoo14: /opt/odoo/odoo14-custom-addons
chown -R odoo14: /var/log/odoo14/

Create an Odoo configuration file:

nano /etc/odoo.conf

Add the following configuration:

[options]
admin_passwd = odoomasterpassword
db_host = False
db_port = False
db_user = odoo14
db_password = False
xmlrpc_port = 8069
logfile = /var/log/odoo14/odoo.log
logrotate = True
addons_path = /opt/odoo/odoo14/addons,/opt/odoo/odoo14-custom-addons

Create a Systemd Service File for Odoo14

Create a systemd service file for Odoo:

nano /etc/systemd/system/odoo14.service

Insert the following configuration:

[Unit]
Description=Odoo14

[Service]
Type=simple
SyslogIdentifier=odoo14
PermissionsStartOnly=true
User=odoo14
Group=odoo14
ExecStart=/opt/odoo/odoo14-venv/bin/python3 /opt/odoo/odoo14/odoo-bin -c /etc/odoo.conf
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target

Reload the systemd daemon to recognize the new service:

systemctl daemon-reload

Start and enable the Odoo service:

systemctl start odoo14
systemctl enable odoo14

Verify the status of the Odoo service:

systemctl status odoo14

Configure Nginx for Odoo14

Install Nginx and set it up as a reverse proxy for Odoo:

dnf install nginx -y

Create an Nginx virtual host configuration file:

nano /etc/nginx/conf.d/odoo14.conf

Add the following configuration:

upstream odooserver {
 server 127.0.0.1:8069;
}

server {
    listen 80;
    server_name odoo14.example.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;
}

Verify the Nginx configuration:

nginx -t

Start and enable Nginx:

systemctl start nginx
systemctl enable nginx

Edit the Odoo configuration file to enable the proxy:

nano /etc/odoo.conf

Add the following line:

proxy_mode = True

Restart the Odoo service to apply changes:

systemctl restart odoo14

Configure Firewall

To allow inbound traffic on port 80, use the following command:

firewall-cmd --add-service=http --permanent

Reload the firewall to apply changes:

firewall-cmd --reload

Access Odoo14 Web Interface

Access the Odoo14 web interface through your browser via the URL http://odoo14.example.com. You’ll be greeted by the following setup screen:

Odoo Setup

Input your Odoo master password, database, email, and password, then click Create database. This will take you to the Odoo14 dashboard:

Odoo Dashboard

Congratulations! You have successfully set up Odoo with Nginx on AlmaLinux 8. You can now utilize Odoo to streamline and manage your business operations.

FAQ

  • What is Odoo?
    Odoo is a comprehensive suite of open-source business applications that aids businesses in streamlining operations across various domains like CRM, billing, and project management.
  • Why use Nginx with Odoo?
    Nginx acts as a reverse proxy, improving Odoo’s performance and security through caching, and load balancing.
  • Can I run Odoo on other Linux distributions?
    Yes, Odoo can be installed on various Linux distributions such as Ubuntu, Debian, and CentOS, with some adjustments in dependencies and package managers.
  • Is there a different configuration needed for HTTPS?
    Yes, enabling HTTPS requires additional configuration and SSL certificate setup in the Nginx configuration file.
  • How can I troubleshoot if Odoo doesn’t start?
    Check the system logs using journalctl -xe and review the Odoo log file located at /var/log/odoo14/odoo.log for any errors or warnings.