Skip to content

Commit a88b2c9

Browse files
committed
This commit resolves the current Debian installation issue in version 19.0.
And incorporates all relevant improvements previously applied to the Ubuntu installation script, adapting them for Debian compatibility: - 714461b - e31ee34
1 parent ff38f9f commit a88b2c9

File tree

4 files changed

+130
-31
lines changed

4 files changed

+130
-31
lines changed

odoo_install_debian.sh

Lines changed: 83 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,15 @@
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+
1827
OE_USER="odoo"
1928
OE_HOME="/$OE_USER"
2029
OE_HOME_EXT="/$OE_USER/${OE_USER}-server"
@@ -25,9 +34,11 @@ INSTALL_WKHTMLTOPDF="True"
2534
OE_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!
3039
IS_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!
3243
INSTALL_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
#--------------------------------------------------
6273
echo -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

65105
echo -e "\n---- Creating the ODOO PostgreSQL User ----"
66106
sudo 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
#--------------------------------------------------
71111
echo -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

75115
echo -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

78121
echo -e "\n---- Installing nodeJS NPM and rtlcss for LTR support ----"
79122
sudo 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
139182
fi
140183

141184
echo -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

145187
echo -e "\n---- Setting permissions on home folder ----"
146188
sudo 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+
}
335379
EOF
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"
343387
else
344388
echo "Nginx isn't installed due to choice of the user!"
345389
fi
@@ -349,11 +393,19 @@ echo "-----------------------------------------------------------"
349393
echo "Done! The Odoo server is up and running. Specifications:"
350394
echo "Port: $OE_PORT"
351395
echo "User service: $OE_USER"
396+
echo "Configuration file location: /etc/${OE_CONFIG}.conf"
397+
echo "Logfile location: /var/log/$OE_USER"
352398
echo "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/"
355402
echo "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
359411
echo "-----------------------------------------------------------"

test_install/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Odoo 19 Installer Test Environment
22

33
This folder provides a minimal Docker setup to exercise the `odoo_install.sh` script in a clean Ubuntu 24.04 container.
4+
The setup for Debian is similar and can be found in the `debian/` subfolder.
45

56
## Prerequisites
67
- Docker 24+

test_install/debian/Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
FROM debian:12
2+
3+
ENV DEBIAN_FRONTEND=noninteractive
4+
5+
# Install base tools needed by the installer script.
6+
RUN set -eux; \
7+
timezone=$(cat /etc/timezone 2>/dev/null || echo Etc/UTC); \
8+
export TZ="${timezone}"; \
9+
apt-get update; \
10+
apt-get install -y --no-install-recommends \
11+
sudo ca-certificates curl wget gnupg lsb-release locales apt-utils tzdata \
12+
systemd systemd-sysv dbus; \
13+
ln -snf "/usr/share/zoneinfo/${timezone}" /etc/localtime; \
14+
echo "${timezone}" > /etc/timezone; \
15+
sed -i 's/# en_US.UTF-8 UTF-8/en_US.UTF-8 UTF-8/' /etc/locale.gen; \
16+
locale-gen en_US.UTF-8; \
17+
update-locale LANG=en_US.UTF-8 LC_ALL=en_US.UTF-8; \
18+
# Remove unnecessary systemd services for container use \
19+
systemctl mask \
20+
dev-hugepages.mount \
21+
sys-fs-fuse-connections.mount \
22+
sys-kernel-config.mount \
23+
display-manager.service \
24+
graphical.target \
25+
systemd-logind.service \
26+
systemd-remount-fs.service \
27+
getty.target \
28+
console-getty.service; \
29+
rm -rf /var/lib/apt/lists/*
30+
31+
# Initialize systemd and keep container running
32+
CMD ["/lib/systemd/systemd"]
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
services:
2+
odoo19:
3+
build: .
4+
container_name: odoo19
5+
restart: unless-stopped
6+
tty: true
7+
stdin_open: true
8+
privileged: true
9+
volumes:
10+
- ../../odoo_install_debian.sh:/opt/odoo-install/odoo_install.sh
11+
- /sys/fs/cgroup:/sys/fs/cgroup:rw
12+
tmpfs:
13+
- /run
14+
- /tmp

0 commit comments

Comments
 (0)