Author: Kenn Carlo Gutierrez
Last Updated: Thu, Sep 16, 2021OpenEMR is an open-source electronic health records and medical practice management solution. This article explains how to install OpenEMR on CentOS 7.
Log in to MySQL as root.
# mysql -u root
Create an openemr database.
mysql> CREATE DATABASE openemr;
Create a new database user. Replace <PASSWORD>
with a strong password.
mysql> CREATE USER 'openemr-user'@'localhost' IDENTIFIED BY '<PASSWORD>';
Grant the user permission to access the database.
mysql> GRANT ALL PRIVILEGES ON openemr.* TO 'openemr-user'@'localhost';
Reload the grant tables to activate the permission settings.
mysql> FLUSH PRIVILEGES;
Exit MySQL.
mysql> exit
Download OpenEMR.
# wget https://sourceforge.net/projects/openemr/files/OpenEMR%20Current/6.0.0/openemr-6.0.0.tar.gz
Please see the OpenEMR Download page for the latest OpenEMR version.
Extract the files.
# tar xvzf openemr*.tar.gz
Move the openemr-6.0.0
directory to /var/www/html/openemr
.
# mv openemr-6.0.0 /var/www/html/openemr
Give apache ownership of the directory.
# chown -R apache:apache /var/www/html/openemr
Temporarily give all users read and write access during the installation.
# chmod 666 /var/www/html/openemr/sites/default/sqlconf.php
http://example.com/openemr
, replacing example.com with your server's IP address. The browser displays the OpenEMR Setup page.Click Proceed to Step 1 to continue with the installation.
Choose I have already created the database and click Proceed to Step 2 to continue.
In the MySQL Server Details section, enter the database Login Name and Password you set in section two.
Click Create DB and User.
Click Proceed to Step 4.
Edit php.ini.
# nano /etc/php.ini
Locate these variables and change their settings as shown.
;
character from max_input_vars and change its value to 3000
.60
.-1
.30M
.256M
.;
character from mysqli.allow_local_infile.Save and exit the file.
Reload the Apache web server for these changes to take effect.
# systemctl reload httpd
Return to your web browser.
Click Proceed to Step 5.
Return to your terminal session.
Create a new configuration file named openemr.conf
.
# nano /etc/httpd/conf.d/openemr.conf
Paste the following into the file.
<Directory "/var/www/html/openemr">
AllowOverride FileInfo
Require all granted
</Directory>
<Directory "/var/www/html/openemr/sites">
AllowOverride None
</Directory>
<Directory "/var/www/html/openemr/sites/*/documents">
Require all denied
</Directory>
Save and exit the file.
Restart Apache.
# systemctl restart httpd
Return to your web browser.
Click Proceed to Select a Theme.
Choose Keep Current, then click Proceed to Final Step.
OpenEMR recommends setting file permissions as follows.
# chmod 644 /var/www/html/openemr/library/sqlconf.php
# chmod 644 /var/www/html/openemr/sites/default/sqlconf.php
# chmod 600 /var/www/html/openemr/acl_upgrade.php
# chmod 600 /var/www/html/openemr/setup.php
# chmod 600 /var/www/html/openemr/sql_upgrade.php
# chmod 600 /var/www/html/openemr/ippf_upgrade.php
See the OpenEMR documentation for more details.
To learn more about OpenEMR, please see these resources: