OpenEMR is the world’s leading open-source electronic medical record (EMR) and medical documentation system. OpenEMR aims to provide a better alternative to its proprietary competitors. It is secure, customizable, scalable, feature-rich, and designed to meet the needs of small to large healthcare organizations.

It has been used in over 200 countries/territories worldwide since 2002. The information below will help you better understand OpenEMR.

OpenEMR is used in well over 200 countries/territories worldwide in both small and large healthcare organizations, including hundreds of thousands of individual users in many parts of the United States. The latest data shows there are currently ~10 million patient encounters annually, up significantly from only 2 million patients five years ago.

There are many good reasons to choose OpenEMR as your medical records system, including:

  • It can be downloaded and installed locally in minutes.
  • It supports all US federal privacy laws (HIPAA) including HIPAA audit logging.
  • It has strong community support by an international developer team, thousands of contributors, hundreds of translators, tens of thousands of users, and hundreds of organizations.
  • It is scalable from small to very large healthcare organizations.
  • It has a responsive mobile web interface that can be used on almost all mobile devices, including iPhones, Android phones and tablets, Windows Mobile devices, and Blackberry smartphones.
  • There is no software licensing fees or annual service contracts required for OpenEMR installations because OpenEMR is open-source software.

This guide will walk you through downloading and installing OpenEMR. These instructions have been tested and work perfectly with CentOS 7 and 8 and Rocky Linux 8 and 9.

Prerequisites

  • A fresh installation of an RHEL-based Linux distribution like AlmaLinux, RockyLinux or CentOS with root user access.
  • Ability to use the command-line interface (CLI) through SSH or monitor directly on the machine.

Step 1: Updating the OS

Yum is the default package manager tool in CentOS. On Rocky Linux, replace yum with dnf in the commands below. We need to update the system using the yum command before downloading and installing OpenEMR.

sudo yum update

Type Y and hit Enter when prompted.

Yum will now update all packages and dependencies, which may take a few minutes, depending on your internet connection speed.

Step 2: Installing Apache Web Server

Apache, informally known as Apache Web Server, this free and open-source cross-platform web server software was developed and maintained by the Apache Software Foundation, which is based in San Francisco.

Apache is a powerful and flexible HTTP server, notable for running in a high-performance mode on UNIX platforms by using an event-driven and threaded architecture with a low memory footprint.

This section will show you how to install the Apache Web Server in CentOS. If you already have Apache installed in your system, then skip to Step 3 below.

First, run the following command to update the local Apache httpd package index.

sudo yum update httpd

Next, install the Apache Web Server using the following command line.

sudo yum install httpd

This command will install your system’s latest version of Apache Web Server.

To check the status of your installation, run the service command using sudo.

sudo systemctl status httpd

The result should look something like this.

<img alt="Install Apache web server" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-1.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="264" src="data:image/svg xml,” width=”666″>

If the Apache service is not running, use the following command to start Apache Web Server.

sudo systemctl start httpd

To enable Apache Web Service at system boots, run the following command.

sudo systemctl enable httpd

The Apache service is up and running. However, the best way to test the server is to request a page from another computer on the network.

To do this, type your server IP address in a web browser on a different machine.

http://server_IP_address

Where: server_IP_address is the actual IP address of the server. For example, to access your Apache installation using the 192.168.0.100 IP address, you would type http://192.168.0.100 in your browser window on another computer. You should see the Apache default page similar to the screenshot below.

<img alt="Web server is working fine" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-2.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="707" loading="lazy" src="data:image/svg xml,” width=”1385″>

Step 3: Installing MariaDB

MariaDB is a derivative of the MySQL relational database management system created by the MySQL community to remain free forever. It is a robust, scalable, and reliable SQL server with rich features, including but not limited to virtual columns, triggers, stored procedures, and views.

Using the yum command, this section will help install and configure MariaDB on CentOS. MariaDB is available from the default CentOS software repositories, so there is no need for extra repositories or third-party sites.

You can install MariaDB Server by running the following command

sudo yum install mariadb-server

Once the installation is complete, please run the following command to start the MariaDB service and make it automatically start up at system boots.

sudo systemctl start mariadb
sudo systemctl enable mariadb

To secure your installation of MariaDB/MySQL, run the mysql_secure_installation command to set a root password, remove anonymous user accounts and disable remote root logins.

mysql_secure_installation

Enter Y when prompted to continue. You will first be asked to enter the current MariaDB root password, which is blank by default, so press Enter. Type Y and hit Enter again when prompted to remove anonymous users, as it is insecure unless enabled through the configuration file. Finally, type Y and hit Enter again if you are prompted to Disallow root login remotely, as it is insecure unless enabled through the configuration file.

<img alt="Configure MariaDB" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-3.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="726" loading="lazy" src="data:image/svg xml,” width=”603″>

To access the MariaDB shell and run commands, log in to your server using SSH or open a command-line terminal on your CentOS desktop. Type the following command.

mysql -u root -p

Enter your root password when prompted.

<img alt="MariaDB command prompt" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-4.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="184" loading="lazy" src="data:image/svg xml,” width=”660″>

Now that we have successfully installed MariaDB, let’s install PHP.

Step 4: Installing PHP

PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language. There are lots of high-quality PHP frameworks and CMS that you can use with ease, such as Laravel, Phalcon, Joomla, WordPress , etc. This section will show you how to install PHP and some required modules for OpenEMR on CentOS using the YUM package manager.

To install PHP open up your terminal, run the following command.

sudo yum install php
sudo yum install php-common php-mysqlnd php-gd php-mcrypt php-cli php-curl php-opcache

After the installation is complete, type the following command into the terminal to restart the Apache Web Server,

sudo systemctl restart httpd.service

We will create a phpinfo() file in the Apache root directory to test the PHP installation.

echo "" | sudo tee /var/www/html/info.php

Open your web browser and navigate to the URL http://server_IP_address/info.php, you should see a page similar to below screenshot after phpinfo() is successfully displayed.

http://server_IP_address/info.php

For security reasons, displaying the phpinfo() file on the web server is not recommended as it provides important server and PHP settings. To disable it, delete the info.php file we just created after the testing is done.

Step 5: Creating a Database for OpenEMR

OpenEMR needs a database backend before it can be used. This section will show you how to create a MariaDB database for OpenEMR using the MariaDB shell.

mysql -u root -p

Enter your MariaDB password when prompted. Now let’s create a new database called openemr with UTF-8 encoding.

CREATE DATABASE openemr;

Next, we will create a new user called openemr-user to manage the database. Replace [email protected] with your desired password.

CREATE USER 'openemr-user'@'localhost' IDENTIFIED BY '<[email protected]>';

From now on, we will use this new user to manage the database. Grant privileges to the newly created user to manage all databases with GRANT statement.

GRANT ALL PRIVILEGES ON openemr.* TO 'openemr-user'@'localhost';

Now, reload the grant tables using FLUSH PRIVILEGES command.

FLUSH PRIVILEGES;

At this stage, you have successfully created a MariaDB database and user for OpenEMR. You can now exit out of the MariaDB shell using the following command.

exit

<img alt="Create database" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-5.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="421" loading="lazy" src="data:image/svg xml,” width=”819″>

Step 6: Downloading OpenEMR

In this step, we will download the OpenEMR zip file, extract the zip file, and change some ownership for the OpenEMR files.

sudo yum install wget -y

wget https://sourceforge.net/projects/openemr/files/OpenEMR Current/6.0.0/openemr-6.0.0.tar.gz

tar xvzf openemr*.tar.gz

mv openemr-6.0.0 /var/www/html/openemr

chown -R apache:apache /var/www/html/openemr

chmod 666 /var/www/html/openemr/sites/default/sqlconf.php

Step 7: Installing OpenEMR

Now that we have all the required elements to start running OpenEMR, let’s run the installation using the web browser.

Open your web browser, navigate to http://server_IP_address/openemr, and see a page like the screenshot below. Click Proceed to Step 1 button.

<img alt="Directory permissions" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-6.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="719" loading="lazy" src="data:image/svg xml,” width=”1235″>

You will be taken to the Select Database Setup page, select I have already created the database radio button, and click Proceed to Step 2 button.

<img alt="Database already created" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-7.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="541" loading="lazy" src="data:image/svg xml,” width=”1221″>

On the Database and OpenEMR Initial User Setup Details page, fill in all the details like Login Name and Password. Select the Enable 2FA checkbox if you’d like to use this option for the Initial User. Click on Create DB and User at the bottom left.

<img alt="Create DB and user" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-8.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="371" loading="lazy" src="data:image/svg xml,” width=”1079″>

Wait for the next page to load. Please be patient. This page will check to see whether the user and database have been successfully created. When the page is fully loaded, click the Proceed to Step 4 button.

<img alt="First user created" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-9.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="461" loading="lazy" src="data:image/svg xml,” width=”1250″>

You will be taken to Step 4 – Creating and Configuring Access Control List screen. Keep the default and click Proceed to Step 5 button.

<img alt="Create ACL" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-10.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="739" loading="lazy" src="data:image/svg xml,” width=”1298″>

You will be taken to Step 5 – Configure PHP screen. This page tells you how to set up your Apache Web Server for OpenEMR.

In this step, we will proceed to configure the Apache Web Server for OpenEMR.

Now, return to your terminal, using your favorite text editor, create a new configuration file called openemr.conf in the apache directory.

sudo nano /etc/apache2/sites-available/openemr.conf

Next, populate the file with the following lines. Remember to save and exit the file when you are done.

AllowOverride FileInfo
Require all granted



AllowOverride None



Require all denied

Next, run the following command to restart the Apache service.

sudo systemctl restart apache2

Once you have done all the steps above, return to your browser and click on the Proceed to Step 6 button.

<img alt="Configure PHP" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-11.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="719" loading="lazy" src="data:image/svg xml,” width=”1363″>

On the next page, click Proceed to Select a Theme button. When you are done choosing a theme for your OpenEMR, click on Proceed to Final Step.

<img alt="Configure Apache web server" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-12.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="705" loading="lazy" src="data:image/svg xml,” width=”1281″>

<img alt="Choose theme" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-13.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="686" loading="lazy" src="data:image/svg xml,” width=”1343″>

Finally, a confirmation page appears, which shows all details regarding your OpenEMR installation. Click on the Click here to start using OpenEMR at the bottom left.

<img alt="Installation successful" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-14.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="858" loading="lazy" src="data:image/svg xml,” width=”1327″>

You will be taken to the login page. Provide your username password and click on Login.

<img alt="Login to OpenEMR" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-15.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="664" loading="lazy" src="data:image/svg xml,” width=”957″>

Once the authentication has been successful, you will be taken to the OpenEMR dashboard.

<img alt="OpenEMR Dashboard" data-ezsrc="https://kirelos.com/wp-content/uploads/2023/03/echo/word-image-19769-16.png" data-ez decoding="async" ezimgfmt="rs rscb10 src ng ngcb10 srcset" height="558" loading="lazy" src="data:image/svg xml,” width=”1604″>

The OpenEMR installation will now be complete.

Conclusion

This guide taught you how to install OpenEMR on an RHEL-based system. For more information about OpenEMR, please visit its official website.