Wednesday, 13 May 2015

How to setup Document Management System Using OpenDocMan On CentOS 6.4

OpenDocMan is a free, web based, open source document management system written in PHP. It is licensed under GPL, which means you can use it freely and modify the source code any way you wish. It has multi-language support, and features web based access, fine grained control of access to files, and automated install and upgrades.

Create database for OpenDocMan

Log in to mysql as root user:
#mysql -u root -p
Create a database and user for OpenDocMan. For example, here I am going to create database called “opendocmandb” and database user called “opendocmanuser” respectively. Change these values as your liking.

Welcome to the MySQL monitor.  Commands end with ; or g.
Your MySQL connection id is 2
Server version: 5.5.35 MySQL Community Server (GPL) by Remi

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

mysql> create database opendocmandb;
Query OK, 1 row affected (0.03 sec)

mysql> GRANT ALL ON opendocmandb.* TO opendocmanuser@localhost IDENTIFIED BY 'centos';

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Adjust SELinux to avoid “403 forbidden error” while installing OpenDocMan. To do that, run the following commands from the Terminal:

#setsebool -P httpd_enable_homedirs true
#chcon -R -t httpd_sys_content_t /var/www/html/opendocman/

Download OpenDocMan
Download the latest version from this link.
Unzip and move the opendocman folder to your apache root folder.

#mv opendocman- /var/www/html/opendocman
Create a folder outside of your public html folder that will contain your data files. This will be your “dataDir” folder in the config.

#mkdir /var/www/odm_data/
Make sure the permissions and ownership of the data folder will allow for the web server to write to it.

#chown apache:apache /var/www/odm_data/
#chmod -R ugo+w /var/www/odm_data/
Make sure there is a templates_c folder, and the templates_c folder is writable. If the folder doesn’t exists, create it.

#chmod -R ugo+w /var/www/html/opendocman/templates_c/
Begin Installation
Open up your browser and navigate to URL http://ip-address/opendocman. The following screen should appear.

Click on Create Configuration File link.

Click on the link that says: Let’s go

Fill up the database details and administrator password. Also, replace the path of the data folder with correct one. In our example, we use /var/www/odm_data/ as our data directory. And then, click Submit.

If the installer can’t create config.php file itself, it will throw the following warning message.

Don’t panic! Create a config.php file with contents as given in the above dialogue box.
vi /var/www/html/opendocman/config.php
Copy the text given in the above dialog box.

config.php - OpenDocMan database config file
Copyright (C) 2011 Stephen Lawrence Jr.

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

// Eliminate multiple inclusion of config.php
if( !defined('config') )
    define('config', 'true', false);

// config.php - useful variables/functions

// ** MySQL settings - You can get this info from your web host ** //
/** The name of the database for [OpenDocMan */
define('DB_NAME', 'opendocmandb');

/** MySQL database username */
define('DB_USER', 'opendocmanuser');

/** MySQL database password */
define('DB_PASS', 'centos');

/** MySQL hostname */
/* The MySQL server. It can also include a port number. e.g. "hostname:port" or a path to a 
 * local socket e.g. ":/path/to/socket" for the localhost.  */
define('DB_HOST', 'localhost');

 * Prefix to append to each table name in the database (ex. odm_ would make the tables
 * named "odm_users", "odm_data" etc. Leave this set to the default if you want to keep
 * it the way it was. If you do change this to a different value, make sure it is either
 * a clean-install, or you manually go through and re-name the database tables to match.
 * @DEFAULT 'odm_'
 * @ARG String
$GLOBALS['CONFIG']['db_prefix'] = 'odm_';


/** Absolute path to the OpenDocMan directory. */
if ( !defined('ABSPATH') )
    define('ABSPATH', dirname(__FILE__) . '/');

Save and close the file. Then click Proceed to the installer button in the previous wizard.
Now you will get the following screen. Click on the link that starts with “New installation….” text. Please be mindful that the new installation will destroy all data’s. If you’re upgrading from older version to newer version, click on the links that starts with texts “Upgrade from….”.
Congratulations! We have successfully installed OpenDocMan.

Click on the link that says Click HERE to edit your site settings to log in to the OpenDocMan dashboard. Log in with the default user name admin and the password you created while creating config.php file.

This is how my administrative dashboard looked.

After installing/upgrading OpenDocMan, don’t forget to remove the install folder.

#rm -fr /var/www/html/opendocman/install/
In the administrative section, you can adjust various things such as site title, maximum upload size, data directory etc. After defining all settings, hit the save button.
Admin Section
Click on the Admin tab on the top to navigate to Administrative section. In the admin section, you can add/delete/update users, department, category etc.
Also, you can adjust user permissions to access the particular files, departments and categories etc.
Adding Documents
Let us add a sample document. Navigate to Add Document section on the top.
Browse to the path to the document. Assign to the owner, department and select the Category etc. And, set the permissions to particular users if you want. Finally, click Submit to upload the document.
Now, the document is submitted to review. Once you submitted the document for review, your administrator can review and authorize documents.
To authorize the documents, log in as admin user. Go to the Admin tab, click on the link Reviews in the file section.
Select the document to review, and click Authorize to approve the document.

Now, you’ll see the authorized documents in the Home page.
That’s it! Your DMS is ready.

Install and Configure Nagios On CentOS, RHEL, Scientific Linux 6.5/6.4

Nagios is an open source software that can be used for network and infrastructure monitoring. Nagios will monitor servers, switches, applications and services. It alerts the System Administrator when something went wrong and also alerts back when the issues has been rectified.
With Nagios you can:
- Monitor your entire IT infrastructure.
– Identify problems before they occur.
– Know immediately when problems arise.
– Share availability data with stakeholders.hypothetical question
– Detect security breaches.
– Plan and budget for IT upgrades.
– Reduce downtime and business losses.

Nagios server:
Operating system : CentOS 6.5 minimal installation
IP Address       :
Nagios client:
Operating System : Ubuntu 13.04
IP Address       :


Also install the following prerequisites too.
# yum install gd gd-devel gcc glibc glibc-common

Nagios will not be found in CentOS official repositories, so let us add the EPEL repository to install nagios. To add and enable EPEL repository, refer the following link.
# yum install nagios*
# vi /etc/sysconfig/iptables
Add the following line:
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
Save and close the file. Restart iptables.
# service iptables restart
Configure Nagios
Add the admin mail address in the nagios contact file to receive alerts from nagios server. To do that edit file/etc/nagios/objects/contacts.cfg,

# vi /etc/nagios/objects/contacts.cfg
Find the following line and enter the email id:
email                  ;
Save and close the file. Then Edit file /etc/httpd/conf.d/nagios.conf,

# vi /etc/httpd/conf.d/nagios.conf
And edit the following lines if you want to access nagios administrative console from a particular IP series. Here i want to allow nagios administrative access from series only.
## Comment Lines 15 & 16 ##
#   Order allow,deny
#   Allow from all
## Uncomment and Change lines 17,18 & 19 as shown below ##
Order deny,allow
Deny from all
Allow from
Set nagiosadmin password
# htpasswd /etc/nagios/passwd nagiosadmin
New password:
Re-type new password:
Updating password for user nagiosadmin
Start nagios and httpd services and let them to start automatically on every boot.
# service nagios start
# service httpd start
# chkconfig nagios on
# chkconfig httpd on
Access Nagios admin console
Open nagios administrator console with URL http://nagios-server-ip/nagios and enter the username as nagiosadmin and its password which we created in the earlier steps.

This is how Nagios administrative console looks:

Click on the “Hosts” section in the left pane of the console. You will see the no of hosts to be monitored by Nagios server. Initially, the nagios server (localhost) itself will only be monitored.

Click on the monitoring host to display more details:

Add Monitoring targets to Nagios server
Now let us add some clients to monitor by Nagios server. To do that we have to install nrpe and nagios-pluginsin our monitoring targets.
On CentOS/RHEL/Scientifc Linux clients:
Like i said before, you have to add EPEL repository in your CentOS/RHEL/Scientific Linux 6.x clients to install nrpepackage.
Install “nrpe” and “nagios-plugins” packages in client systems to be monitored.
# yum install nrpe nagios-plugins-all openssl
On Debian/Ubuntu clients:
$ sudo apt-get install nagios-nrpe-server nagios-plugins
Configure Monitoring targets
Edit /etc/nagios/nrpe.cfg file,
# vi /etc/nagios/nrpe.cfg
Add your Nagios server ip address
## Line 81 - Add the Nagios server IP ##
Start nrpe service:
# service nrpe start
# chkconfig nrpe on
For Debian/Ubuntu Clients, start nrpe service as shown below.
$ sudo /etc/init.d/nagios-nrpe-server restart
Now go back to your Nagios server to add the clients to be monitored through nagios server. Edit“/etc/nagios/nagios.cfg” file,
# vi /etc/nagios/nagios.cfg
and uncomment the following lines.
## Line 52 - Uncomment ##
Create a directory called “servers” under “/etc/nagios/”.
# mkdir /etc/nagios/servers
Create config file to the client to be monitored:

# vi /etc/nagios/servers/clients.cfg
define host{
use                             linux-server
host_name                       client
alias                           client
max_check_attempts              5
check_period                    24x7
notification_interval           30
notification_period             24x7
Finally restart nagios service.
# service nagios restart
Now open the nagios admin console in the browser and navigate to “Hosts” section in the left pane. You will see the newly added client will be visible there. Click on the host to see if there is anything wrong or alerts.

Click on the monitoring target, you’ll get the detailed output:

Like this way, you can define more clients by creating a separate config files “/etc/nagios/servers directory for each client.
Define services
We did define the monitoring host before. Now let us add some services of the monitoring host. For example to monitor the ssh service, add the following lines shown in red colour in the /etc/nagios/servers/clients.cfg file.
# vi /etc/nagios/servers/clients.cfg
define host{
use                             linux-server
host_name                       client
alias                           client
max_check_attempts              5
check_period                    24x7
notification_interval           30
notification_period             24x7
define service {
        use                             generic-service
        host_name                       client
        service_description             SSH
        check_command                   check_ssh
        notifications_enabled           0
Save and close the file. Restart Nagios.
# service nagios restart
Now log in to Nagios web console and check for the added services. Navigate to Services section, you’ll see the ssh service there.