This repository contains a comprehensive bash script to automate the deployment of a production-ready Odoo 18 Enterprise instance on a clean Ubuntu 24.04 LTS server.
The script is designed with DevOps best practices in mind, creating a secure, scalable, and manageable Odoo environment. It goes beyond a basic installation by configuring a full web stack with performance tuning and security hardening.
- 🚀 Fully Automated: From system updates to a live, running Odoo instance with a single command.
- 🛡️ Secure by Default:
- Runs Odoo under a dedicated, non-root system user.
- Sets up and enables a
UFWfirewall. - Automatically obtains and configures a free SSL certificate from Let's Encrypt (HTTPS).
- Generates strong, random passwords for the database and Odoo admin.
- ⚡ Performance Tuned:
- Configures Nginx as a high-performance reverse proxy.
- Enables WebSocket support for real-time features (like Live Chat), with a fallback to longpolling.
- Automatically calculates the optimal number of Odoo workers based on server CPU cores.
- 📦 Enterprise & Custom Addons Ready: Clones community, enterprise, and your custom addons repositories into the correct structure.
- ⚙️ Robust Management:
- Creates a
systemdservice to manage the Odoo application (start, stop, status) and enable auto-start on boot. - Organizes configuration, logs, and Odoo source code in a clean, predictable directory structure.
- Creates a
Before running the script, you must have the following:
- A clean Ubuntu 24.04 LTS server.
- Root (
sudo) access to the server. - A domain or subdomain (e.g.,
odoo.yourcompany.com) pointing to your server's public IP address. This is required for SSL certificate generation. - Access to the Odoo Enterprise GitHub repository. You will need a URL with a Personal Access Token (PAT) for automated cloning.
- Example URL:
https://YOUR_USERNAME:[email protected]/odoo/enterprise.git
- Example URL:
-
Clone this repository:
git clone https://github.com/your-username/your-repo-name.git cd your-repo-name -
Make the script executable:
chmod +x odoo-installation-script.sh
-
Run the script as root:
sudo ./odoo-installation-script.sh
-
Follow the prompts: The script will ask for your domain name, an email address for SSL notifications, and the Git URLs for your Odoo Enterprise and custom addons repositories.
The script will handle the rest. Once completed, it will display a summary with your Odoo URL and the generated passwords.
The script provisions the following components:
| Component | Details |
|---|---|
| Operating System | Ubuntu 24.04 LTS |
| Database | PostgreSQL |
| Application Server | Odoo 18.0 (from source) |
| Python Environment | Python 3 venv for dependency isolation |
| Odoo Source | /opt/odoo18e/ (community, enterprise, custom_addons) |
| Process Manager | systemd (odoo18e.service) |
| Reverse Proxy | Nginx (with WebSocket & SSL termination) |
| Security | UFW Firewall & Let's Encrypt SSL |
| PDF Rendering | wkhtmltopdf (patched version) |
Manage the Odoo application using systemctl:
# Check the status of the Odoo service
sudo systemctl status odoo18e
# Start the Odoo service
sudo systemctl start odoo18e
# Stop the Odoo service
sudo systemctl stop odoo18e
# Restart the Odoo service (e.g., after adding new custom modules)
sudo systemctl restart odoo18eTo view real-time logs for the Odoo application:
sudo journalctl -fu odoo18e- Add your new custom module to the
/opt/odoo18e/custom_addonsdirectory (e.g., viagit pull). - Restart the Odoo service:
sudo systemctl restart odoo18e. - Log in to Odoo, go to the Apps menu, and click Update Apps List.
- Your new module will now be available for installation.
The primary configuration variables (like the Odoo system user name) are located at the top of the provision_odoo18e.sh script. You can modify them before running the script if needed.
If you need to completely remove Odoo from your server, use the included uninstallation script:
The odoo-uninstall.sh script provides a complete cleanup:
- 🛑 Stops and removes the Odoo systemd service
- 👤 Deletes the Odoo system user and home directory (
/opt/odoo) - 🗄️ Removes PostgreSQL odoo user and all Odoo databases
- 📝 Cleans up Odoo configuration files and logs
- 🌐 Removes Nginx Odoo configuration
- 🔐 Optionally removes SSL certificates
- 📦 Optionally removes system dependencies (PostgreSQL, Nginx, wkhtmltopdf, etc.)
- 🔥 Updates firewall rules
-
Make the script executable:
chmod +x odoo-uninstall.sh
-
Run the script as root:
sudo ./odoo-uninstall.sh
-
Follow the prompts: The script will ask for confirmation before proceeding and provide options for:
- Removing all databases (including non-Odoo databases)
- Removing SSL certificates
- Removing system dependencies (PostgreSQL, Nginx, Certbot, wkhtmltopdf)
- Updating firewall rules
- Double confirmation required (yes/no + typing 'DELETE')
- Interactive prompts for optional removals
- Detailed logging of all actions
- Graceful handling of missing components
This project is licensed under the MIT License. See the LICENSE file for details.
- The official Odoo documentation for providing excellent guidance on deployment and configuration.