Odoo is a popular business management software which include features like CRM, Billing, Accounting, POS, Inventory system and many more. Most of the users of this business suite is small and medium enterprise. The community edition is completely open-sourced and provide free modules like Sales, CRM, Invoicing, Point of Sales and many more. If you want to have more flexibility to business functionality you can upgrade it to Enterprise version. The latest Odoo version is Odoo 15.
AlmaLinux is a free and open source Linux distribution developed by CloudLinux to provide community-supported, production-grade enterprise operating system that is compatible with Red Hat Enterprise Linux. AlamaLinux was announced after IBM purchased RED HAT Inc. and announced that they will end support to CentOS 8.
Nginx is a light weight and high performance web server that powers million of web applications.
Let us now start the installation.
Prerequisites
- AlmaLinux 8
- Atleast 2 GB of RAM
- User with sudo privileges.
Updating the System
Let us first update our system.
sudo dnf update -y
Installing Python 3.9 and Development tools
We tried to install Odoo 15 with the default python version of Almalinux which is 3.6 but we encountered a lot of dependency issues. So we decided to install python 3.9 to test the installation if it will proceed on this version and we succeeded. Now let us continue with the installation by installing python 3.9.
sudo dnf install python39
Then install the development tools:
sudo dnf groupinstall "Development tools"
Then proceed with the additional development tools.
sudo dnf install python39-devel nano sassc redhat-rpm-config freetype-devel libxslt-devel bzip2-devel openldap-devel libjpeg-devel
Installing and configuring the Database
PostgreSQL is the default backend database of Odoo systems. Before we proceed with the PostgreSQL installation let us first check the available version of PostgreSQL on our system.
sudo dnf module list postgresql
Output:
In this installation we will select the PostgreSQL version 12. Let us install the version 12 on our system.
sudo dnf install @postgresql:12
Initialize the PostgreSQL database:
/usr/bin/postgresql-setup initdb
Enable and start PostgreSQL.
systemctl enable postgresql --now
Create a database user.
sudo su - postgres -c "createuser -s odoo15"
Creating a system user
Before we continue with the installation we need to create a system user for our instance.
sudo useradd -m -d /opt/odoo15 -U -r -s /bin/bash odoo15
Installing wkhtmltopdf
Wkhtmltopdf is a tool to render HTML to PDF format and it is mostly used for printing reports.
Let us install wkhtmltopdf.
dnf install https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos8.x86_64.rpm
Check if the installation is successful by checking the version.
sudo wkhtmltopdf --version
Output:
wkhtmltopdf 0.12.5 (with patched qt)
Odoo 15 installation and configuration
Before we proceed with the installation let us first switch user.
su - odoo15
Now download the Odoo 15 repository from Github.
git clone https://www.github.com/odoo/odoo --depth 1 --branch 15.0 /opt/odoo15/odoo
Change directory to the Odoo 15 directory.
cd /opt/odoo15
Create a virtual environment.
python3.9 -m venv venv
Then activate it.
source venv/bin/activate
Before we proceed in installing the Python modules needed to run our instance let us first modify the requirements.txt and disable psycopg2 module because the version is not compatible with our python version. To disable it open the requirements.txt with your preferred editor and look for psycopg2 and put comment or remove it.
sudo nano odoo/requirements.txt
Look for psycopg2 and comment it or remove it. It should be like below.
#psycopg2==2.7.7; sys_platform != 'win32' and python_version < '3.8'
#psycopg2==2.8.6; sys_platform == 'win32' or python_version >= '3.8'
Save the file and exit.
Then install the psycopg2-binary 2.8.6 version.
(venv) pip3 install psycopg2-binary===2.8.6
Then install the modules under requirements.txt.
(venv) pip3 install -r odoo/requirements.txt
After completing the installation we need to deactivate the virtual environment.
(venv) deactivate
Create a directory for our custom addons.
mkdir /opt/odoo15/custom-addons
Exit from the Odoo15 user.
exit
Let us create an Odoo 15 configuration file.
sudo nano /etc/odoo15.conf
Insert the content below:
[options]
; This is the password that allows database operations:
admin_passwd = admin_password
db_host = False
db_port = False
db_user = odoo15
db_password = False
xmlrpc_port = 8069
logfile = /var/log/odoo15/odoo.log
addons_path = /opt/odoo15/odoo/addons,/opt/odoo15/custom-addons
Please don’t forget to change the “admin_password“. Save the file and exit.
Create a log directory.
sudo mkdir /var/log/odoo15
Set the ownership of the log directory.
sudo chown odoo15:root /var/log/odoo15
Creating Odoo15 Service
To manage our instance easily let us create a Odoo15 systemd unit file.
sudo nano /etc/systemd/system/odoo15.service
Insert the content below:
[Unit]
Description=Odoo15
Requires=postgresql.service
After=network.target postgresql.service
[Service]
Type=simple
SyslogIdentifier=odoo15
PermissionsStartOnly=true
User=odoo15
Group=odoo15
ExecStart=/opt/odoo15/venv/bin/python3 /opt/odoo15/odoo/odoo-bin -c /etc/odoo15.conf
StandardOutput=journal+console
[Install]
WantedBy=multi-user.target
Save and close the file and reload the systemd daemon to apply the changes.
sudo systemctl daemon-reload
Start the Odoo15 instance.
sudo systemctl enable --now odoo15
Check the status.
sudo systemctl status odoo15
Output:
● odoo15.service - Odoo15
Loaded: loaded (/etc/systemd/system/odoo15.service; enabled; vendor preset: disabled)
Active: active (running) since Thu 2022-06-09 00:59:05 EDT; 2 days ago
Main PID: 15935 (python3)
Tasks: 4 (limit: 49455)
Memory: 70.4M
CGroup: /system.slice/odoo15.service
└─15935 /opt/odoo15/venv/bin/python3 /opt/odoo15/odoo/odoo-bin -c /etc/odoo15.conf
Jun 09 00:59:05 blog.jeffalgarne.site systemd[1]: odoo15.service: Succeeded.
Jun 09 00:59:05 blog.jeffalgarne.site systemd[1]: Stopped Odoo15.
Jun 09 00:59:05 blog.jeffalgarne.site systemd[1]: Started Odoo15.
You should be able to access your Odoo 15 instance at http://http://ip.ad.dr.es:8069.
Nginx as Reverse Proxy
If you want to access your instance using a domain or a subdomain then reverse proxy is the solution for you. Nginx is very popular web server for reverse proxy and it is very flexible and powerful. Let us start setting up the reverse proxy by installing Nginx.
sudo dnf install nginx
Start the Nginx service.
sudo systemctl enable nginx --now
Create a server block or Nginx configuration file.
sudo nano /etc/nginx/conf.d/yourdomain.com.conf
Insert the content below:
upstream odoo {
server 127.0.0.1:8069;
}
server {
server_name yourdomain.com;
proxy_read_timeout 720s;
proxy_connect_timeout 720s;
access_log /var/log/nginx/yourdomain.com.access.log;
error_log /var/log/nginx/yourdomain.com.error.log;
location / {
proxy_pass http://odoo;
proxy_next_upstream error timeout invalid_header http_500 http_502 http_503 http_504;
proxy_redirect off;
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;
}
location ~* /web/static/ {
proxy_cache_valid 200 90m;
proxy_buffering on;
expires 864000;
proxy_pass http://odoo;
}
# common gzip
gzip_types text/css text/scss text/plain text/xml application/xml application/json application/javascript;
gzip on;
}
Please don’t forget to change the domain “yourdomain.com“. Save the file and exit.
Restart Nginx.
systemctl restart nginx
Now we need to enable Proxy mode on our Odoo 15 instance. Open the Odoo 15 configuration file using your favorite text editor.
sudo nano /etc/odoo15.conf
Insert this at the bottom.
proxy_mode = True
Save the file and exit.
Restart the Odoo15 service.
sudo systemctl restart odoo15
That’s it you should be able to access your Odoo 15 instance on your domain or subdomain at http://yourdomain.com.
Conclusion
In this tutorial you have learned how to install Odoo 15 on AlmaLinux 8. If you want to secure your instance by setting up Free SSL certificate you can check our guide on Let’s Encrypt.
If you have questions, feel free to leave a comment and we will try to answer it.
Thank you and hope you enjoy our tutorial ?