Backup and Restore of complete OpenERP in Linux(Ubuntu)

This is just some simple tips for moving an OpenERP server instance and Database from a Linux server to another Linux physical server. Normally Debain based Ubuntu is recommend to install OpenERP. Hope this will help at least some beginners. Good luck 🙂 This process is normally done using linux commands as mentioned below.

1) On Source Server
.ssh to existing OpenERP server as the user running OpenERP

  • Copy config, binary and init files

demo@openerp:~$ cp /etc/default/demo-server.conf .
demo@openerp:~$ cp /etc/init.d/demo-server .
demo@openerp:~$ cp /usr/bin/demo-server demo-server_bin

  • Backup database

demo@openerp:~$ pg_dump -f OpenERP_devel.tar -F tar -O OpenERP_devel

  • Create an archive with all these files

demo@openerp:~$ tar -czf oerp_backup.tgz *

  • Copy the archive to destination server

demo@openerp:~$ scp oerp_backup.tgz sme_test@demo.zbeanztech.com:/home/sme_test/

2) On Destination Server

  • Create a new user(this must be done before copiying the backup from source server)

root@ubuntu-test:~# adduser sme_test

  • Create a postgresql user

root@ubuntu-test:~# su postgres
postgres@ubuntu-test:/root$ /usr/lib/postgresql/9.1/bin/createuser -p 5434 sme_test

  • Set password for user

postgres@ubuntu-test:/root$ /usr/lib/postgresql/9.1/bin/psql -p 5434
postgres=# alter user sme_test with password ‘smellycat’;

  • Switch to new user

root@ubuntu-test:/home/sme_test# su sme_test

  • Change to home directory

sme_test@ubuntu-test:~$ cd

  • Extract the archive

sme_test@ubuntu-test:~$ tar -zxf oerp_backup.tgz

  • Edit config, init and binary files to cope with new system and database user

  • Switch back to root user and create log file

sme_test@ubuntu-test:~$ exit
exit
root@ubuntu-test:/home/sme_test# touch /var/log/sme_test-server.log
root@ubuntu-test:/home/sme_test# chmod 777 /var/log/sme_test-server.log

  • Copy the edited files to appropriate locations

root@ubuntu-test:/home/sme_test# cp demo-server /etc/init.d/sme_test-server
root@ubuntu-test:/home/sme_test# cp demo-server.conf /etc/default/sme_test-server.conf
root@ubuntu-test:/home/sme_test# cp demo-server_bin /usr/bin/sme_test-server

  • Switch user to new OpenERP user, create database and restore database

root@ubuntu-test:/home/sme_test# su sme_test
sme_test@ubuntu-test:~$ /usr/lib/postgresql/9.1/bin/createdb -p 5434 OpenERP_restore
sme_test@ubuntu-test:~$ /usr/lib/postgresql/9.1/bin/pg_restore -p 5434 -d OpenERP_restore -O Dilavie_devel.tar

sme_test@ubuntu-test:~$ exit

  • Start new OpenERP Server

root@ubuntu-test:/home/sme_test# /etc/init.d/sme_test-server start

  • Connect and test

Comments

Anonymous: Kindly guide the same topic but with WIndows. Thanks.".

Leave a Reply

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

  1. Anonymous says:

    Good tutorial, i very need it, thanks you so much !

  2. Luke says:

    Has anyone tried this with OpenERP 7 yet? I'd like to move my instance of OpenERP 7 from a webserver over to a server on my LAN.

  3. Anonymous says:

    Kindly guide the same topic but with WIndows. Thanks.

© 2020 Zesty Beanz Pvt Ltd All Rights Reserved.