Skip to content

mah007/OdooScript

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Enhanced Odoo Installer

License: MIT Ubuntu Odoo Nginx PostgreSQL

Professional Odoo installation script with domain configuration, official Nginx, SSL certificates, and dynamic configuration generation for Ubuntu 22.04

πŸš€ Quick Start

# Download the installer
wget https://raw.githubusercontent.com/mah007/OdooScript/refs/heads/16.0/odoo_installer.sh
# Make it executable
chmod +x odoo_installer.sh

# Run the installer
sudo ./odoo_installer.sh

πŸ“‹ Table of Contents

✨ Features

🌐 Domain & DNS Management

  • Interactive domain configuration with validation
  • Automatic DNS verification and IP detection
  • Support for both domain-based and IP-based installations
  • Graceful fallback for DNS misconfigurations

πŸ”§ Official Nginx Installation

  • Latest Nginx version from official nginx.org repository (1.20.5+)
  • Automatic removal of outdated Ubuntu stock versions
  • Proper repository configuration with signing keys
  • Modern SSL/TLS configuration with security headers

πŸ”’ SSL Certificate Automation

  • Let's Encrypt: Automated certificate generation with Certbot
  • Self-signed: Fallback certificates for testing environments
  • Automatic certificate renewal setup
  • Modern TLS 1.2/1.3 configuration

βš™οΈ Dynamic Configuration

  • Native Odoo configuration generation using odoo-bin
  • Clean configuration without forced master passwords
  • Automatic proxy mode detection for Nginx setups
  • Secure file permissions and ownership

πŸ›‘οΈ Enterprise-Grade Security

  • Comprehensive error handling with graceful degradation
  • Detailed logging and audit trails
  • Secure user and permission management
  • Modern cryptographic standards

πŸ“Š Advanced Monitoring

  • Real-time progress tracking with visual indicators
  • Multi-level logging (DEBUG, INFO, WARNING, ERROR)
  • Installation validation and health checks
  • Comprehensive installation reports

πŸ–₯️ System Requirements

Operating System

  • Ubuntu 22.04 LTS (Jammy Jellyfish)
  • Root or sudo privileges required

Hardware Requirements

Component Minimum Recommended
RAM 2GB 4GB+
Storage 10GB 20GB+
CPU 1 core 2+ cores

Network Requirements

  • Internet connection for package downloads
  • Domain name (optional, IP fallback available)
  • Open ports: 80 (HTTP), 443 (HTTPS), 8069 (Odoo direct)

πŸ”„ Installation Process

The installer follows an 8-step automated process:

Step 1: Pre-flight Checks

  • System requirements validation
  • Ubuntu version verification
  • Disk space and memory checks
  • Internet connectivity testing

Step 2: System Preparation

  • User and group creation (odoo user)
  • System package updates
  • Locale configuration
  • Basic tool installation

Step 3: Database Setup

  • PostgreSQL 16 installation from official repository
  • Database user configuration
  • Service enablement and startup
  • Connection testing

Step 4: Dependencies Installation

  • Python 3.11 packages and libraries
  • System development tools
  • Node.js and npm packages
  • Odoo-specific dependencies

Step 5: Wkhtmltopdf Installation

  • PDF generation library installation
  • Architecture detection (x64/x32)
  • Version verification
  • Integration testing

Step 6: Odoo Installation

  • Source code download from official repository
  • Python requirements installation
  • Directory structure creation
  • Permission configuration

Step 7: Service Configuration

  • Systemd service file creation
  • Nginx installation and configuration
  • SSL certificate generation/installation
  • Service enablement

Step 8: Final Setup

  • Installation validation
  • Service health checks
  • Report generation
  • Success confirmation

πŸ—οΈ Technical Architecture

Core Components

Enhanced Odoo Installer
β”œβ”€β”€ Configuration Management
β”‚   β”œβ”€β”€ Domain validation and DNS checking
β”‚   β”œβ”€β”€ SSL certificate type selection
β”‚   └── Dynamic Odoo configuration generation
β”œβ”€β”€ Package Management
β”‚   β”œβ”€β”€ Official repository integration
β”‚   β”œβ”€β”€ Dependency resolution
β”‚   └── Version compatibility checking
β”œβ”€β”€ Service Management
β”‚   β”œβ”€β”€ Systemd service configuration
β”‚   β”œβ”€β”€ Process monitoring
β”‚   └── Automatic startup configuration
└── Security Framework
    β”œβ”€β”€ User privilege management
    β”œβ”€β”€ File permission enforcement
    └── SSL/TLS implementation

Script Structure

odoo_installer.sh
β”œβ”€β”€ Global Variables & Configuration
β”œβ”€β”€ Utility Functions
β”‚   β”œβ”€β”€ Logging system
β”‚   β”œβ”€β”€ Progress tracking
β”‚   β”œβ”€β”€ Error handling
β”‚   └── User interaction
β”œβ”€β”€ Validation Functions
β”‚   β”œβ”€β”€ System requirements
β”‚   β”œβ”€β”€ Network connectivity
β”‚   └── Version compatibility
β”œβ”€β”€ Installation Functions
β”‚   β”œβ”€β”€ step_preflight_checks()
β”‚   β”œβ”€β”€ step_system_preparation()
β”‚   β”œβ”€β”€ step_database_setup()
β”‚   β”œβ”€β”€ step_dependencies_installation()
β”‚   β”œβ”€β”€ step_wkhtmltopdf_installation()
β”‚   β”œβ”€β”€ step_odoo_installation()
β”‚   β”œβ”€β”€ step_service_configuration()
β”‚   └── step_final_setup()
β”œβ”€β”€ Nginx & SSL Functions
β”‚   β”œβ”€β”€ install_official_nginx()
β”‚   β”œβ”€β”€ generate_self_signed_ssl()
β”‚   β”œβ”€β”€ install_letsencrypt_ssl()
β”‚   └── create_nginx_odoo_config()
└── Main Execution Flow

βš™οΈ Configuration Options

Odoo Versions Supported

  • Odoo 14.0 (LTS)
  • Odoo 15.0
  • Odoo 16.0
  • Odoo 17.0
  • Odoo 18.0 (Latest)

Installation Modes

Domain-based Installation

# User provides domain name
Domain: odoo.example.com
SSL: Let's Encrypt (automatic)
Access: https://odoo.example.com

IP-based Installation

# No domain provided
Domain: Server IP address
SSL: Self-signed certificate
Access: https://[server-ip]

Generated Configuration Files

Odoo Configuration (/etc/odoo/odoo.conf)

[options]
; Basic Odoo configuration
db_host = localhost
db_port = 5432
db_user = odoo
db_password = False
addons_path = /odoo/odoo/addons
logfile = /var/log/odoo/odoo-server.log
log_level = info
; Proxy mode configuration (when Nginx is installed)
proxy_mode = True

Systemd Service (/etc/systemd/system/odoo.service)

[Unit]
Description=Odoo
Documentation=http://www.odoo.com
Requires=postgresql.service
After=postgresql.service

[Service]
Type=simple
SyslogIdentifier=odoo
PermissionsStartOnly=true
User=odoo
Group=odoo
ExecStart=/odoo/odoo/odoo-bin -c /etc/odoo/odoo.conf
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target

πŸ”’ SSL Certificate Management

Let's Encrypt Integration

The installer uses Certbot via snapd for Let's Encrypt certificates:

# Automatic installation process
1. Install snapd (if not present)
2. Install certbot via snap
3. Create temporary Nginx configuration
4. Obtain SSL certificate
5. Configure automatic renewal
6. Update Nginx configuration

Certificate Renewal

# Test renewal (dry run)
certbot renew --dry-run

# Manual renewal
certbot renew

# Automatic renewal (configured by installer)
systemctl status snap.certbot.renew.timer

Self-signed Certificates

For testing or internal use:

# Certificate generation
openssl req -x509 -nodes -days 365 -newkey rsa:2048 \
    -keyout /etc/ssl/nginx/server.key \
    -out /etc/ssl/nginx/server.crt \
    -subj "/C=US/ST=State/L=City/O=Organization/OU=OrgUnit/CN=$DOMAIN_NAME"

🌐 Nginx Configuration

Reverse Proxy Setup

The installer creates a production-ready Nginx configuration:

# Upstream configuration
upstream odoo {
  server 127.0.0.1:8069;
}
upstream odoochat {
  server 127.0.0.1:8072;
}

# HTTP to HTTPS redirect
server {
  listen 80;
  server_name example.com;
  rewrite ^(.*) https://$host$1 permanent;
}

# HTTPS server block
server {
  listen 443 ssl;
  server_name example.com;
  
  # SSL configuration
  ssl_certificate /path/to/certificate;
  ssl_certificate_key /path/to/private/key;
  ssl_protocols TLSv1.2 TLSv1.3;
  
  # Proxy configuration
  location / {
    proxy_pass http://odoo;
    proxy_set_header X-Forwarded-Host $http_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;
  }
  
  # WebSocket support
  location /websocket {
    proxy_pass http://odoochat;
    proxy_set_header Upgrade $http_upgrade;
    proxy_set_header Connection $connection_upgrade;
  }
}

Security Headers

# Security enhancements
add_header Strict-Transport-Security "max-age=31536000; includeSubDomains";
proxy_cookie_flags session_id samesite=lax secure;

πŸ”§ Troubleshooting

Common Issues

DNS Resolution Problems

# Check DNS configuration
dig +short your-domain.com

# Verify server IP
curl -s ifconfig.me

# Test domain resolution
nslookup your-domain.com

Service Status Checks

# Check Odoo service
systemctl status odoo
journalctl -u odoo -f

# Check PostgreSQL
systemctl status postgresql
sudo -u postgres psql -l

# Check Nginx (if installed)
systemctl status nginx
nginx -t

Log File Locations

# Installation logs
/tmp/odoo_install_YYYYMMDD_HHMMSS.log

# Odoo application logs
/var/log/odoo/odoo-server.log

# Nginx logs (if installed)
/var/log/nginx/odoo.access.log
/var/log/nginx/odoo.error.log

# System logs
journalctl -u odoo
journalctl -u nginx

Port Configuration

Service Port Protocol Purpose
Odoo 8069 HTTP Web interface
Odoo 8072 HTTP WebSocket/Chat
Nginx 80 HTTP HTTP redirect
Nginx 443 HTTPS Secure web access
PostgreSQL 5432 TCP Database

File Permissions

# Odoo directories
/odoo/odoo/          - odoo:odoo (755)
/etc/odoo/           - odoo:odoo (755)
/var/log/odoo/       - odoo:odoo (755)

# Configuration files
/etc/odoo/odoo.conf  - odoo:odoo (640)

# SSL certificates
/etc/ssl/nginx/      - root:root (644/600)

πŸ§ͺ Testing the Installation

Basic Functionality Test

# Test Odoo web interface
curl -I http://localhost:8069

# Test with Nginx (if installed)
curl -I https://your-domain.com

# Check database connectivity
sudo -u odoo psql -h localhost -p 5432 -U odoo -l

SSL Certificate Validation

# Check certificate details
openssl x509 -in /path/to/certificate -text -noout

# Test SSL connection
openssl s_client -connect your-domain.com:443 -servername your-domain.com

πŸ“Š Performance Optimization

Recommended System Tuning

PostgreSQL Configuration

-- /etc/postgresql/16/main/postgresql.conf
shared_buffers = 256MB
effective_cache_size = 1GB
maintenance_work_mem = 64MB
checkpoint_completion_target = 0.9
wal_buffers = 16MB
default_statistics_target = 100

Nginx Optimization

# /etc/nginx/nginx.conf
worker_processes auto;
worker_connections 1024;
keepalive_timeout 65;
client_max_body_size 100M;

Odoo Configuration Tuning

# /etc/odoo/odoo.conf
workers = 4
max_cron_threads = 2
limit_memory_hard = 2684354560
limit_memory_soft = 2147483648
limit_request = 8192
limit_time_cpu = 600
limit_time_real = 1200

πŸ”„ Backup and Maintenance

Database Backup

# Create database backup
sudo -u odoo pg_dump -h localhost -p 5432 -U odoo database_name > backup.sql

# Restore database
sudo -u odoo psql -h localhost -p 5432 -U odoo -d database_name < backup.sql

File System Backup

# Backup Odoo files
tar -czf odoo_backup.tar.gz /odoo/odoo /etc/odoo /var/log/odoo

# Backup SSL certificates
tar -czf ssl_backup.tar.gz /etc/ssl/nginx /etc/letsencrypt

Update Procedures

# Update Odoo to newer version
cd /odoo/odoo
git fetch origin
git checkout 17.0  # or desired version
sudo systemctl restart odoo

# Update system packages
sudo apt update && sudo apt upgrade

# Update SSL certificates
sudo certbot renew

🀝 Contributing

We welcome contributions to improve the Enhanced Odoo Installer! Here's how you can help:

Development Setup

# Clone the repository
git clone https://github.com/mah007/OdooScript.git
cd OdooScript

# Create a feature branch
git checkout -b feature/your-feature-name

# Make your changes and test
./odoo_installer.sh

# Commit and push
git commit -m "Add your feature description"
git push origin feature/your-feature-name

Testing Guidelines

  • Test on clean Ubuntu 22.04 installations
  • Verify both domain and IP-based installations
  • Test SSL certificate generation (both Let's Encrypt and self-signed)
  • Validate all Odoo versions (14.0-18.0)
  • Check error handling and recovery scenarios

Code Style

  • Use consistent bash scripting practices
  • Add comments for complex logic
  • Follow the existing function naming convention
  • Include proper error handling
  • Update documentation for new features

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

  • Odoo for the amazing ERP platform
  • Nginx for the high-performance web server
  • Let's Encrypt for free SSL certificates
  • PostgreSQL for the robust database system
  • The open-source community for continuous inspiration

πŸ“ž Support


Made with ❀️ for the Odoo community By Mahmoud Abdel Latif

Website β€’ Documentation β€’ Issues

OdooScript

Odoo dependence installation script for Ubuntu 14.04 , 15.04 ,16.04 ,20.04 , 22.04 ,*24.04(universal)
make your envirument ready for all kind of odoo with pycharm IDE after run the script u have to download odoo manully

ssh-keygen -t ed25519 -C "your_email@example.com"

Copy this script and run it on your terminal

./odoo-bin -w a -s -c ../odoo.conf --stop-after-init

./odoo-bin -w a -s -c /etc/odoo/odoo.conf --stop-after-init

export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
sudo dpkg-reconfigure locales

########################################################################
adduser odoo

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

apt-get update
apt-get install software-properties-common
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install python-certbot-apache
sudo certbot --apache
#######################################################################

wget https://raw.githubusercontent.com/mah007/OdooScript/12.0/nginx.sh
bash nginx.sh

apt-get update
apt-get install software-properties-common -y
add-apt-repository universe
add-apt-repository ppa:certbot/certbot
apt-get update
apt-get install certbot python-certbot-nginx -y

sudo certbot --nginx

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

nano /etc/apt/sources.list.d/pgdg.list
deb deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -

sudo apt-get update

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

sudo su - postgres -c "createuser -s odoo" 2> /dev/null || true
wget https://raw.githubusercontent.com/mah007/OdooScript/master/odoo_pro.sh
sudo /bin/sh odoo_pro.sh

wget http://software.virtualmin.com/gpl/scripts/install.sh
sh /root/install.sh -b LEMP

PG UTF*

sudo su postgres
psql
update pg_database set datistemplate=false where datname='template1';
drop database Template1;
create database template1 with owner=postgres encoding='UTF-8'
lc_collate='en_US.utf8' lc_ctype='en_US.utf8' template template0;
update pg_database set datistemplate=true where datname='template1';

About

Odoo 14,15,16,18 installation script for Ubuntu 22.04, (universal)

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages