Skip to content

singleflo/odoo_auto_install

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

40 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ENGLISH VERSION

odoo_auto_install - Automatic Installation Script for Odoo

Compatibility

Ubuntu 24.04 LTS - Fully supported and optimized ✅ Odoo 18.0 - Complete configuration with all necessary dependencies ✅ PostgreSQL 16 - Optimized installation and configuration for better performance

Installation of Odoo 18.0 with Python virtual environment on Ubuntu 24.04

Features and Benefits

  1. Python virtual environment
  2. Odoo 18.0
  3. PostgreSQL 16
  4. Ability to install multiple Odoo instances on the same server
  5. Pre-configured configuration file
  6. Support for Nginx and SSL with Certbot
  7. UFW firewall configuration

Simple configuration to install Odoo 18.0 with a virtual environment on Ubuntu 24.04

Main settings:

################################################################################

OE_USER="odoo"
OE_HOME="/$OE_USER"
OE_HOME_EXT="/$OE_USER/${OE_USER}-server"
# Default port where this Odoo instance will run
INSTALL_WKHTMLTOPDF="True"
OE_PORT="8069"
# Odoo version to install
OE_VERSION="18.0"
# Set to True to install the Odoo Enterprise version
IS_ENTERPRISE="False"
# Install PostgreSQL V16 instead of the default version
INSTALL_POSTGRESQL="True"
INSTALL_POSTGRESQL_SIXTEEN="True"
# Set to True to install Nginx
INSTALL_NGINX="False"
# Superadmin password - if GENERATE_RANDOM_PASSWORD is set to "True" a random password will be generated
OE_SUPERADMIN="admin"
GENERATE_RANDOM_PASSWORD="True"
OE_CONFIG="${OE_USER}-server"
# Default longpolling port
LONGPOLLING_PORT="8072"
# Set to "True" to install certbot and enable SSL
ENABLE_SSL="False"
# Website name if using Nginx
WEBSITE_NAME="example.com"

GIT_USERNAME="crottolo"
GIT_PASSWORD="your-password-of-github"
################################################################################

Repository Configuration

You can configure public and private GitHub repositories:

## Configure multiple GitHub repositories

### Public and private repositories

##### GIT_USERNAME is your GitHub username for private repositories
##### GIT_PASSWORD is your GitHub password for private repositories

# Example of cloning a private repository
sudo git clone --depth 1 --branch 18.0 https://GIT_USERNAME:GIT_PASSWORD@github.com/crottolo/od_custom_app $OE_HOME/custom/od_custom_app

# Addon paths configured in the script
sub_dirs=(
  "${OE_HOME}/custom/addons"
  "${OE_HOME_EXT}/addons"
  "${OE_HOME}/custom/free_addons"
  "${OE_HOME}/custom/design-themes"
  "${OE_HOME}/custom/web"
  "${OE_HOME}/custom/social"
  "${OE_HOME}/custom/website"
  "${OE_HOME}/custom/od_custom_app"
  "${OE_HOME}/custom/partner-contact"
)

Installation

1. Requirements

  • Ubuntu 24.04
  • 2vCPU and 1GB RAM (minimum)
  • 8GB disk space

This script will work on Ubuntu 24.04, uses PostgreSQL as a database, so it's advisable to run it on a server with at least 1GB of memory. No swap is required. It will install Odoo 18.0 with a Python virtual environment in the home directory of the specified system user.

2. Get the script and make it executable

# Root user is required

wget https://raw.githubusercontent.com/crottolo/odoo_auto_install/refs/heads/18.0/install_odoo_ent.sh
chmod +x install_odoo_ent.sh
./install_odoo_ent.sh

When the installation is complete, you will see the following message:

-----------------------------------------------------------
Done! The Odoo server is up and running. Specifications:
Port: 8069
User service: odoo
Configuration file location: /etc/odoo-server.conf
Logfile location: /var/log/odoo
User PostgreSQL: odoo
Code location: /odoo
Addons folder: odoo/odoo-server/addons/
Password superadmin (database): dwer324fsdgdfgdg
Start Odoo service: sudo systemctl start odoo.service
Stop Odoo service: sudo systemctl stop odoo.service
Restart Odoo service: sudo systemctl restart odoo.service
-----------------------------------------------------------

During the process, a user with sudo privileges is created, e.g., odoo, and the configuration is separate from the root user.

3. Python Virtual Environment

To view the list of packages installed in the virtual environment:

sudo su - odoo
source /odoo/odoo-venv/bin/activate
pip list

# To install a new package
pip install "package-name-to-install"

deactivate

Example

root@odoo_server:~# sudo su odoo
odoo@odoo_server:/root$ cd
odoo@odoo_server:~$ ls
custom  odoo-server  odoo-venv
odoo@odoo_server:~$ source odoo-venv/bin/activate
(odoo-venv) odoo@odoo_server:~$ pip install pandas
Collecting pandas
  Downloading pandas-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.3/12.3 MB 47.6 MB/s eta 0:00:00
Requirement already satisfied: pytz>=2020.1 in ./odoo-venv/lib/python3.10/site-packages (from pandas) (2023.3.post1)
Collecting tzdata>=2022.1
  Downloading tzdata-2023.3-py2.py3-none-any.whl (341 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 341.8/341.8 KB 125.2 MB/s eta 0:00:00
Collecting numpy>=1.22.4
  Downloading numpy-1.26.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.2/18.2 MB 54.6 MB/s eta 0:00:00
Collecting python-dateutil>=2.8.2
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 KB 109.6 MB/s eta 0:00:00
Requirement already satisfied: six>=1.5 in ./odoo-venv/lib/python3.10/site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)
Installing collected packages: tzdata, python-dateutil, numpy, pandas
  Attempting uninstall: python-dateutil
    Found existing installation: python-dateutil 2.8.1
    Uninstalling python-dateutil-2.8.1:
      Successfully uninstalled python-dateutil-2.8.1
Successfully installed numpy-1.26.0 pandas-2.1.1 python-dateutil-2.8.2 tzdata-2023.3
(odoo-venv) odoo@odoo_server:~$ deactivate 
odoo@odoo_server:~$ 

It's important to activate the virtual environment before installing packages and then deactivate it. You can see the confirmation of the virtual environment activation in the prompt: (odoo-venv) odoo@odoo_server: pip install pandas and the deactivation in the prompt: (odoo@odoo_server:~$)

After installing the package, you can deactivate the virtual environment:

(odoo-venv) odoo@odoo_server:~$ deactivate
odoo@odoo_server:~$ 

4. Verify the server's IP address

curl ifconfig.me

5. Create a database at the server's IP address

http://ip-address:8069/web/database/manager

6. Nginx Configuration

The script supports automatic installation and configuration of Nginx. If you set INSTALL_NGINX="True", the Nginx web server will be installed and configured to work with Odoo.

If you also set ENABLE_SSL="True" and provide a valid domain name in WEBSITE_NAME, Certbot will be installed to automatically configure SSL/HTTPS.

Manual Configuration of Nginx Proxy Manager

If you prefer to use Nginx Proxy Manager on a separate server, here are some recommended configurations:

Forward hostname / ip: internal server IP address

Forward port: 8069

Websockets Support: true

Configuration for Odoo 18.0

Custom locations: "/"

proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# Add Headers for odoo proxy mode
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;
proxy_redirect off;

Custom locations: "/websocket"

proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# Add Headers for odoo proxy mode
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;

Advanced: "Custom nginx configuration"

# common gzip
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
client_body_in_file_only clean;
client_body_buffer_size 32K;
client_max_body_size 500M;
sendfile on;
send_timeout 600s;
keepalive_timeout 300;

7. Additional Font Installation

To improve PDF generation with wkhtmltopdf, you can install additional fonts:

apt install ttf-mscorefonts-installer
wget -q -O - https://gist.githubusercontent.com/Blastoise/b74e06f739610c4a867cf94b27637a56/raw/96926e732a38d3da860624114990121d71c08ea1/tahoma.sh | bash
wget https://gist.githubusercontent.com/maxwelleite/913b6775e4e408daa904566eb375b090/raw/ttf-ms-tahoma-installer.sh -q -O - | sudo bash

8. New Features in Version 18.0

The updated script for Odoo 18.0 includes several improvements:

  1. Support for Ubuntu 24.04 - Optimized for the latest LTS version of Ubuntu
  2. PostgreSQL 16 - Support for the latest version of PostgreSQL
  3. Systemd instead of init.d - Use of the modern service management system
  4. UFW Configuration - Automatic firewall configuration
  5. Dependency Simplification - No longer necessary to force specific versions of pyopenssl and cryptography
  6. Configuration Improvements - More complete and optimized configuration file

9. Conclusion

You have successfully installed Odoo 18.0 with a Python virtual environment on Ubuntu 24.04. This configuration allows you to run multiple instances on the same server and offers a ready-to-use configuration for rapid deployment.

If you found this script useful, consider giving it a "like" on its GitHub repository. For more content like this, subscribe and "like" the CrottoCode YouTube channel.

Your support helps create more useful content. Thank you!


VERSIONE ITALIANA

odoo_auto_install - Script di Installazione Automatica per Odoo

Compatibilità

Ubuntu 24.04 LTS - Completamente supportato e ottimizzato ✅ Odoo 18.0 - Configurazione completa con tutte le dipendenze necessarie ✅ PostgreSQL 16 - Installazione e configurazione ottimizzata per prestazioni migliori

Installazione di Odoo 18.0 con ambiente virtuale su Ubuntu 24.04

Caratteristiche e Vantaggi

  1. Ambiente virtuale Python
  2. Odoo 18.0
  3. PostgreSQL 16
  4. Possibilità di installare più istanze di Odoo sullo stesso server
  5. File di configurazione preimpostato
  6. Supporto per Nginx e SSL con Certbot
  7. Configurazione del firewall UFW

Configurazione semplice per installare Odoo 18.0 con ambiente virtuale su Ubuntu 24.04

Impostazioni principali:

################################################################################

OE_USER="odoo"
OE_HOME="/$OE_USER"
OE_HOME_EXT="/$OE_USER/${OE_USER}-server"
# Porta predefinita su cui questa istanza di Odoo verrà eseguita
INSTALL_WKHTMLTOPDF="True"
OE_PORT="8069"
# Versione di Odoo da installare
OE_VERSION="18.0"
# Impostare su True per installare la versione enterprise di Odoo
IS_ENTERPRISE="False"
# Installa PostgreSQL V16 invece della versione predefinita
INSTALL_POSTGRESQL="True"
INSTALL_POSTGRESQL_SIXTEEN="True"
# Impostare su True per installare Nginx
INSTALL_NGINX="False"
# Password superadmin - se GENERATE_RANDOM_PASSWORD è impostato su "True" verrà generata automaticamente
OE_SUPERADMIN="admin"
GENERATE_RANDOM_PASSWORD="True"
OE_CONFIG="${OE_USER}-server"
# Porta longpolling predefinita
LONGPOLLING_PORT="8072"
# Impostare su "True" per installare certbot e abilitare SSL
ENABLE_SSL="False"
# Nome del sito web se si utilizza Nginx
WEBSITE_NAME="example.com"

GIT_USERNAME="crottolo"
GIT_PASSWORD="your-password-of-github"
################################################################################

Configurazione dei repository

È possibile configurare repository GitHub pubblici e privati:

## Configurazione di più repository GitHub

### Repository pubblici e privati

##### GIT_USERNAME è il tuo nome utente GitHub per repository privati
##### GIT_PASSWORD è la tua password GitHub per repository privati

# Esempio di clonazione di un repository privato
sudo git clone --depth 1 --branch 18.0 https://GIT_USERNAME:GIT_PASSWORD@github.com/crottolo/od_custom_app $OE_HOME/custom/od_custom_app

# Percorsi degli addons configurati nello script
sub_dirs=(
  "${OE_HOME}/custom/addons"
  "${OE_HOME_EXT}/addons"
  "${OE_HOME}/custom/free_addons"
  "${OE_HOME}/custom/design-themes"
  "${OE_HOME}/custom/web"
  "${OE_HOME}/custom/social"
  "${OE_HOME}/custom/website"
  "${OE_HOME}/custom/od_custom_app"
  "${OE_HOME}/custom/partner-contact"
)

Installazione

1. Requisiti

  • Ubuntu 24.04
  • 2vCPU e 1GB RAM (minimo)
  • 8GB di spazio su disco

Questo script funzionerà su Ubuntu 24.04, utilizza PostgreSQL come database, quindi è consigliabile eseguirlo su un server con almeno 1GB di memoria. Non è necessaria la swap. Installerà Odoo 18.0 con ambiente virtuale nella directory home dell'utente di sistema specificato.

2. Ottenere lo script e renderlo eseguibile

# È richiesto l'utente root

wget https://raw.githubusercontent.com/crottolo/odoo_auto_install/refs/heads/18.0/install_odoo_ent.sh
chmod +x install_odoo_ent.sh
./install_odoo_ent.sh

Al termine dell'installazione, vedrai il seguente messaggio:

-----------------------------------------------------------
Done! The Odoo server is up and running. Specifications:
Port: 8069
User service: odoo
Configuraton file location: /etc/odoo-server.conf
Logfile location: /var/log/odoo
User PostgreSQL: odoo
Code location: /odoo
Addons folder: odoo/odoo-server/addons/
Password superadmin (database): dwer324fsdgdfgdg
Start Odoo service: sudo systemctl start odoo.service
Stop Odoo service: sudo systemctl stop odoo.service
Restart Odoo service: sudo systemctl restart odoo.service
-----------------------------------------------------------

Durante il processo viene creato un utente con privilegi sudo, ad esempio odoo, e la configurazione è separata dall'utente root.

3. Ambiente virtuale Python

Per visualizzare l'elenco dei pacchetti installati nell'ambiente virtuale:

sudo su - odoo
source /odoo/odoo-venv/bin/activate
pip list

# Per installare un nuovo pacchetto
pip install "nome-pacchetto-da-installare"

deactivate

Esempio

root@odoo_server:~# sudo su odoo
odoo@odoo_server:/root$ cd
odoo@odoo_server:~$ ls
custom  odoo-server  odoo-venv
odoo@odoo_server:~$ source odoo-venv/bin/activate
(odoo-venv) odoo@odoo_server:~$ pip install pandas
Collecting pandas
  Downloading pandas-2.1.1-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (12.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 12.3/12.3 MB 47.6 MB/s eta 0:00:00
Requirement already satisfied: pytz>=2020.1 in ./odoo-venv/lib/python3.10/site-packages (from pandas) (2023.3.post1)
Collecting tzdata>=2022.1
  Downloading tzdata-2023.3-py2.py3-none-any.whl (341 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 341.8/341.8 KB 125.2 MB/s eta 0:00:00
Collecting numpy>=1.22.4
  Downloading numpy-1.26.0-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.2 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.2/18.2 MB 54.6 MB/s eta 0:00:00
Collecting python-dateutil>=2.8.2
  Downloading python_dateutil-2.8.2-py2.py3-none-any.whl (247 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 247.7/247.7 KB 109.6 MB/s eta 0:00:00
Requirement already satisfied: six>=1.5 in ./odoo-venv/lib/python3.10/site-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)
Installing collected packages: tzdata, python-dateutil, numpy, pandas
  Attempting uninstall: python-dateutil
    Found existing installation: python-dateutil 2.8.1
    Uninstalling python-dateutil-2.8.1:
      Successfully uninstalled python-dateutil-2.8.1
Successfully installed numpy-1.26.0 pandas-2.1.1 python-dateutil-2.8.2 tzdata-2023.3
(odoo-venv) odoo@odoo_server:~$ deactivate 
odoo@odoo_server:~$ 

È importante attivare l'ambiente virtuale prima di installare i pacchetti e poi disattivarlo. Puoi vedere la conferma dell'attivazione dell'ambiente virtuale nel prompt: (odoo-venv) odoo@odoo_server: pip install pandas e la disattivazione nel prompt: (odoo@odoo_server:~$)

Dopo l'installazione del pacchetto, puoi disattivare l'ambiente virtuale:

(odoo-venv) odoo@odoo_server:~$ deactivate
odoo@odoo_server:~$ 

4. Verificare l'indirizzo IP del server

curl ifconfig.me

5. Creare un database all'indirizzo IP del server

http://indirizzo-ip:8069/web/database/manager

6. Configurazione Nginx

Lo script supporta l'installazione e la configurazione automatica di Nginx. Se hai impostato INSTALL_NGINX="True", il server web Nginx verrà installato e configurato per funzionare con Odoo.

Se hai anche impostato ENABLE_SSL="True" e fornito un nome di dominio valido in WEBSITE_NAME, verrà installato Certbot per configurare automaticamente SSL/HTTPS.

Configurazione manuale di Nginx Proxy Manager

Se preferisci utilizzare Nginx Proxy Manager su un server separato, ecco alcune configurazioni consigliate:

Forward hostname / ip: indirizzo IP del server interno

Forward port: 8069

Websockets Support: true

Configurazione per Odoo 18.0

Custom locations: "/"

proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# Add Headers for odoo proxy mode
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;
proxy_redirect off;

Custom locations: "/websocket"

proxy_read_timeout 720s;
proxy_connect_timeout 720s;
proxy_send_timeout 720s;
# Add Headers for odoo proxy mode
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;

Advanced: "Custom nginx configuration"

# common gzip
gzip_types text/css text/less text/plain text/xml application/xml application/json application/javascript;
gzip on;
client_body_in_file_only clean;
client_body_buffer_size 32K;
client_max_body_size 500M;
sendfile on;
send_timeout 600s;
keepalive_timeout 300;

7. Installazione di font aggiuntivi

Per migliorare la generazione di PDF con wkhtmltopdf, puoi installare font aggiuntivi:

apt install ttf-mscorefonts-installer
wget -q -O - https://gist.githubusercontent.com/Blastoise/b74e06f739610c4a867cf94b27637a56/raw/96926e732a38d3da860624114990121d71c08ea1/tahoma.sh | bash
wget https://gist.githubusercontent.com/maxwelleite/913b6775e4e408daa904566eb375b090/raw/ttf-ms-tahoma-installer.sh -q -O - | sudo bash

8. Novità nella versione 18.0

La versione aggiornata dello script per Odoo 18.0 include diverse migliorie:

  1. Supporto per Ubuntu 24.04 - Ottimizzato per l'ultima versione LTS di Ubuntu
  2. PostgreSQL 16 - Supporto per la versione più recente di PostgreSQL
  3. Systemd invece di init.d - Utilizzo del sistema moderno di gestione dei servizi
  4. Configurazione UFW - Configurazione automatica del firewall
  5. Semplificazione delle dipendenze - Non è più necessario forzare versioni specifiche di pyopenssl e cryptography
  6. Miglioramenti alla configurazione - File di configurazione più completo e ottimizzato

9. Conclusione

Hai installato con successo Odoo 18.0 con un ambiente virtuale Python su Ubuntu 24.04. Questa configurazione ti permette di eseguire più istanze sullo stesso server e offre una configurazione pronta all'uso per una rapida implementazione.

Se hai trovato utile questo script, considera di dargli un "like" sul suo repository GitHub. Per altri contenuti come questo, iscriviti e metti "mi piace" al canale YouTube CrottoCode.

Il tuo supporto aiuta a creare altri contenuti utili. Grazie!

About

Installation of odoo 15 16 17 18 with virtual env on Ubuntu 22.04-24.04

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages