How To Install OpenEMR on Rocky Linux 9
In this tutorial, we will show you how to install OpenEMR on OpenEMR on Rocky Linux 9. OpenEMR is a powerful open-source electronic medical record (EMR) and practice management software that is widely used in healthcare settings. Its flexibility, extensive features, and compliance with healthcare regulations make it a preferred choice for many medical practices. Installing OpenEMR on Rocky Linux 9 provides a robust and stable environment for managing patient records, scheduling, billing, and more. This guide will walk you through the step-by-step process of installing OpenEMR on Rocky Linux 9, ensuring you have everything you need to get started.
Prerequisites
Before diving into the installation process, it’s essential to ensure that your system meets the necessary requirements.
System Requirements
- Hardware: A minimum of 2 GB RAM (4 GB recommended), 20 GB of free disk space, and a modern processor (Intel or AMD).
- Software: A fresh installation of Rocky Linux 9 with access to the internet.
Access Requirements
- Root Access: You will need root user access or sudo privileges to install software packages and configure services.
- Command-Line Knowledge: Familiarity with the command-line interface (CLI) is beneficial for executing commands and troubleshooting.
Preparing the System
The first step in installing OpenEMR is to prepare your Rocky Linux system by updating it and installing the required packages.
Updating the System
Start by updating your system to ensure all existing packages are up to date. Run the following command:
sudo dnf update
Installing Required Packages
You will need to install several essential packages including Apache web server, MariaDB database server, and PHP along with its extensions. Execute the following command:
sudo dnf install httpd mariadb-server php php-mysqlnd php-mbstring php-xml php-curl
Starting Services
After installing the required packages, start the Apache and MariaDB services, and enable them to start at boot:
sudo systemctl start httpd
sudo systemctl enable httpd
sudo systemctl start mariadb
sudo systemctl enable mariadb
Configuring MariaDB
The next step involves configuring MariaDB to create a secure environment for your OpenEMR installation.
Securing the Installation
Run the security script provided by MariaDB to secure your installation:
sudo mysql_secure_installation
This script will prompt you to set a root password, remove anonymous users, disallow root login remotely, and remove test databases. Follow the prompts to enhance security.
Creating the OpenEMR Database and User
You need to create a database specifically for OpenEMR along with a dedicated user. Access the MariaDB shell:
sudo mysql -u root -p
Then execute the following SQL commands:
CREATE DATABASE openemr;
CREATE USER 'openemruser'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON openemr.* TO 'openemruser'@'localhost';
FLUSH PRIVILEGES;
Replace ‘your_password
‘ with a strong password of your choice. This user will have full access to the OpenEMR database.
Downloading and Installing OpenEMR
The next phase is downloading OpenEMR from its official repository and installing it on your server.
Downloading OpenEMR
You can download the latest version of OpenEMR using wget
. At the time of writing this guide, version 6.0.0 is available:
wget https://sourceforge.net/projects/openemr/files/OpenEMR%20Current/7.0.2/openemr-7.0.2.tar.gz
Extracting Files
Once downloaded, extract the files and move them to the Apache web directory:
tar -xvzf openemr-7.0.2.tar.gz
sudo mv openemr-7.0.2 /var/www/html/openemr
Setting Permissions
The web server must have proper permissions to access OpenEMR files. Change ownership and permissions using these commands:
sudo chown -R apache:apache /var/www/html/openemr
sudo chmod -R 755 /var/www/html/openemr
Configuring Apache for OpenEMR
A successful installation requires configuring Apache to serve OpenEMR correctly.
Creating a Virtual Host File
Create a new configuration file for OpenEMR in Apache’s configuration directory:
sudo nano /etc/httpd/conf.d/openemr.conf
Add the following configuration block:
<VirtualHost *:80>
ServerName your_domain_or_IP
DocumentRoot /var/www/html/openemr
<Directory /var/www/html/openemr>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
ErrorLog /var/log/httpd/openemr-error.log
CustomLog /var/log/httpd/openemr-access.log combined
</VirtualHost>
Please replace `your_domain_or_IP
` with your actual domain name or server IP address.
Enabling Rewrite Module
The mod_rewrite
module must be enabled for URL rewriting in OpenEMR:
sudo dnf install mod_rewrite
sudo systemctl restart httpd
Finalizing the Installation via Web Interface
Your server is now prepared for accessing OpenEMR through its web interface. Navigate to http://your_domain_or_IP
and complete the required steps to finish the installation.
Accessing the Installation Wizard
Database Configuration Steps
The installation wizard will prompt you for database configuration settings. Enter the following details:
- Database Type: MySQL/MariaDB
- User Name: openemruser (the user you created earlier)
- Password: your_password (the password you set)
- Database Name: openemr
- Server Hostname: localhost
Setting Up Admin User and Preferences
You will then be prompted to create an admin user account for logging into OpenEMR. Fill in your desired username, password, and email address. Additionally, configure any initial settings as prompted by the wizard.
Post-Installation Steps
Your installation is complete! However, there are some important post-installation steps you should take care of.
Testing the Installation
If everything went smoothly, log into OpenEMR using the admin credentials you just created. Verify that all features are functioning correctly by navigating through different sections of the application.
Securitizing OpenEMR Installation
- SSL Setup: Add SSL encryption using Let’s Encrypt or another certificate authority for secure data transmission.
- Password Policies: Create strong passwords for all users and encourage regular updates.
- User Roles: Create specific user roles with restricted permissions based on job functions within your practice.
- Audit Logs: Monitor access logs regularly to detect any unauthorized access attempts.
Troubleshooting Tips
If you encounter issues during installation or while using OpenEMR, consider these troubleshooting tips:
- If you cannot access OpenEMR via your browser, check if Apache is running:
sudo systemctl status httpd
- If there are database connection errors, verify that MariaDB is running:
sudo systemctl status mariadb
- If permission errors occur, ensure that Apache has ownership of OpenEMR files:
ls -l /var/www/html/openemr/
- If PHP errors appear on-screen, check PHP error logs located at:
/var/log/httpd/openemr-error.log
- If SSL issues arise after setting up HTTPS, verify that ports 80 (HTTP) and 443 (HTTPS) are open in your firewall settings.
- If performance issues occur, consider optimizing MariaDB settings or increasing server resources based on usage patterns.
- If you experience slow loading times, check network connectivity or consider using caching solutions like Redis or Memcached.
- If email notifications fail, ensure that mail services like Postfix or Sendmail are configured correctly on your server.
- If you encounter issues with specific features in OpenEMR, consult community forums or documentation for guidance on common problems related to those features.
- If updates fail during future installations or upgrades, check compatibility between new versions of PHP or MariaDB with OpenEMR requirements before proceeding.
Congratulations! You have successfully installed OpenEMR. Thanks for using this tutorial for installing OpenEMR medical office workflow software on Rocky Linux 9 system. For additional help or useful information, we recommend you check the official OpenEMR website.