1515# ./odoo-install
1616# ###############################################################################
1717
18+ # Helper function for pip install with PEP 668 compatibility (Debian 12+)
19+ pip_install () {
20+ if pip3 help install 2> /dev/null | grep -q -- ' --break-system-packages' ; then
21+ sudo -H pip3 install --break-system-packages " $@ "
22+ else
23+ sudo -H pip3 install " $@ "
24+ fi
25+ }
26+
1827OE_USER=" odoo"
1928OE_HOME=" /$OE_USER "
2029OE_HOME_EXT=" /$OE_USER /${OE_USER} -server"
@@ -25,9 +34,11 @@ INSTALL_WKHTMLTOPDF="True"
2534OE_PORT=" 8069"
2635# Choose the Odoo version which you want to install. For example: 13.0, 12.0, 11.0 or saas-18. When using 'master' the master version will be installed.
2736# IMPORTANT! This script contains extra libraries that are specifically needed for Odoo 13.0
28- OE_VERSION=" 14 .0"
37+ OE_VERSION=" 19 .0"
2938# Set this to True if you want to install the Odoo enterprise version!
3039IS_ENTERPRISE=" False"
40+ # Installs postgreSQL V16 instead of defaults (e.g V12 for Ubuntu 20/22) - this improves performance
41+ INSTALL_POSTGRESQL_SIXTEEN=" False"
3142# Set this to True if you want to install Nginx!
3243INSTALL_NGINX=" False"
3344# Set the superadmin password - if GENERATE_RANDOM_PASSWORD is set to "True" we will automatically generate a random password, otherwise we use this one
@@ -60,7 +71,36 @@ sudo apt-get upgrade -y
6071# Install PostgreSQL Server
6172# --------------------------------------------------
6273echo -e " \n---- Install PostgreSQL Server ----"
63- sudo apt-get install postgresql -y
74+ if [ " $INSTALL_POSTGRESQL_SIXTEEN " = " True" ]; then
75+ echo -e " \n---- Installing postgreSQL V16 due to the user's choice ----"
76+ sudo apt-get install -y gnupg2
77+ sudo curl -fsSL https://www.postgresql.org/media/keys/ACCC4CF8.asc| sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/postgresql.gpg
78+ sudo sh -c ' echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
79+ sudo apt-get update -y
80+ sudo apt-get install -y postgresql-16
81+ if [ " $IS_ENTERPRISE " = " True" ]; then
82+ # Ensure PostgreSQL is running before pgvector setup (Ubuntu 24.04 uses systemd)
83+ sudo systemctl start postgresql || true
84+ # pgvector is only needed for Enterprise AI features
85+ sudo apt-get install -y postgresql-16-pgvector
86+ # Wait for PostgreSQL to become available
87+ until sudo -u postgres pg_isready > /dev/null 2>&1 ; do sleep 1; done
88+ # Create vector extension using a heredoc to avoid any quoting issues
89+ sudo -u postgres psql -v ON_ERROR_STOP=1 -d template1 << 'SQL '
90+ CREATE EXTENSION IF NOT EXISTS vector;
91+ SQL
92+ fi
93+ else
94+ echo -e " \n---- Installing the default postgreSQL version based on Linux version ----"
95+ sudo apt-get install postgresql postgresql-server-dev-all -y
96+ fi
97+
98+ # Ensure PostgreSQL is running before creating the user
99+ echo -e " \n---- Ensure PostgreSQL is running ----"
100+ # add timeout to avoid infinite loop in case of errors
101+ sudo systemctl start postgresql || true
102+ echo -e " \n---- Waiting for PostgreSQL to become available ----"
103+ until sudo -u postgres pg_isready > /dev/null 2>&1 ; do sleep 1; done
64104
65105echo -e " \n---- Creating the ODOO PostgreSQL User ----"
66106sudo su - postgres -c " createuser -s $OE_USER " 2> /dev/null || true
@@ -69,11 +109,14 @@ sudo su - postgres -c "createuser -s $OE_USER" 2> /dev/null || true
69109# Install Dependencies
70110# --------------------------------------------------
71111echo -e " \n--- Installing Python 3 + pip3 --"
72- sudo apt-get install git python3 python3-pip build-essential wget python3- dev python3-venv python3-wheel libxslt1-dev -y
73- sudo apt-get install libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less gdebi -y
112+ sudo apt-get install -y python3 python3-pip libpq- dev
113+ sudo apt-get install git python3-cffi build-essential wget python3-dev python3-venv python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools node-less libpng-dev libjpeg-dev gdebi -y
74114
75115echo -e " \n---- Install python packages/requirements ----"
76- sudo pip3 install -r https://github.com/odoo/odoo/raw/${OE_VERSION} /requirements.txt
116+ pip_install -r https://github.com/odoo/odoo/raw/${OE_VERSION} /requirements.txt
117+
118+ # Extra: ensure phonenumbers is installed
119+ pip_install phonenumbers
77120
78121echo -e " \n---- Installing nodeJS NPM and rtlcss for LTR support ----"
79122sudo apt-get install nodejs npm -y
@@ -82,7 +125,7 @@ sudo npm install -g rtlcss
82125# --------------------------------------------------
83126# Install Wkhtmltopdf if needed
84127# --------------------------------------------------
85- if [ $INSTALL_WKHTMLTOPDF = " True" ]; then
128+ if [ " $INSTALL_WKHTMLTOPDF " = " True" ]; then
86129 echo -e " \n---- Install wkhtml and place shortcuts on correct place for ODOO 13 ----"
87130 # pick up correct one from x64 & x32 versions:
88131 if [ " ` getconf LONG_BIT` " == " 64" ]; then
@@ -139,8 +182,7 @@ if [ $IS_ENTERPRISE = "True" ]; then
139182fi
140183
141184echo -e " \n---- Create custom module directory ----"
142- sudo su $OE_USER -c " mkdir $OE_HOME /custom"
143- sudo su $OE_USER -c " mkdir $OE_HOME /custom/addons"
185+ sudo su $OE_USER -c " mkdir -p $OE_HOME /custom/addons"
144186
145187echo -e " \n---- Setting permissions on home folder ----"
146188sudo chown -R $OE_USER :$OE_USER $OE_HOME /*
@@ -295,8 +337,8 @@ if [ $INSTALL_NGINX = "True" ]; then
295337 http_503;
296338
297339 types {
298- text/less less;
299- text/scss scss;
340+ text/less less;
341+ text/scss scss;
300342 }
301343
302344 # enable data compression
@@ -310,36 +352,38 @@ if [ $INSTALL_NGINX = "True" ]; then
310352 client_max_body_size 0;
311353
312354 location / {
313- proxy_pass http://127.0.0.1:$OE_PORT ;
314- # by default, do not forward anything
315- proxy_redirect off;
355+ proxy_pass http://127.0.0.1:$OE_PORT ;
356+ # by default, do not forward anything
357+ proxy_redirect off;
316358 }
317359
318360 location /longpolling {
319- proxy_pass http://127.0.0.1:$LONGPOLLING_PORT ;
361+ proxy_pass http://127.0.0.1:$LONGPOLLING_PORT ;
320362 }
363+
321364 location ~* .(js|css|png|jpg|jpeg|gif|ico)$ {
322- expires 2d;
323- proxy_pass http://127.0.0.1:$OE_PORT ;
324- add_header Cache-Control "public, no-transform";
365+ expires 2d;
366+ proxy_pass http://127.0.0.1:$OE_PORT ;
367+ add_header Cache-Control "public, no-transform";
325368 }
369+
326370 # cache some static data in memory for 60mins.
327371 location ~ /[a-zA-Z0-9_-]*/static/ {
328- proxy_cache_valid 200 302 60m;
329- proxy_cache_valid 404 1m;
330- proxy_buffering on;
331- expires 864000;
332- proxy_pass http://127.0.0.1:$OE_PORT ;
333- }
372+ proxy_cache_valid 200 302 60m;
373+ proxy_cache_valid 404 1m;
374+ proxy_buffering on;
375+ expires 864000;
376+ proxy_pass http://127.0.0.1:$OE_PORT ;
334377 }
378+ }
335379EOF
336380
337- sudo mv ~ /odoo /etc/nginx/sites-available/
338- sudo ln -s /etc/nginx/sites-available/odoo /etc/nginx/sites-enabled/odoo
381+ sudo mv ~ /odoo /etc/nginx/sites-available/$WEBSITE_NAME
382+ sudo ln -s /etc/nginx/sites-available/$WEBSITE_NAME /etc/nginx/sites-enabled/$WEBSITE_NAME
339383 sudo rm /etc/nginx/sites-enabled/default
340384 sudo service nginx reload
341385 sudo su root -c " printf 'proxy_mode = True\n' >> /etc/${OE_CONFIG} .conf"
342- echo " Done! The Nginx server is up and running. Configuration can be found at /etc/nginx/sites-available/odoo "
386+ echo " Done! The Nginx server is up and running. Configuration can be found at /etc/nginx/sites-available/$WEBSITE_NAME "
343387else
344388 echo " Nginx isn't installed due to choice of the user!"
345389fi
@@ -349,11 +393,19 @@ echo "-----------------------------------------------------------"
349393echo " Done! The Odoo server is up and running. Specifications:"
350394echo " Port: $OE_PORT "
351395echo " User service: $OE_USER "
396+ echo " Configuration file location: /etc/${OE_CONFIG} .conf"
397+ echo " Logfile location: /var/log/$OE_USER "
352398echo " User PostgreSQL: $OE_USER "
353- echo " Code location: $OE_USER "
354- echo " Addons folder: $OE_USER /$OE_CONFIG /addons/"
399+ echo " Code location: $OE_HOME_EXT "
400+ echo " Addons folder: $OE_HOME_EXT /addons/"
401+ echo " Custom addons folder: $OE_HOME /custom/addons/"
355402echo " Password superadmin (database): $OE_SUPERADMIN "
356- echo " Start Odoo service: sudo service $OE_CONFIG start"
357- echo " Stop Odoo service: sudo service $OE_CONFIG stop"
358- echo " Restart Odoo service: sudo service $OE_CONFIG restart"
403+ echo " Start Odoo service: sudo systemctl start $OE_CONFIG "
404+ echo " Stop Odoo service: sudo systemctl stop $OE_CONFIG "
405+ echo " Restart Odoo service: sudo systemctl restart $OE_CONFIG "
406+ echo " Check Odoo status: sudo systemctl status $OE_CONFIG "
407+ echo " View Odoo logs: sudo journalctl -u $OE_CONFIG -f"
408+ if [ $INSTALL_NGINX = " True" ]; then
409+ echo " Nginx configuration file: /etc/nginx/sites-available/$WEBSITE_NAME "
410+ fi
359411echo " -----------------------------------------------------------"
0 commit comments