virtualMachineerpnext

Migrate an ERPNext installation

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. Learn how to connect to the server through SSH.

  • Navigate to the frappe-bench directory of your ERPNext installation:

      $ cd /opt/bitnami/frappe-bench
    
  • Create a backup of your ERPNext site:

      $ bench backup-all-sites
    

    The command above will generate three files in the 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 server console. Learn how to connect to the server through 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;
    
  • Navigate to the frappe-bench directory of your ERPNext installation:

      $ cd /opt/bitnami/frappe-bench
    
  • 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.

      $ 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.

      $ mkdir -p ~/extracted
      $ tar -xf FILENAME -C ~/extracted/
      $ cp -r ~/extracted/erpnext/public/files/* sites/erpnext/public/files/
    
  • Repeat the previous step for the -private-files.tar backup file.

  • Restart the servers:

      $ sudo /opt/bitnami/ctlscript.sh 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 February 9, 2023