How to Install and Configure OrangeHRM on Ubuntu 16.04
Get on HR's good side with this open source tool.
Join the DZone community and get the full member experience.
Join For FreeIntroduction
OrangeHRM is a free, open source, and widely used Human Resource Management software application. OrangeHRM is specially intended for a small or medium enterprise company. OrangeHRM is open source, so you can redistribute or modify it under the terms of the GNU General Public License. OrangeHRM offers many different modules, including, leave and time off management, recruiting and onboarding, performance and training, travel and expense tracker, time and attendance management, disciplinary tracking, orange app, and other HR management tools. OrangeHRM also provide two additional edition of OrangeHRM, OrangeHRM Professional and OrangeHRM Enterprise edition for the company that needs support from OrangeHRM Inc.
In this tutorial, we will learn how to install OrangeHRM on Ubuntu 16.04 server.
Requirements
A fresh Alibaba Cloud Ubuntu 16.04 instance with minimum 2GB RAM.
A static IP address 192.168.0.103 is configured on the instance.
A Root password is setup on the server.
Launch Alibaba Cloud ECS Instance
First, login to your Alibaba Cloud ECS Console. Create a new ECS instance, choosing Ubuntu 16.04 as the operating system with at least 2GB RAM. Connect to your ECS instance and log in as the root user.
Once you are logged into your Ubuntu 16.04 instance, run the following command to update your base system with the latest available packages.
apt-get update -y
Install LEMP Server
OrangeHRM runs on the web server, written in PHP, and uses MariaDB for database. So you will need to install NGINX, MariaDB, and PHP to your system. First, install Nginx and MariaDB server by running the following command:
apt-get install nginx mariadb-server -y
Once both are installed, start MariaDB and Nginx service and enable them to start on boot with the following command:
systemctl start nginx
systemctl start mysql
systemctl enable nginx
systemctl enable mysql
By default, the latest version of PHP is not available in Ubuntu 16.04 default repository. So you will need to add the repository for that. You can add it by running the following command:
apt-get install software-properties-common -y
add-apt-repository ppa:ondrej/php
Next, update the repository and install PHP with the following command:
apt-get update -y
apt-get install php7.1-fpm php7.1-common php7.1-mbstring php7.1-ldap php7.1-zip 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-curl -y
Once all the packages are installed, you will need to modify php.ini file:
nano /etc/php/7.1/fpm/php.ini
Make the following changes:
file_uploads = On
allow_url_fopen = On
memory_limit = 256M
upload_max_filesize = 150M
display_errors = Off
cgi.fix_pathinfo = 0
date.timezone = Asia/Kolkata
Save and close the file.
Configure Database
By default, MariaDB installation is not secured. So you will need to secure it first. You can secure it by running the following script:
mysql_secure_installation
Answer all the questions as shown below:
Change the password for root ? N
Remove anonymous users? Y
Disallow root login remotely? Y
Remove test database and access to it? Y
Reload privilege tables now? Y
Once the MariaDB is secured, login to MariaDB shell using the following command:
mysql -u root -p
Enter your root password, then create a database and user for OrangeHRM:
MariaDB [(none)]> CREATE DATABASE orangehrm_db;
MariaDB [(none)]> CREATE USER 'orangehrm'@'localhost' IDENTIFIED BY 'password';
Next, grant all privileges to the OrangeHRM database:
MariaDB [(none)]> GRANT ALL ON orangehrmdb.* TO 'orangehrm'@'localhost' IDENTIFIED BY 'password' WITH GRANT OPTION;
Next, flush the privileges and exit from the MariaDB shell:
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> exit;
Install OrangeHRM
Next, you will need to download the latest version of OrangeHRM from their website. You can download it with the following command:
wget https://excellmedia.dl.sourceforge.net/project/orangehrm/stable/4.1/orangehrm-4.1.zip
Once the download is completed, extract the downloaded file:
unzip orangehrm-4.1.zip
Next, copy extracted directory to the web root directory and give proper permissions:
cp -r orangehrm-4.1 /var/www/html/orangehrm
chown -R www-data:www-data /var/www/html/orangehrm/
chmod -R 755 /var/www/html/orangehrm/
Configure NGINX for OrangeHRM
Next, you will need to create an NGINX virtual host file for OrangeHRM. You can do this with the following command:
nano /etc/nginx/sites-available/orangehrm
Add the following lines:
server {
listen 80;
listen [::]:80;
root /var/www/html/orangehrm;
index index.php index.html index.htm;
server_name example.com www.example.com;
client_max_body_size 100M;
location / {
try_files $uri $uri/ /index.php?$uri&$args;
}
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/var/run/php/php7.1-fpm.sock;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
include fastcgi_params;
}
}
Save and close the file, then enable virtual host with the following command:
ln -s /etc/nginx/sites-available/orangehrm /etc/nginx/sites-enabled/
Next, check the Nginx for any configuration error with the following command:
nginx -t
You should see the following output:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Finally, restart NGINX to apply all the changes:
systemctl restart nginx
Access OrangeHRM Web Installation Wizard
OrangeHRM is now installed, it's time to install it through a web browser.
Open your web browser and type the URL http://example.com, you will be redirected to the following page:
Click on the Next button, you should see the following page:
Next, accept the license agreement, you should see the following page:
Here, provide your database configuration details. Then click on the Next button. You should see the following page.
Once all the system check completed successfully, click on the Next button. You should see the following page:
Now, provide your admin username and password, then click on the Next button. You should see the following page:
Now, confirm all the details and click on the Install button to start the installation. Once the installation is completed, You should see the following page:
Now, click on the Next button. You should see the following page:
Next, click on the Finish button. You will be redirected to the OrangeHRM login page:
Provide your admin username and password, then click on the Login button. You should see the OrangeHRM dashboard in the following image:
Opinions expressed by DZone contributors are their own.
Comments