How to Install OrangeHRM on Ubuntu

OrangeHRM is a widely used, web-based, open-source human resource management software that can be used to manages employee's attendance, performance, recruitment and annual appraisals. It supports both Linux and Windows operating systems. It comes with lots of features that fulfills all your human resource management needs. OrangeHRM comes in three editions Opensource edition, Enterprise Edition, and Professional edition.

In this article, I will show you how to install OrangeHRM on an Ubuntu 14.04 server.

Requirements

  • Fresh Ubuntu 14.04 server installed on your system.
  • PHP > 5.5.0 with Apache and MySQL/MariaDB.
  • Sudo user with root privileges.

1 Getting Started

Before starting, it is recommended to update your system with the latest stable version.

You can do this by running the following command:

sudo apt-get update -y
sudo apt-get upgrade -y

Once your system is updated, restart your system and login with sudo user.

2 Installing Apache Web Server

Apache web server is required to run OrangeHRM. in this step we will install Apache with other required libraries to our system. You can install all of them by running the following command:

sudo apt-get install apache2 apache2-data apache2-mpm-prefork libaio1 libapache2-mod-php5 libapr1 libaprutil1 libdbd-mysql-perl libdbi-perl libhtml-template-perl libmysqlclient18 libterm-readkey-perl libwrap0 tcpd -y

Once all the packages are installed, start Apache service and enable it to start on boot with the following command:

sudo /etc/init.d/apache2 start
sudo update-rc.d apache2 defaults

3 Installing PHP

OrangeHRM supports PHP version greater than 5.5.0. You can install PHP5 and other libraries with the following command:

sudo apt-get install php5 php5-cli php5-common php5-json php5-mysql php5-readline -y

Once the installation is completed, you can proceed to install the MariaDB server.

4 Installing and Configuring MariaDB

OrangeHRM uses MariaDB/MySQL to store it's data. You can install MariaDB-server with the following command:

sudo apt-get install mariadb-server -y

Once MariaDB is installed, start the MariaDB service and enable it to start on boot with the following command:

sudo /etc/init.d/mysql start
sudo update-rc.d mysql defaults

By default MariaDB is not secured, so you will need to secure it. You can secure it by running the mysql_secure_installation script.

sudo mysql_secure_installation

You will need to answer all the questions as shown in below output:

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
      SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user.  If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none): 
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] n

 ... skipping.

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

Once the MariaDB root password is set, login to MariaDB console with the following command:

mysql -u root -p

Enter your root password when prompt, then create a database for OrangeHRM:

MariaDB [(none)]>CREATE DATABASE orangehrm_db;

Next, create a username and password for OrangeHRM with the following command:

MariaDB [(none)]>CREATE USER 'orangehrm'@'localhost' IDENTIFIED BY 'your-password';

Next, grant privileges to the OrangeHRM database with the following command:

MariaDB [(none)]>GRANT ALL PRIVILEGES ON orangehrm_db.* TO 'orangehrm'@'localhost';

Next, you will need to run the FLUSH PRIVILEGES command so that the privileges table will be reloaded by MariaDB and we can use new credential:

MariaDB [(none)]>FLUSH PRIVILEGES;

Finally, exit from the MariaDB console with the following command:

MariaDB [(none)]>\q

5 Installing OrangeHRM

First, download the latest stable version of the OrangeHRM from the SourceForge website. You can download it with the following command:

wget https://excellmedia.dl.sourceforge.net/project/orangehrm/stable/3.3.3/orangehrm-3.3.3.zip

Once the download is completed, extract the downloaded archive with the following command:

unzip orangehrm-3.3.3.zip

Next, move the extracted directory to the web root directory:

sudo mv orangehrm-3.3.3 /var/www/html/orangehrm

And give proper permission to the orangehrm directory:

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

6 Configuring Apache for OrangeHRM

Now, you will need to create a virtual host for OrangeHRM. To do so create an orangehrm.conf file:

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

add the following contents:

<VirtualHost *:80>
ServerAdmin [email protected]
ServerName yourdomain.com
DocumentRoot /var/www/html/orangehrm
<Directory /var/www/html/orangehrm>
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Require all granted
</Directory>
ErrorLog ${APACHE_LOG_DIR}/orangehrm-error.log
CustomLog ${APACHE_LOG_DIR}/orangehrm-access.log combined
</VirtualHost>

Save and close the file. Then disable the default virtual host file and enable the OrangeHRM virtual host file with the following command:

sudo a2dissite 000-defaults
sudo a2ensite orangehrm

Next, restart the Apache service to read the new virtual host configuration:

sudo /etc/init.d/apache2 restart

Once you are done, you can proceed to access OrangeHRM web interface.

7 Accessing OrangeHRM

OrangeHRM runs on port 80. So you will need to allow port 80 through UFW firewall. By default UFW is disabled on your system, so you need to enable it first. You can enable it with the following command:

sudo ufw enable

Once UFW firewall is enabled, you can allow port 80 by running the following command:

sudo ufw allow tcp/80

You can now check the status of UFW firewall by running the following command:

sudo ufw status

Now, open your favorite web browser and access the URL http://yourdomain.com, you will be redirected to the OrangeHRM web installation wizard as shown in below image.

OrangeHRM Welcome Page

Click on the "Next" button. You should see the License agreement in below image.

Accept license agreement

Now, click on the "I Accept" button. You should see the following page.

Database settings

Enter your database configuration information such as Database Host, Database Port, Database Name, Username, and Password. Then click on the "Next" button. You should see the following page.

System check

Make sure all of the system check items are green. Then Click on the "Next" button. You should see the following page.

Create admin user

Provide your admin user details like admin username and password. Then click on the "Next" button. You should see the following page.

Confirm settings

Now, confirm all the details which you have provided earlier. Then click on the "Install" button. Once the installation is completed, you should see the following page.

Installation starts

Click on the "Next" button, you should see the following page.

Registration

Provide your company name and click on the "Finish" button, you should see the OrangeHRM login page in below image.

Login page

Provide your admin credentials and click on the "Login" button, you should see the OrangeHRM Dashboard in below image.

OrangeHRM Dashboard

Conclusion

I hope, you have now enough knowledge to install and configure OrangeHRM in your server. Feel free to comments me if you have any doubt.

Share this page:

4 Comment(s)