Clean install on EC2 Ubuntu 22.04

I am installing a new server, I have done this before but following lightsail guide, then docker guide.
Now I want to install it from scratch to have more control over it.

I have found this guide OpenEMR 7.0.1 Linux Installation - OpenEMR Project Wiki

After login in to my server, I have run sudo apt update, then sudo apt upgrade -y. I have rebooted the instance and logged in again.

It requires PHP, Apache and MariaDB, so I have done this:
sudo apt-get install apache2 mariadb-server libapache2-mod-php libtiff-tools php php-mysql php-cli php-gd php-xml php-curl php-soap php-json imagemagick php-mbstring php-zip php-ldap

Then I rebooted again.

Then I continue to setup root password for my database

sudo mysql_secure_installation

I have answered the questions, most of them as suggested. The first question asks if root password has been set, in my case, I have answered none. Then I switch to unix_socket authentication followed by I want to set root password. I have entered it twice, because we will need this when running setup tool in step 2.

Then I downloaded OpenEMR from here:

Extract it

sudo tar -pxvzf openemr-7.0.1.tar.gz

Then move it to apache

sudo mv openemr-7.0.1 /var/www/html/openemr

cd /var/www/html

Now its time to setup OpenEMR. Open a browser tab, using your server´s public IP, followed by /openemr.

Continue with “Configuring the Install through the WEB GUI” OpenEMR 7.0.1 Linux Installation - OpenEMR Project Wiki

For step 5, apache configuration file is located at /etc/apache2/sites-available/000-default.conf in Ubuntu.


After unzipping openemr-7.0.1.tar.gz and moving it to the directory you must change its owner: sudo chwon -R www-data:www-data /var/www/html/openemr.
then execute the command: sudo a2ensite openemr.conf.
And restart the apache2 service: sudo systemctl restart apache2.service

Here you have a guide for this year in Spanish, but it uses nginx as a web server


Awesome! Thank you Luis.

I have installed my server again

Please do this to download openemr
If the url ends in /download then the file will be named download.


I was unable to see my patients picture (uploaded to documents | patient information | picture).
So I tried to switch chown from root:root to www-data:www-data.

Now my website is broken. It is a permissions issue. I am not expert in Ubuntu. It crashes before get me to login page.

In apache logs, the error says the following:

PHP Fatal error:  Uncaught RuntimeException: Directory "/var/www/html/sites/default/documents/smarty/gacl" was not created in /var/www/html/interface/globals.php:243\nStack trace:\n#0 /var/www/html/interface/login/login.php(41): require_once()\n#1 {main}\n  thrown in /var/www/html/interface/globals.php on line 243

Any advise?