OpenEMR Upgrade to Version 4 Procedure
This document will explain how to upgrade to the new version of OpenEMR, it is recommended to test the upgrade on a test virtual machine (VM) before upgrading to the live VM.
In the VM open the Terminal box (see picture below)

You will need to make a copy of the openemr folder, to do this in the Terminal box type
cd /var/www and then hit enter.
Then type sudo cp -a openemr openemr.old (you can call the copy folder something else, this is just for an example) and then hit enter.
You will now have to enter a password, the password should be password and then hit enter.

Now close the Terminal box
You now have copied the openemr folder, now we need to delete the openemr folder.
Open the Terminal box and type cd /var/www and then hit enter.
Then type sudo rm -rf openemr and then hit enter.
You may have to enter a password, if so the password should be password and then hit enter.
(see picture below)

Now close the Terminal box
On the host machine download the upgrade package and then move the upgrade package to the VM desktop.
Open terminal and type cd /home/user/Desktop and enter, then type sudo tar -pxvzf openemr-ippf-current.tar.gz and enter (see picture below, please note that the latest OpenEMR package could be called a different name on the download site).

The upgrade package has extracted on the desktop, you should see a folder called openemr (see picture below).

Type sudo mv openemr /var/www/openemr to move the openemr folder to the /var/www folder

You will need to move the following folder from the old openemr folder (/var/www/openemr.old) to the new openemr folder (/var/www/openemr).
The reason for moving the following folders is ensure that any files (such as test results, reference letter from a hospital etc.) or sub folders move to the new version of OpenEMR.
In the terminal type cd /var/www/openemr.old/sites/default

and then type
sudo mv documents /var/www/openemr/sites/default/documents
sudo mv edi /var/www/openemr/sites/default/edi
sudo mv era /var/www/openemr/sites/default/era
sudo mv letter_templates /var/www/openemr/sites/default/letter_templates

In the VM open a folder (see picture below)

And make your way to /var/www/openemr.old/sites/default

Right mouse click on sqlconf.php and click on Open with gedit

Record the details of the sqlconf.php file, you will need those details to edit sqlconf.php file under /var/www/openemr/sites/default
Open the Terminal box and type cd /var/www/openemr/sites/default and enter.
Then type sudo nano sqlconf.php and enter

From the details you have record from /var/www/openemr.old/sites/default/sqlconf.php file edit and difference. For example $pass = 'openemr'; may need to be edited to $pass = 'password1';
Set the $config variable (found near bottom of file within bunch of slashes) to 1 ($config = 1;)

Once the changes have been made go to ?> and press Ctrl-X

Y and hit Enter. The file has been saved. Exit out of the terminal.
Open a web browser and type http://localhost/openemr/ippf/upgrade/dbUpgrade.php in the address bar.
It will take a few minutes to run the upgrade and at the end you should get this message below.

You have now successful upgraded OpenEMR to the latest version.