Installing Open HRMS

Install PostgreSQL

This article helps you with the process of installing Open HRMS at your workplace.Following below are the steps pertaining to same.
sudo apt-get update && sudo apt-get upgrade
PostgreSQL is released under the PostgreSQL License, a free and open source permissive software license, developed by the PGDG (PostgreSQL Global Development Group), a group of individual volunteers and corporate companies. Here, we will go through steps on how to install PostgreSQL 10 on Ubuntu 18.04. PostgreSQL publishes deb packages for Ubuntu, and their packages are fresher than those available in OS base repository.

Import the PostgreSQL signing key.

wget -q https://www.postgresql.org/media/keys/ACCC4CF8.asc -O- | sudo apt-key add -
Add the PostgreSQL repository to /etc/apt/sources.list.d/postgresql.list file.

echo "deb http://apt.postgresql.org/pub/repos/apt/ bionic-pgdg main" | sudo tee /etc/apt/sources.list.d/postgresql.list

update the repository index.

sudo apt update
Install the PostgreSQL 10
sudo apt install -y postgresql-10

Enable PostgreSQL on Startup

sudo systemctl enable postgresql

sudo su postgres------> to get into the postgres here you can type following to create a new user openhrms and assign role

createuser --createdb --username postgres --no-createrole --no-superuser --pwprompt openhrms
when prompted for a password type openhrms to see the postgres interpreter type 'psql' type --------> ALTER USER openhrms WITH SUPERUSER; to change it to super user the \du ----> for the list of users (openhrms can be seen) to exit use '\q' then 'exit' again to exit from the postgres

Open HRMS Setup

Configure your Open HRMS web application to work with the PostgreSQL database backend.

Create the Open HRMS User

In order to separate OpenHRMS from other services, create a new Open HRMS system user to run its processes:

sudo adduser --system --home=/opt/openhrms --group openhrms

Configure Logs

The examples in this guide use a separate file for logging Open HRMS activity:
sudo mkdir /var/log/openhrms 

Install Open HRMS

Use Git to clone the Odoo files onto your server:

sudo git clone https://www.github.com/odoo/odoo --depth 1 \ --branch 11.0 --single-branch /opt/openhrms
sudo git clone https://github.com/CybroOdoo/OpenHRMS.git --depth 1 \ --branch 11.0 --single-branch /opt/openhrms/openhrms     

Install Odoo 11 specific Python dependencies:
sudo -H pip3 install --upgrade pip
sudo -H pip3 install -r /opt/openhrms/doc/requirements.txt
sudo -H pip3 install -r /opt/openhrms/requirements.txt
sudo pip3 install pandas
Install Less CSS via Node.js and npm:
sudo curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - \
&& sudo apt-get install -y nodejs \
&& sudo npm install -g less less-plugin-clean-css

Download the wkhtmltopdf stable package

.
cd /tmp
wget https://github.com/wkhtmltopdf/wkhtmltopdf/releases/download/0.12.4/wkhtmltox-0.12.4_linux-generic-amd64.tar.xz 
Extract the package:
tar -xvf wkhtmltox-0.12.4_linux-generic-amd64.tar.xz 

To ensure that wkhtmltopdf functions properly, move the binaries to a location in your executable path and give them the necessary permission for execution:

sudo mv wkhtmltox/bin/wk* /usr/bin/ 
&& sudo chmod a+x /usr/bin/wk

Configure the OpenHRMS Server

Copy the included configuration file to /etc/ and change its name to openhrms-server.conf

sudo cp /opt/openhrms/debian/odoo.conf /etc/openhrms-server.conf
And edit the file as follows.

[options]
; This is the password that allows database operations:
; admin_password = admin
db_host = localhost
db_port = 5432
db_user = openhrms
db_password = False
addons_path = /opt/openhrms/addons, /opt/openhrms/openhrms
logfile = /var/log/openhrms/openhrms.log

Create service file /lib/systemd/system/openhrms-server.service

[Unit]
Description=OpenHRMS
Documentation=https://www.openhrms.com
[Service]
# Ubuntu/Debian convention:
Type=simple
User=openhrms
ExecStart=/opt/openhrms/odoo-bin -c /etc/openhrms-server.conf
[Install]
WantedBy=default.target

Change File Ownership and Permissions

Change the Open HRMS -server service permissions and ownership so only root can write to it, while the Open HRMS user will only be able to read and execute it:

sudo chmod 755 /lib/systemd/system/openhrms-server.service \
&& sudo chown root: /lib/systemd/system/openhrms-server.service
Since the Open HRMS user will run the application, it changes the ownership accordingly:
sudo chown -R openhrms: /opt/openhrms/
Set the Open HRMS user as the owner of log directory as well:
sudo chown openhrms:root /var/log/openhrms
Protect the server configuration file. Change its ownership and permissions, so no other non-root user can access it:
sudo chown openhrms: /etc/openhrms-server.conf \
&& sudo chmod 640 /etc/openhrms-server.conf
Start the Open HRMS service:
sudo systemctl start openhrms-server
Confirm that Open HRMS - Service is running:
sudo systemctl status openhrms-server
Enable Open HRMS on Startup
sudo systemctl enable openhrms-server