How to Deploy Odoo on AWS EC2 Securely for Production

How to Deploy Odoo on AWS EC2 Securely for Production

Odoo is a powerful open-source ERP that helps businesses manage everything from sales and CRM to accounting, HR, inventory, and more. Deploying Odoo in production requires careful attention to performance, reliability, and security.

In this blog post, I’ll walk you step-by-step through deploying Odoo 18 on AWS EC2 securely — the same process applies for other servers (DigitalOcean, Google Cloud, etc.).

🔹Step 1: Launch an AWS EC2 Instance

  1. Log in to your AWS console.
  2. Launch an EC2 instance
  3. Choose instance type:
    • For 10+ users in production, start with t3.medium (2 vCPU, 4GB RAM) or higher.
  4. Add storage (at least 20GB SSD).
  5. Open ports in Security Group:
    • 22 (SSH)
    • 8069 (Odoo)
    • 80 (HTTP) / 443 (HTTPS)

🔹Step 2: Connect via SSH

ssh -i your-key.pem ubuntu@your-ec2-public-ipCode language: CSS (css)

🔹Step 3: Install Dependencies

Update your system:

sudo apt update && sudo apt upgrade -y

Install required packages:

sudo apt install git python3-pip build-essential wget python3-dev python3-venv \

python3-wheel libxslt-dev libzip-dev libldap2-dev libsasl2-dev python3-setuptools \

node-less libjpeg-dev libpq-dev gcc g++ -y

🔹Step 4: Install PostgreSQL

sudo apt install postgresql -y

sudo -u postgres createuser -s odoo18

🔹Step 5: Install Wkhtmltopdf

sudo apt install wkhtmltopdf -y

🔹Step 6: Install Odoo

sudo useradd -m -d /opt/odoo -U -r -s /bin/bash odoo

sudo su - odoo

git clone https://www.github.com/odoo/odoo --branch 18.0 --single-branch .

python3 -m venv venv

source venv/bin/activate

pip install wheel

pip install -r requirements.txt

deactivate

exitCode language: PHP (php)

🔹Step 7: Create Configuration File

sudo nano /etc/odoo.conf

[options]

; Database settings

db_host = False

db_port = False

db_user = odoo18

db_password = False; Admin master password (use a strong one!)

admin_passwd = mySuperSecurePassword

; Logging

logfile = /var/log/odoo/odoo.log

addons_path = /opt/odoo/addonsCode language: PHP (php)


Secure it:

sudo mkdir -p /var/log/odoo

sudo chown odoo:odoo /etc/odoo.conf

sudo chmod 640 /etc/odoo.confCode language: JavaScript (javascript)

🔹Step 8: Create a Systemd Service

sudo nano /etc/systemd/system/odoo.service

[Unit]
Description=Odoo ERP
Documentation=https://www.odoo.com
After=network.target postgresql.service[Service]
Type=simple
User=odoo
ExecStart=/opt/odoo/venv/bin/python3 /opt/odoo/odoo-bin -c /etc/odoo.conf
Restart=always[Install]
WantedBy=multi-user.targetCode language: JavaScript (javascript)

Enable and start:

sudo systemctl daemon-reload
sudo systemctl enable odoo
sudo systemctl start odoo

Secure the Deployment

  1. Change the default Odoo port (8069):
xmlrpc_port = 8070

in /etc/odoo.conf.

2. Use Nginx as Reverse Proxy
Install Nginx:

sudo apt install nginx -y

Configure Nginx as SSL reverse proxy with Let’s Encrypt:

sudo apt install certbot python3-certbot-nginx -y

Then:

sudo certbot --nginx -d yourdomain.com Code language: CSS (css)

3. Disable DB Manager in Production

In /etc/odoo.conf:

list_db = FalseCode language: PHP (php)

This prevents attackers from seeing your databases.

4. Secure PostgreSQL
Edit pg_hba.conf to only allow local connections.

5. Enable UFW Firewall

sudo ufw allow ssh

sudo ufw allow http

sudo ufw allow https

sudo ufw enable

6. Run Odoo Behind Reverse Proxy Only
Block direct access to 8069 in AWS Security Group (only allow localhost and Nginx).

Updating Your Odoo Source Code

When your code changes:

cd /opt/odoo
sudo systemctl stop odoo
sudo -u odoo git pull origin 18.0
sudo -u odoo ./venv/bin/pip install -r requirements.txt
sudo systemctl restart odoo

🌟 How Ixora Solution Can Help You

While deploying Odoo on AWS is a great start, setting up ERP tailored for your business processes requires expertise. That’s where Ixora Solutions comes in.

As an Odoo Official Partner, Ixora Solutions brings proven expertise in:

Odoo Consulting – Understanding your business processes and designing the right Odoo workflows.
Customization & Development – Extending Odoo with custom apps, modules, and integrations.
Integration Services – connecting Odoo with payment gateways, e-commerce, CRM, and more.
Performance Optimization – ensuring your Odoo runs fast and efficiently on AWS or on-premise.
Ongoing Support & Maintenance – 24/7 monitoring, backups, and upgrades.

If you want to transform your business operations with Odoo ERP, Ixora Solution is your trusted partner.

💡 Final Thoughts

Deploying Odoo 18 on AWS (or any Linux server) may seem daunting at first, but with the steps above, even beginners can get a secure and production-ready Odoo instance running.

By combining AWS scalability with Odoo’s flexibility, you can empower your team with a robust ERP system. And with expert guidance from Ixora Solution, you’ll save time, avoid pitfalls, and maximize the ROI of your ERP investment.

🚀 Ready to take your business to the next level with Odoo? Start your deployment today with us!

Add a Comment

Your email address will not be published. Required fields are marked *