How To Install Odoo on Alma Linux
Odoo is a free, open-source, and one of the most popular suites of business applications that helps organizations run and manage their business. It offers a wide range of features including CRM, billing, accounting, manufacturing, warehouse, inventory, project management, and more. It is written in Python and uses PostgreSQL as a database backend. If you are looking for an open-source CRM and ERP application to run your business, Odoo is the best option.
This post will explain installing Odoo with Nginx on Alma Linux 8.
Prerequisites
- A server running Alma Linux 8.
- A valid domain name is linked to your server IP.
- A root password is configured on the server.
Install Required Dependencies
Before starting, you must install Python, PostgreSQL, and several other dependencies to your server. First, install the Python and other dependencies using 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
Next, install the wkhtmltopdf package with the following command:
dnf install https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.5/wkhtmltox-0.12.5-1.centos8.x86_64.rpm
Next, install the PostgreSQL database server with the following command:
dnf install @postgresql:12 -y
Once PostgreSQL has been installed, you can initialize the database using the following command:
/usr/bin/postgresql-setup initdb
Next, start and enable the PostgreSQL service with the following command:
systemctl start postgresql
systemctl enable postgresql
Next, you will need to create a user for Odoo in PostgreSQL. You can create it using the following command:
su - postgres -c "createuser -s odoo14"
Once you are finished, you can proceed to the next step.
Install Odoo14 on Alma Linux 8
First, create a dedicated user to run Odoo using the following command:
useradd -m -U -r -d /opt/odoo -s /bin/bash odoo14
Next, log in with Odoo14 user and download the Odoo14 source from the Git repository:
su - odoo14
git clone https://www.github.com/odoo/odoo --depth 1 --branch 14.0 /opt/odoo/odoo14
Next, change the directory to the Odoo and create a Python virtual environment:
cd /opt/odoo
python3 -m venv odoo14-venv
Next, activate the Python virtual environment using the following command:
source odoo14-venv/bin/activate
Next, install all the required Python dependencies using the following command:
pip3 install -r odoo14/requirements.txt
Once all the dependencies are installed, deactivate from the Python virtual environment with the following command:
deactivate
Finally, exit from the Odoo14 user with the following command:
exit
Configure Odoo14
Next, create some required directory for Odoo with the following command:
mkdir /opt/odoo/odoo14-custom-addons
mkdir /var/log/odoo14 && touch /var/log/odoo14/odoo.log
Next, set proper ownership with the following command:
chown odoo14: /opt/odoo/odoo14-custom-addons
chown -R odoo14: /var/log/odoo14/
Next, create an Odoo configuration file:
nano /etc/odoo.conf
Add the following content:
[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
Save and close the file when you are finished.
Create a Systemd Service File for Odoo14
Next, you must create a systemd service file to manage the Odoo14 service. You can create it with the following command:
nano /etc/systemd/system/odoo14.service
Add the following lines:
[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
Save and close the file then reload the systemd daemon with the following command:
systemctl daemon-reload
Next, start and enable the Odoo service with the following command:
systemctl start odoo14
systemctl enable odoo14
You can now check the status of the Odoo service with the following command:
systemctl status odoo14
You will get the following output:
? odoo14.service - Odoo14 Loaded: loaded (/etc/systemd/system/odoo14.service; enabled; vendor preset: disabled) Active: active (running) since Thu 2022-01-04 00:44:36 EST; 5s ago Main PID: 45125 (python3) Tasks: 4 (limit: 25014) Memory: 60.9M CGroup: /system.slice/odoo14.service ??45125 /opt/odoo14/venv/bin/python3 /opt/odoo/odoo14/odoo-bin -c /etc/odoo14.conf Feb 04 00:44:36 rockylinux8 systemd[1]: Started Odoo14. Feb 04 00:44:37 rockylinux8 odoo14[45125]: /opt/odoo14/venv/lib64/python3.6/site-packages/psycopg2/__init__.py:144: UserWarning: The psycopg2 whee> Feb 04 00:44:37 rockylinux8 odoo14[45125]: """) Feb 04 00:44:37 rockylinux8 odoo14[45125]: 2022-01-04 05:44:37,761 45125 INFO ? odoo: Odoo version 14.0 Feb 04 00:44:37 rockylinux8 odoo14[45125]: 2022-01-04 05:44:37,762 45125 INFO ? odoo: Using configuration file at /etc/odoo.conf Feb 04 00:44:37 rockylinux8 odoo14[45125]: 2022-01-04 05:44:37,762 45125 INFO ? odoo: addons paths: ['/opt/odoo/odoo14/odoo/addons', '/opt/odoo14/> Feb 04 00:44:37 rockylinux8 odoo14[45125]: 2022-01-04 05:44:37,762 45125 INFO ? odoo: database: odoo14@default:default Feb 04 00:44:38 rockylinux8 odoo14[45125]: 2022-01-04 05:44:38,057 45125 INFO ? odoo.addons.base.models.ir_actions_report: Will use the Wkhtmltopd> Feb 04 00:44:38 rockylinux8 odoo14[45125]: 2022-01-04 05:44:38,437 45125 INFO ? odoo.service.server: HTTP service (werkzeug) running on rockylinux8:80>
At this point, Odoo14 is started and listens on port 8069. You can check it with the following command:
ss -antpl | grep 8069
You will get the following output:
LISTEN 0 128 0.0.0.0:8069 0.0.0.0:* users:(("python3",pid=27781,fd=5))
Configure Nginx for Odoo14
Next, you will need to install and configure Nginx as a reverse proxy for Odoo14. First, install the Nginx package with the following command:
dnf install nginx -y
Next, create an Nginx virtual host configuration file using the following command:
nano /etc/nginx/conf.d/odoo14.conf
Add the following content:
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; }
Save and close the file then verify the Nginx for any syntax error using the following command:
nginx -t
You will get the following output:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok nginx: configuration file /etc/nginx/nginx.conf test is successful
Next, start and enable the Nginx service with the following command:
systemctl start nginx
systemctl enable nginx
You can also check the Nginx status using the following command:
systemctl status nginx
You will get the following output:
? nginx.service - The nginx HTTP and reverse proxy server Loaded: loaded (/usr/lib/systemd/system/nginx.service; disabled; vendor preset: disabled) Active: active (running) since Sat 2022-01-15 15:57:16 UTC; 5s ago Process: 28148 ExecStart=/usr/sbin/nginx (code=exited, status=0/SUCCESS) Process: 28146 ExecStartPre=/usr/sbin/nginx -t (code=exited, status=0/SUCCESS) Process: 28144 ExecStartPre=/usr/bin/rm -f /run/nginx.pid (code=exited, status=0/SUCCESS) Main PID: 28149 (nginx) Tasks: 5 (limit: 49497) Memory: 7.5M CGroup: /system.slice/nginx.service ??28149 nginx: master process /usr/sbin/nginx ??28150 nginx: worker process ??28151 nginx: worker process ??28152 nginx: worker process ??28153 nginx: worker process Jan 15 15:57:16 almalinux8 systemd[1]: Starting The nginx HTTP and reverse proxy server... Jan 15 15:57:16 almalinux8 nginx[28146]: nginx: the configuration file /etc/nginx/nginx.conf syntax is ok Jan 15 15:57:16 almalinux8 nginx[28146]: nginx: configuration file /etc/nginx/nginx.conf test is successful Jan 15 15:57:16 almalinux8 systemd[1]: Started The nginx HTTP and reverse proxy server.
Next, edit the Odoo configuration file:
nano /etc/odoo.conf
Add the following line at the end of the file to enable the proxy:
proxy_mode = True
Save and close the file then restart the Odoo service to apply the changes:
systemctl restart odoo14
Once you are finished, you can proceed to the next step.
Configure Firewall
Next, you will need to allow port 80 through the firewall. You can allow it by running the following command:
firewall-cmd --add-service=http --permanent
Next, reload the firewall to apply the changes:
firewall-cmd --reload
Once you are finished, you can proceed to the next step.
Access Odoo14 Web Interface
Now, open your web browser and access the Odoo14 web interface using the URL http://odoo14.example.com. You should see the following screen:
Provide your Odoo master password, database, email, and password, and click on the Create database button. You should see the Odoo14 dashboard on the following screen:
You have successfully installed Odoo with Nginx on Alma Linux 8. You can now implement Odoo to manage your business and operations.