How to install OrangeHRM on Ubuntu 16.04

Jack Wallen shows you how to install the OrangeHRM server on Ubuntu 16.04, so you can empower your human resources department with a better workflow.

Image: Jack Wallen

OrangeHRM might well be one of the most widely-used open source Human Resource Management (HRM) tools available. With this tool, your human resources department can be empowered with the ability to manage employee:

  • Attendance
  • Performance
  • Recruitment
  • Annual appraisals
  • And more

Not only will your HR department enjoy all the power they need, but that power comes with one of the best-designed tools on the market.

I'm going to walk you through the process of installing the OrangeHRM Community Edition on Ubuntu 16.04. Unfortunately, OrangeHRM is yet to support the latest release of Ubuntu, so we have to fall back to the last LTS release.

SEE: Power checklist: Managing and troubleshooting Linux user accounts (Tech Pro Research)

All you will need is a running Ubuntu Server 16.04 instance and a user account with sudo privileges.

And with that, let's install.


The first thing we must do is take care of a number of dependencies. Before the first dependency is installed, let's update and upgrade Ubuntu Server. You'll want to take care of this at a time when you can reboot the server (in case the kernel is upgraded). To update and upgrade, open a terminal window, and issue the commands:

sudo apt-get update
sudo apt-get upgrade

With the upgrade out of the way, we'll begin with the web server. We'll make use of Apache, so to install this server, open a terminal window and issue the command:

sudo apt-get install apache2

Now we start and enable the new web server with the commands:

sudo systemctl start apache2
sudo systemctl enable apache2

Next, we must install our database. Even though we're working with Ubuntu 16.04, we'll still want to use MariaDB. To install the server, issue the following command:

sudo apt-get install mariadb-server mariadb-client

Start and enable the database server with the commands:

sudo systemctl start mariadb
sudo systemctl enable mariadb

In order to set an admin password for the database, issue the command sudo mysql_secure_installation and answer the required questions.

Restart the database with the command:

sudo systemctl restart mariadb

Now we move on to installing the necessary PHP components. The first commands to run are:

sudo apt-get install software-properties-common
sudo add-apt-repository ppa:ondrej/php
sudo apt update
sudo apt install php7.1 php7.1-common php7.1-mbstring php7.1-xmlrpc php7.1-soap php7.1-gd php7.1-xml php7.1-intl php7.1-mysql php7.1-cli php7.1-mcrypt php7.1-ldap php7.1-zip php7.1-curl

With PHP out of the way, we must modify the php.ini file. Issue the command sudo nano /etc/php/7.1/apache2/php.ini and make the following changes:

file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 100M
date.timezone = Your/Time/Zone

Create the database

Time to create our database. This is managed with the following command:

sudo mysql -u root -p
CREATE USER 'orangehrmuser'@'localhost' IDENTIFIED BY 'PASSWORD';
GRANT ALL ON orangehrm.* TO 'orangehrmuser'@'localhost' IDENTIFIED BY 'PASSWORD' WITH GRANT OPTION;

Where PASSWORD is a unique and strong password.

Download and unpack OrangeHRM

With the dependencies and database out of the way, we can now install OrangeHRM. Download the latest version with the commands:

cd /var/www/html/

Unpack the file with the commands:

sudo apt-get install unzip
sudo unzip

Rename the OrangeHRM folder with the command:

mv orangehrm-4.0 orangehrm

Set the necessary privileges with the commands:

sudo chown -R www-data:www-data /var/www/html/orangehrm/
sudo chmod -R 755 /var/www/html/orangehrm/

Configure Apache

The first thing to do is create an OrangeHRM Apache conf file. Issue the command:

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

The contents of that file will be:

<VirtualHost *:80>
     DocumentRoot /var/www/html/orangehrm

     <Directory /var/www/html/orangehrm/>
        Options +FollowSymlinks
        AllowOverride All
        Require all granted

     ErrorLog ${APACHE_LOG_DIR}/error.log
     CustomLog ${APACHE_LOG_DIR}/access.log combined


Save and close the file.

Enable the site and the rewrite module with the commands:

sudo a2ensite orangehrm.conf
sudo a2enmod rewrite

Restart Apache with the command:

sudo systemctl restart apache2

Install OrangeHRM

Open a browser and point it to http://SERVER_IP/orangehrm (where SERVER_IP is the actual IP address of your server), at which point you will be greeted by the OrangeHRM web-based installer (Figure A).

Figure A

Figure A

The OrangeHRM web-based installer.

The remainder of the installation is a simple matter of walking through the installer wizard. Once you complete the wizard, your OrangeHRM instance is ready to serve your company.

Hopefully, at some point in the near future, OrangeHRM will be supported on Ubuntu 18.04 with a more updated version of PHP. Until then, enjoy this tool that will take your human resources department to the next level.

Also see