Migrate an ERPNext installation

Before running the commands shown on this page, you should load the Bitnami stack environment by executing the installdir/use_APPNAME script (Linux and MacOS) or by clicking the shortcut in the Start Menu under “Start -> Bitnami APPNAME Stack -> Application console” (Windows). On OS X VMs, the installation directory is /opt/bitnami and OS X VM users can click the “Open Terminal” button to run commands. Learn more about the Bitnami stack environment and about OS X VMs.

It is strongly recommended that you create a backup before starting the update process. If you have important data, it is advisable that you create and try to restore a backup to ensure that everything works properly.

There are two important steps when migrating ERPNext: create a backup of your system and database on the old server, and restore it on the new one. Follow the instructions below:

  • Log in to the server console using SSH.

  • At the server console, execute the following commands:

      $ cd installdir/apps/erpnext/htdocs/frappe-bench
      $ sudo bench backup-all-sites

    The command above will generate three files in the installdir/apps/erpnext/htdocs/frappe-bench/sites/erpnext/private/backups directory. Read more about the backup process.

  • Download the generated backup files to your desktop.

  • Upload the generated backup files to the /home/bitnami directory of the new server.

  • Log in to the new server console using SSH.

  • Uncompress the backup file with extension .sql.gz using the command below. Remember to replace the FILENAME placeholder with the correct file name and path.

      $ gunzip FILENAME

    This will extract the contents of the backup file into a new directory.

  • Connect to the MariaDB database server using the MySQL CLI and run the command below to delete the existing ERPNext database and all its contents.

      $ DROP DATABASE bitnami_erpnext;
  • Restore the database backup from the old server by running the commands below. Remember to replace the DIRNAME placeholder with the correct name of the directory containing the extracted contents of the backup file.

      $ cd installdir/apps/erpnext/htdocs/frappe-bench
      $ sudo bench restore /home/bitnami/DIRNAME
  • Uncompress the backup file with extension -files.tar and copy the extracted contents to the new ERPNext site. Remember to replace the FILENAME placeholder with the correct file name and path.

      $ cd /home/bitnami
      $ mkdir -p extracted
      $ tar -xf FILENAME -C extracted/
      $ cp extracted/erpnext/public/files/* installdir/apps/erpnext/htdocs/frappe-bench/sites/erpnext/public/files/
  • Repeat the previous step for the -private-files.tar backup file.

  • Restart the servers:

      $ sudo installdir/ restart

You should now be able to access the ERPNext site from the older server using the new ERPNext instance. Use the credentials from the old server to log in.

Last modification September 12, 2019