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 using SSH.
At the server console, execute the following commands:
$ cd /opt/bitnami/apps/erpnext/htdocs/frappe-bench $ sudo bench backup-all-sites
The command above will generate three files in the /opt/bitnami/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.
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 MySQL 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 /opt/bitnami/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/* /opt/bitnami/apps/erpnext/htdocs/frappe-bench/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.