Tuesday, April 3, 2012

How to Install Open Ticket Request System [ OTRS ] Centos & Redhat

What is OTRS ??

               OTRS, an initialism for Open-source Ticket Request System, is a free and open-source trouble ticket system software package that a company, organization, or other entity can use to assign tickets to incoming queries and track further communications about them. It is a means of managing incoming inquiries, complaints, support requests, defect reports, and other communications.

Features
  • Web access
  • Knowledge base
  • Centralized reporting
  • Easy integration
  • Automatic request monitoring
  • Self-service
  • Custom branding
  • Access Management
  • Easy and Flexible Integration
  • Time Accounting

More Info Here

Installation of OTRS

Prerequisites


# OTRS requires HTTPD( Apache ),MYSQL Database or POSTGRESQL Database,PERL & PERL MODULES listed below.

# Install Apache
$ yum install httpd








# Install Mysql Database

 $ yum groupinfo 'Mysql Database'

# This Command provides details about Mysql Database & its dependencies to be install for otrs.







# Now install Mysql Database & its dependencies

$ yum groupinstall 'Mysql Database'










 # After installing mysql database start mysql service

$ /etc/init.d/mysqld start


 

# start Mysql secure installation script & set the parameters as shown below
$ /usr/bin/mysql_secure_installation
    [local-host]# /usr/bin/mysql_secure_installation

   NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
   SERVERS IN PRODUCTION USE!  PLEASE READ EACH STEP CAREFULLY!
   In order to log into MySQL to secure it, we'll need the current
   password for the root user.  If you've just installed MySQL, 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 MySQL
   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] Y
   New password:
   Re-enter new password:
   Password updated successfully!
   Reloading privilege tables..
   ... Success!
   By default, a MySQL installation has an anonymous user, allowing anyone
   to log into MySQL 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, MySQL 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 MySQL
   installation should now be secure.
   Thanks for using MySQL!
# Download required version of OTRS.
 $ wget http://ftp.otrs.org/pub/otrs/otrs-3.0.7.tar.gz







# Extract tar package
$ tar -zxvf otrs-3.0.7.tar.gz




# Change Directory to OTRS directory
$ cd otrs-3.0.7/



# Make directory with name otrs
$ mkdir /opt/otrs



# copy everything from “ otrs-3.0.7 ”directory to /opt/otrs/
$ cp -avr otrs-3.0.7/ /opt/otrs/



# Add user otrs
$ useradd -d /opt/otrs/ -c ’OTRS user’ otrs



# Add otrs user to apache-group
$ usermod -G apache otrs



# Change to otrs directory ( /opt/otrs/ )
$ cd /opt/otrs/




# Copy Configuration file for otrs as shown in image
$ cp Kernel/Config.pm.dist Kernel/Config.pm



# Change directory to config folder ( /Kernel/Config/ )
 $ cd Kernel/Config/



# Now create files from given sample files using following command
$ for foo in *.dist; do cp $foo `basename $foo .dist`; done




# Install perl modules
$ perl -MCPAN -e shell







# As shown in image install following perl modules
$ install Bundle::CPAN
$ install Digest::MD5
$ install Net::DNS
$ install MIME::Base64
$ install Net::LDAP
$ install GD
$ install GD::Text
$ install GD::Graph
$ install GD::Graph::lines
$ install GD::Text::Align
$ install CGI
$ install Crypt::PasswdMD5
$ install CSS::Minifier
$ install Date::Format
$ install Date::Pcalc
$ install DBI
$ install DBD::mysql
$ install Encode::HanExtra
$ install IO::Scalar
$ install SOAP::Lite
$ install Text::CSV
$ install Text::CSV_PP
$ install Text::CSV_XS
$ install XML::Parser
$ install LWP::UserAgent
$ install Mail::Internet
$ install Mail::POP3Client

# Create otrs apache configuration file & copy paste the following lines in otrs.conf as shown in image

$ vi /etc/httpd/conf.d/otrs.conf























# add following lines to apache configuration file….!
# Basic apache configuration file for OTRS
   ScriptAlias /otrs/ "/opt/otrs/bin/cgi-bin/"
   Alias /otrs-web/ "/opt/otrs/var/httpd/htdocs/"
   # Directory settings
   <Directory "/opt/otrs/bin/cgi-bin/">
       AllowOverride None
       Options +ExecCGI -Includes
       Order allow,deny
       Allow from all
   </Directory>
   <Directory "/opt/otrs/var/httpd/htdocs/">
       AllowOverride None
       Order allow,deny
       Allow from all
   </Directory>

# Restart Apache Service.
$ /etc/init.d/httpd restart

 


# Now check all required perl modules are installed, if any perl module is missing then install as explained in step number 20

$ /opt/otrs/bin/otrs.CheckModules.pl
















# After installing all perl modules we have to apply the permissions to otrs folder to do this use following command
$ /opt/otrs/bin/SetPermissions.pl /opt/otrs --otrs-user=otrs --otrs-group=apache --web-user=apache --web-group=apache





NOTE: If proper permissions are not set then you are going to face issues during installation of otrs

# Now restart apache & mysql service

$ /etc/init.d/httpd restart
 $ /etc/init.d/mysqld restart








Note: Before Continue Next step Make sure that Required Perl modules are installed correctly

# start otrs web installer

# Open any internet browser & open following link

http://yourhost/otrs/installer.pl
http://127.0.0.1/otrs/installer.pl

















# Click next, Click Accept License & fill details of database as shown in image















 

























































# Click Next






# Fill required details as shown in image or configure it later on & click on Skip This Step






































 # After completing web based installation successfully open internet browser & open link

http://127.0.0.1/otrs/index.pl
or
 http://yourhost/otrs/index.pl

# login with root account

# default username: root@localhost & password: root




 
 








Friday, March 2, 2012

How to Install Gitolite in Centos or Redhat or Fedora

NOTE : This Tutorial is tested on CentOS, Fedora & Redhat.


How to install Gitolite for Hosting Git Repository ?

What is Git ?

         Git is a free & open source, distributed version control system designed to handle everything from small to very large projects with speed and efficiency. Every Git clone is a full-fledged repository with complete history and full revision tracking capabilities, not dependent on network access or a central server. Branching and merging are fast and easy to do.

More Info HERE

What is Gitolite ?

          Gitolite allows you to setup git hosting on a central server, with fine-grained access control and many more powerful features.

           Gitolite is an access control layer on top of git. Here's an "executive summary":
  • use a single unix user ("real" user) on the server
  •  provide access to many gitolite users
  •  they are not "real" users 
  • they do not get shell access
  • control access to many git repositories 
  • read access controlled at the repo level 
  • write access controlled at the branch/tag/file/directory level, including who can rewind, create, and delete branches/tags 
  • can be installed without root access, assuming git and perl are already installed 
  • authentication is most commonly done using sshd, but you can also use httpd if you prefer (this may require root access)          

More Info HERE

Install Gitolite :

Prerequisites:

Perl 5.8.8
git (yum install git)
 
  (1) First Login as root & Add user called "git" 
$ useradd git
$ passwd git








(2) Now Login as root to any local system & Add user called "gitadmin"
 $ useradd gitadmin
 $ passwd gitadmin 








(3) Switch to User gitadmin & generate ssh key as shown
$ su gitadmin
$ ssh-keygen
















(4) Copy ssh public key as gitadmin.pub
$ cp .ssh/id_rsa.pub gitadmin.pub




(5)  Now Copy this ssh key on git server
$ scp gitadmin.pub git@gitserver:



(6) Now Login to git server as user "git" & download gitolite source
$ git clone http://github.com/sitaramc/gitolite.git







(7) Change directory gitolite & run "gl-system-install" command
$ cd gitolite/
$ src/gl-system-install











(8)  Now run "gl-setup" command
$ source .bash_profile
$ gl-setup gitadmin.pub
(9) once you run "gl-setup gitadmin.pub" command hit enter & then the Vi editor pops up, exit it by typing ":wq" (colon, then the letter 'w' & 'q'), hit enter. Then the installs complete.



 








(10) Finally clone the gitolite admin repository
$ git clone git@gitserver:gitolite-admin.git







Thursday, February 16, 2012

Monitor Linux Server Memory Usage

                Check_memory.py is script written in Python to monitor Linux server Memory usage in MB (MegaBytes).

>> ./check_memory.py --help

>> ./check_memory.py 1200 1500

where 1200 is Warning Limit & 1500 is Critical Limit in MB.

Service definition in linuxserver.cfg

define service{
        use                                       local-service        
        host_name                           My Linux Server
        service_description             Check Memory
        check_command                 check_memory.py!1200!1500
       }


Command definition in commands.cfg

# 'check_memory.py' command definition
define command{
        command_name    check_memory.py
        command_line    $USER1$/check_memory.py $ARG1$ $ARG2$
        }


Download Check_Memory.py






Wednesday, February 15, 2012

Nagios Auto Installation Script


Nagios :
            Nagios is a powerful monitoring system that enables organizations to identify and resolve IT infrastructure problems before they affect critical business processes.
               Designed with scalability and flexibility in mind, Nagios gives you the peace of mind that comes from knowing your organization's business processes won't be affected by unknown outages.
                Nagios is a powerful tool that provides you with instant awareness of your organization's mission-critical IT infrastructure. Nagios allows you to     detect and repair problems and mitigate future issues before they affect end-users and customers.