Backup Windows installation with XAMPP, restore to Ubuntu 20.04 with LAMP: Can this be done?

Thank you so much. I’ll take a look at these instructions.

1 Like

Here is an update on what I have done so far. I did a fresh install of Ubuntu 20.04.1 as a VM on a VMware ESXi platform and I installed OpenERM 6.1. I followed instructions from several websites and I made notes of what I did.

Now I shall proceed to apply 6.1 patch. The patch went well.

Next I shall backup my Windows XAMPP and then import openemr.sql. But there are several steps I need to do first.

  • Drop the openemr database
1 Like

Yes. On the database, you must first delete and then run the openemr.sql script. Then you must create a user (for example openemr). Then give that user permission to modify the database. On your Ubuntu server, you should copy the Xampp windows folder C:\xampp\htdocs\openemr\sites\default to /var/www/html/openemr/sites/default (make a copy first). To finish you must edit /var/www/html/openemr/sites/default/sqlconf.php and place the username and password you just created and openem database

Thanks. You’ve given me the next steps. I shall work on this.

You said: “On the database, you must first delete and then run the openemr.sql script.” Where is this script? Is the source database on the Windows XAMPP? Please explain.

Or is this the openemr.sql from the backup of the Windows installation?


It is the one you created on your windows machine. Here is the command:

mysql -u root -p [name-of-openemr-database-in-ubuntu] < /path/to/file/[name-of-openemr-databasedump-from-XAMPP].sql


mysql -u root -p openemr_default < /path/to/file/XAMPPopenemr_default.sql

Thanks, Sandra.

Ill give it a shot.

1 Like

Success!!! I have been able to import the Windows XAMPP installation of OpenEMR 6.1.(1) to Ubuntu 6.1.(1). However, the appointments did not go over. What did I do wrong?

On the Ubuntu server I installed OpenEMR 6.1.1, then I dropped the openemr database, and created another opememr database, and a new user for the database. I imported the openemr.sql which I extracted from a backup of the Windows Openemr. I used the backup feature from the admin menu to do the backup. I also copied the sites/default folder to the /var/www/html/openemr/sites/default folder overwriting files.

After writing the above, I went back into Openemr in Ubuntu and I discovered that the appointments did go over.

So the backup and restore from Windows to Ubuntu did work.


I didn’t see you mention that you ran the upgrade script. You may want to run the sql_upgrade.php and also run sql_patch.php. Make sure that you have a backup before you do anything.

good point @growlingflea , sql_upgrade.php will take care of sql_patch.php in this case since the codebase is 6.1.0(1)

I’ll run sql_upgrade.php.

But the Modules Menu doesn’t work.

Not Found

The requested URL was not found on this server.

Apache/2.4.41 (Ubuntu) Server at Port 80

I was able to solve this Modules problems as follows:

Run these commands (SSH to server)
sudo a2enmod rewrite
sudo a2enmod headers
sudo systemctl restart apache2

Edit this file /etc/apache2/apache2.conf and add these lines below
DocumentRoot /var/www/html

<Directory “/var/www/html”>
AllowOverride All
Require all granted


I also had to change the paths under Admin → Global → Miscellaneous as the import left the Windows paths.

1 Like

Thanks for the feedback. Now you can create cron jobs to automatically backup your system. Maybe that’s possible on Windows but is simple to setup on GNU/Linux.

1 Like

Do you have any links I can look at?

you can create a script that’s called by root’s cron and save to a usb stick mounted at /media/username/usb

# dump the openemr db
mysqldump -uopenemr -popenemr openemr > /media/username/usb/openemr-db-"$(date +%m%d%y)"
#rsync the files in documents
rsync -av /var/www/html/openemr/sites/default/documents /media/username/openemr

then sudo bash and run crontab -e

0 3 * * * /home/username/

to run the backup at 3 am every morning

1 Like

This is great!. I’ll try it. Thanks.