How do I Migrate Odoo to a New Server?

Talk to Our Odoo Experts Take the Free ERP Assessment
How to Migrate Odoo to a New Server

Odoo is a comprehensive management software suite covering CRM, sales, inventory, accounting, and manufacturing. As your transaction volume grows, transitioning your Odoo instance to a faster, high-capacity server ensures peak response times and higher concurrency. While moving servers is a technical endeavor, following an exact command-line workflow guarantees your database, filestore, and custom addons transfer cleanly without data loss.

Important: Server Migration vs. Version Upgrade

Moving Odoo to a new server transfers your existing system to new infrastructure on the same Odoo version. It is fundamentally different from a major version upgrade (e.g., Odoo 16 to Odoo 18), which alters database schemas, data structures, and ORM methods and requires data migration scripts. If you need to upgrade versions while moving servers, explore our certified Odoo migration services or read our guide on how to upgrade Odoo versions.

Looking for Odoo Implementation, Customization, Integration, or Support Services?

Connect with Our Experts

8 Steps to Migrate Odoo to a New Server

Follow this verified step-by-step sequence using standard Linux and PostgreSQL commands to migrate your instance safely without losing records or attachments.

Step 1: Match Versions

Ensure both servers run the exact same Odoo version (e.g., Odoo 17.0 Community or Enterprise), identical custom and third-party addons, and the same PostgreSQL major version or newer (e.g., PostgreSQL 15 or 16). Verify versions on both machines:

python3 --version
psql --version

Step 2: Stop Writes

Put the old server in maintenance mode, or stop the Odoo service before taking the final backup to prevent active transactions and data drift:

sudo systemctl stop odoo

Step 3: Back Up the Database

Dump the database using PostgreSQL's custom archive format (-Fc) for a compressed binary backup that supports flexible, reliable restoration:

pg_dump -Fc -f mydb.dump mydb

Step 4: Back Up the Filestore (Attachments)

Odoo stores file attachments outside the database in the folder set by data_dir in odoo.conf, usually ~/.local/share/Odoo/filestore/mydb (or /var/lib/odoo/.local/share/Odoo/filestore/mydb). Archive the filestore directory:

tar -czvf filestore_mydb.tar.gz ~/.local/share/Odoo/filestore/mydb

Step 5: Copy odoo.conf and the Custom Addons Folder

Copy your odoo.conf configuration file and all custom and third-party addons directories to the new server:

rsync -avz /etc/odoo/odoo.conf user@new-server:/etc/odoo/
rsync -avz /opt/odoo/custom-addons/ user@new-server:/opt/odoo/custom-addons/

Step 6: On the New Server

Install the same Odoo version and PostgreSQL, create the target database, and restore the dump. Then copy the filestore into the same data_dir path and fix file ownership:

createdb mydb
pg_restore -d mydb mydb.dump
tar -xzvf filestore_mydb.tar.gz -C ~/.local/share/Odoo/filestore/
sudo chown -R odoo:odoo ~/.local/share/Odoo/filestore/mydb

Step 7: Start and Test

Start the Odoo service on the new server:

sudo systemctl start odoo

Log in to the web interface, open attachments to confirm they display properly, and check scheduled actions (under Settings > Technical > Automation > Scheduled Actions) and outgoing email servers to ensure all services function smoothly.

Step 8: Switch Over

Once validation is complete, update DNS records (A and CNAME) to point to the new server's IP address, update the Nginx reverse proxy configuration, and configure the SSL certificate:

sudo certbot --nginx -d yourdomain.com

Small Databases: Web Database Manager

For smaller databases, the built-in Database Manager (/web/database/manager) can back up and restore a zip file that includes the filestore directly through the browser.

Summary

Migrating Odoo to a new server requires precise execution of database dumps, filestore archives, and permissions handling. By systematically matching system versions, freezing writes, and restoring both the database and filestore, you ensure high availability and zero record loss. Remember that planning and patience are essential, and partnering with experienced specialists will help your migration go smoothly.