Sunday 30 September 2012

How to redirect http to https in apache

 Just Add this line to end of your httpd.conf file

[root@station1 ~]# vim /etc/httpd/conf/httpd.conf
1025 RewriteEngine On
1026 RewriteCond %{SERVER_PORT} !443
1027 RewriteRule (.*) https://station1.ranjihat.com/ [R]
[root@station1 ~]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                             [  OK  ]

Thats it.. Open your webpage using http, you can observe the site will be automatically redirected to https.

Saturday 29 September 2012

How to install nagios in rhel 6.3 / centos 6.3

Introduction
This guide is intended to provide you with simple instructions on how to install Nagios from source (code) on Fedora and have it monitoring your local machine inside of 20 minutes. No advanced installation options are discussed here - just the basics that will work for 95% of users who want to get started.
These instructions were written based on a standard RHEL 6.3 Linux distribution. 

What You'll End Up With
 
If you follow these instructions, here's what you'll end up with:
  • Nagios and the plugins will be installed underneath /usr/local/nagios
  • Nagios will be configured to monitor a few aspects of your local system (CPU load, disk usage, etc.)
  • The Nagios web interface will be accessible at http://localhost/nagios/
Prerequisites
 
During portions of the installation you'll need to have root access to your machine.
Make sure you've installed the following packages on your Fedora installation before continuing.
  • Apache
  • PHP
  • GCC compiler
  • GD development libraries
You can use yum to install these packages by running the following commands (as root):
yum install httpd php

yum install gcc glibc glibc-common

yum install gd gd-devel 
gd-devel is not available in default package so download from here. 
While installing it throws dependency errors. 
Just install those dependency through yum after that install this gd-devel rpm
ftp://rpmfind.net/linux/centos/6.3/os/x86_64/Packages/gd-devel-2.0.35-10.el6.x86_64.rpm
 
1) Create Account Information
Become the root user.
su -l

Create a new nagios user account and give it a password.
/usr/sbin/useradd -m nagios

passwd nagios
Create a new nagcmd group for allowing external commands to be submitted through the web interface. Add both the nagios user and the apache user to the group.
/usr/sbin/groupadd nagcmd

/usr/sbin/usermod -a -G nagcmd nagios

/usr/sbin/usermod -a -G nagcmd apache
 
2) Download Nagios and the Plugins
Create a directory for storing the downloads.
mkdir ~/downloads

cd ~/downloads
Download the source code tarballs of both Nagios and the Nagios plugins (visit http://www.nagios.org/download/ for links to the latest versions).


3) Compile and Install Nagios

Extract the Nagios source code tarball.
cd ~/downloads

tar xzf nagios-3.2.3.tar.gz

cd nagios-3.2.3
Run the Nagios configure script, passing the name of the group you created earlier like so:
./configure --with-command-group=nagcmd
Compile the Nagios source code.
make all
Install binaries, init script, sample config files and set permissions on the external command directory.
make install

make install-init

make install-config

make install-commandmode

Don't start Nagios yet - there's still more that needs to be done...

4) Customize Configuration

Sample configuration files have now been installed in the /usr/local/nagios/etc directory. These sample files should work fine for getting started with Nagios. You'll need to make just one change before you proceed...
Edit the /usr/local/nagios/etc/objects/contacts.cfg config file with your favorite editor and change the email address associated with the nagiosadmin contact definition to the address you'd like to use for receiving alerts.
 
vi /usr/local/nagios/etc/objects/contacts.cfg

5) Configure the Web Interface

Install the Nagios web config file in the Apache conf.d directory.
 
make install-webconf

Create a nagiosadmin account for logging into the Nagios web interface. Remember the password you assign to this account - you'll need it later.
htpasswd -c /usr/local/nagios/etc/htpasswd.users nagiosadmin
Restart Apache to make the new settings take effect.
 
service httpd restart

Note: Consider implementing the ehanced CGI security measures described here 
to ensure that your web authentication credentials are not compromised. 
 
[root@station1 ~]# htdigest -c /usr/local/nagios/etc/.digest_pw "Nagios Access" \ 
nagiosadmin 
 
Adding password for nagiosadmin in realm Nagios Access.
New password: 
Re-type new password: 
 
[root@station1 ~]# vim /etc/httpd/conf.d/nagios.conf 
  9 ScriptAlias /nagios/cgi-bin "/usr/local/nagios/sbin"
 10 
 11 <Directory "/usr/local/nagios/sbin">
 12    SSLRequireSSL
 13    Options ExecCGI
 14    AllowOverride None
 15    Order allow,deny
 16 #   Allow from all
 17 #  Order deny,allow
 18 #  Deny from all
 19    Allow from 127.0.0.1 10.65.62.30
 20    AuthName "Nagios Access"
 21    AuthType Digest
 22    AuthUserFile /usr/local/nagios/etc/.digest_pw
 23    Require valid-user
 24 </Directory>
 25 
 26 Alias /nagios "/usr/local/nagios/share"
 27 
 28 <Directory "/usr/local/nagios/share">
 29    SSLRequireSSL
 30    Options None
 31    AllowOverride None
 32    Order allow,deny
 33 #   Allow from all
 34 #  Order deny,allow
 35 #  Deny from all
 36    Allow from 127.0.0.1 10.65.62.30
 37    AuthName "Nagios Access"
 38    AuthType Digest
 39    AuthUserFile /usr/local/nagios/etc/.digest_pw
 40    Require valid-user
 41 </Directory>

Monitoring Tools in rhel

Need to monitor Linux server performance? Try these built-in command 

top - Process Activity Command
 The top program provides a dynamic real-time view of a running system i.e. actual process activity. By default, it displays the most CPU-intensive tasks running on the server and updates the list every five seconds.
Commonly Used Hot Keys
The top command provides several useful hot keys:
Hot KeyUsage
tDisplays summary information off and on.
mDisplays memory information off and on.
ASorts the display by top consumers of various system resources. Useful for quick identification of performance-hungry tasks on a system.
fEnters an interactive configuration screen for top. Helpful for setting up top for a specific task.
oEnables you to interactively select the ordering within top.
rIssues renice command.
kIssues kill command.
zTurn on or off color/mono
vmstat - System Activity, Hardware and System Information

The command vmstat reports information about processes, memory, paging, block IO, traps, and cpu activity.

# vmstat 3

Display Memory Utilization Slabinfo

# vmstat -m

Get Information About Active / Inactive Memory Pages

# vmstat -a

w - Find Out Who Is Logged on And What They Are Doing

[root@station1 ~]# w root
 11:05:46 up 38 min,  3 users,  load average: 0.04, 0.11, 0.13
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     tty1     :0               10:28   38:23   1:37   1:37  /usr/bin/Xorg :
root     pts/0    :0.0             10:28   37:12   1.17s  0.00s sh reliance.sh
root     pts/3    :0.0             11:05    0.00s  0.02s  0.01s w root

Thursday 27 September 2012

Crondtab usage


What is a Crontab?
A cron is a utility that allows tasks to automatically run in the background of the system at regular intervals by use of the cron daemon. Crontab (CRON TABle) is a file which contains the schedule of cron entries to be run and at what times they are to be run. This can be quite useful. For example, you may have a personal temporary directory that you wish to be cleaned out once a day to keep your quota from being exceeded. This is where cron scheduling comes in to play. Not all systems allow for a cron schedule to be setup. You need to see your system administrator to see if it is available on your system.

How does it work?

The editor must be invoked using the -e switch. To create a cron schedule type:
crontab -e
Each cron job has at least 6 sections. Each section is separated by a single space, but the final section may have spaces within it. No spaces are allowed within Sections 1-5, only between them. Sections 1-5 are indicate when and how often you want the task (the sixth position) to be executed. All time are local times not GMT.

Here is how positions 1-5 are layed out:
1 Minute 0-59
2 Hour 0-23 (0 = midnight)
3 Day 1-31
4 Month 1-12
5 Weekday 0-6 (0 = Sunday)
An asterisk (*) is used to indicate that every instance (i.e. every hour, every weekday, etc.) of the particular time period will be used.
If you wish to use more than one instance of a particular time periods, then seperate the times by a comma. If you wish for continuous execution, the start and stop items are separated by a dash. For example, if you wanted to run your command at :05 and :35 past the hour, every hour, Monday through Friday, then your time stamp would look like this:
5,35 * * * 1-5 cmd
30 */1 * * * 1-5 cmd-- this means  at every 1 hours 30 min the process will execute
ll'y for days weeks and month u can apply like this by putting , between numbers.
Example- * * 1,30 1,6,12 1-5 cmd
The sixth position indicates which task will be run at the given time(s).
if you wanted to remove all of the files in you "temp" directory every morning at 4:45 AM, your command would look:
45 4 * * * rm /home/{username}/temp/*
(Where you insert your username where appropriate.)
Special Note: While system commands are normally located in the same directories with standard settings for almost all machines, it is best to put the full path of the directory to any commands, system or not. For example, it would be better to use /usr/bin/rm instead of just rm. This also applies to any scripts. If there are not full paths to system commands (or other local commands), then it is possible that the cronjob will error. It is always best to include full path names on all commands.
Only command lines, blank lines and comments may be place in a crontab file. Any other type of text will cause the crontab to not function properly.


Are there any toggle options to Crontab?
Yes, one has already been introduced. The -e option allows you to edit your cron file (or create a cron file does not exist). There are three toggle options to crontab:
-e Edit (or create) a crontab file
-l List the crontab file
-r Remove the crontab file.
Why do I keep getting an email each time my Cron job runs?
The email is crontab's way of notifing you that it has completed (or not) the job you requested it to run. After everything is running smoothly, you may want to disable this feature, or redirect the output to a log file instaed of an email.
If you wish to diasble the email (and not output to a log file) then, at the end of each of the cron job lines you wish to not be notified on, place the command:
>/dev/null 2>&1
This essential writes the email out to nowhere (a trash bin of sorts), and thus solves the problem. Your final cron job line will look like this:
45 4 * * * rm /home/{username}/temp/* >/dev/null 2>&1
If you wish to diasble the email (and output to a log file) then, at the end of each of the cron job lines you wish to not be notified on, place the command:
> {logfile path and name}
or
>> {logfile path and name}
Special Note: One > means replace the current log with a new one, while (two) >> means append the current output to the end of the current log.
This essential writes the email out to nowhere (a trash bin of sorts), and thus solves the problem. Your final cron job line will look like this:
45 4 * * * rm /home/{username}/temp/* > /home/{username}/cronlogs/clear_temp_dir.txt >/dev/null 2>&1

use this link for crontab gui - www.corntab.com/pages/crontab-gui 
 
That's it?
As has been show, there is not really too much to learn in order to use crontab. It is a quite useful tool in automating your recurring tasks. Happy crontabbing!!!

Examples-

Scheduling a Job For a Specific Time

The basic usage of cron is to execute a job in a specific time as shown below. This will execute the Full backup shell script (full-backup) on 10th June 08:30 AM.

Please note that the time field uses 24 hours format. So, for 8 AM use 8, and for 8 PM use 20.
30 08 10 06 * /home/ranjith/full-backup
  • 30 – 30th Minute
  • 08 – 08 AM
  • 10 – 10th Day
  • 06 – 6th Month (June)
  • * – Every day of the week

Wednesday 26 September 2012

How to configure postgres in rhel 6.3 / centos 6.3


-->
[root@station1 ~]# yum install postgresql*

Initializing the data first

root@station1 ~]# /etc/init.d/postgresql initdb
Initializing database: [ OK ]

Set PostgreSQL Environment

[root@station1 ~]# vim /var/lib/pgsql/.bash_profile
1 [ -f /etc/profile ] && source /etc/profile
2
3 PGDATA=/var/lib/pgsql/data
4 export PGDATA
5 PATH=$PATH:$HOME/bin:/usr/bin
6 export PATH
[root@station1 ~]# service postgresql start
Starting postgresql service: [ OK ]

Set postgres Password

[root@station1 ~]# su - postgres
-bash-4.1$ psql postgres postgres
psql (8.4.11)
Type "help" for help.
postgres=# alter user postgres with password 'postgres';
ALTER ROLE
postgres=#

Configure PostgreSQL pg_hba.conf File

[root@station1 ~]# vim /var/lib/pgsql/data/pg_hba.conf
70 local all all md5
71 # IPv4 local connections:
72 host all all 127.0.0.1/32 md5
73 # IPv6 local connections:
74 host all all ::1/128 md5

In order for the change to take effect, reload the pg_hba.conf file.

As with any command, there are several ways you can reload the pg_hba.conf file.

Method 1: From the shell using pg_ctl reload:
[root@station1 ~]# su - postgres
-bash-4.1$ pg_ctl reload
server signaled
-bash-4.1$

Method 2: From psql using pg_reload_conf();
[root@station1 ~]# su - postgres
-bash-4.1$ psql postgres postgres
Password for user postgres:
psql (8.4.11)
Type "help" for help.
postgres=# SELECT pg_reload_conf();
pg_reload_conf
----------------
t
(1 row)
postgres=#

Method 3: From the shell using -c switch to run select pg_reload_conf();
[root@station1 ~]# su - postgres
-bash-4.1$ psql postgres postgres -c "select pg_reload_conf();"
Password for user postgres:
pg_reload_conf
----------------
t
(1 row)
-bash-4.1$

How to configure svn in rhel 6.3 / centos 6.3


-->
Apache Subversion (often abbreviated SVN, after the command name svn) is a software versioning and revision control system distributed under an open source license. Developers use Subversion to maintain current and historical versions of files such as source code, web pages, and documentation. Its goal is to be a mostly compatible successor to the widely used Concurrent Versions System (CVS).

[root@station1 ~]# yum install mod_dav_svn subversion
[root@station1 ~]# vim /etc/httpd/conf.d/subversion.conf
41 <Location /svn>
42 DAV svn
43 SVNParentPath /var/www/svn
44 AuthType Basic
45 AuthName "Subversion repositories"
46 AuthUserFile /etc/svn-auth-users
47 Require valid-user
48 </Location>
[root@station1 ~]# htpasswd -cm /etc/svn-auth-users ranjith
New password:
Re-type new password:
Adding password for user ranjith
[root@station1 ~]# mkdir /var/www/svn
[root@station1 ~]# cd /var/www/svn/
[root@station1 svn]# svnadmin create testrepo
[root@station1 svn]# chown -R apache.apache testrepo
[root@station1 svn]# chcon -R -t httpd_sys_content_t /var/www/svn/testrepo
[root@station1 svn]# chcon -R -t httpd_sys_rw_content_t /var/www/svn/testrepo
[root@station1 ~]# service httpd restart

Goto http://station1.ranjihat.com/svn/testrepo address and you should see something like following, write username and password:




Configure repository
To disable anonymous access and enable access control add following rows to testrepo/conf/svnserve.conf file:

[root@station1 ~]# vim /var/www/svn/testrepo/conf/svnserve.conf
12 anon-access = none
27 authz-db = authz

Create trunk, branches and tags structure under testrepo

Create “template” directories with following command:

[root@station1 ~]# mkdir -p /tmp/svn-structure-template/{trunk,branches,tags}

Then import template to project repository using “svn import” command:

[root@station1 ~]# svn import -m 'Initial import' /tmp/svn-structure-template/ http://station1.ranjihat.com/svn/testrepo/

Authentication realm: <http://station1.ranjihat.com:80> Subversion repositories
Password for 'root':
Authentication realm: <http://station1.ranjihat.com:80> Subversion repositories
Username: ranjith
Password for 'ranjith':
Adding /tmp/svn-structure-template/trunk
Adding /tmp/svn-structure-template/branches
Adding /tmp/svn-structure-template/tags
-----------------------------------------------------------------------
ATTENTION! Your password for authentication realm:
<http://station1.ranjihat.com:80> Subversion repositories
can only be stored to disk unencrypted! You are advised to configure
your system so that Subversion can store passwords encrypted, if
possible. See the documentation for details.
You can avoid future appearances of this warning by setting the value
of the 'store-plaintext-passwords' option to either 'yes' or 'no' in
'/root/.subversion/servers'.
-----------------------------------------------------------------------
Store password unencrypted (yes/no)? yes
Committed revision 1.

Now refresh the webpage.

How to install tomcat in rhel 6.3 / centos 6.3

This post will cover installing and basic configuration of apache-tomcat-7.0.30

If you do not already have the Java Development Kit (JDK) installed on your machine, you will need to download and install the required JDK for your platform.

If you do have the JDK installed, you can skip to: Step 2: Download and Install the  apache-tomcat-7.0.30

Step 1: Install the JDK

[root@station1 Downloads]# rpm -ivh jdk-7u7-linux-x64.rpm
-->
[root@station1 Downloads]# JAVA_HOME=/usr/java/jdk1.7.0_07
[root@station1 Downloads]# export JAVA_HOME
[root@station1 Downloads]# PATH=$JAVA_HOME/bin:$PATH
[root@station1 Downloads]# export PATH 
[root@station1 Downloads]# vim /root/.bash_profile
# .bash_profile

# Get the aliases and functions
if [ -f ~/.bashrc ]; then
        . ~/.bashrc
fi

# User specific environment and startup programs
JAVA_HOME=/usr/java/jdk1.7.0_07/
export JAVA_HOME
PATH=$JAVA_HOME/bin:$PATH
export PATH
#PATH=$PATH:$HOME/bin
#export PATH
Restart or logout and login
[root@station1 Downloads]# echo $JAVA_HOME
/usr/java/jdk1.7.0_07/


       Step 2: Download and Unpack apache-tomcat-7.0.30 (or latest)
To download apache-tomcat click here
[root@station1 Downloads]# tar -xzvf apache-tomcat-7.0.30.tar.gz
[root@station1 Downloads]# mv apache-tomcat-7.0.30 /usr/share/
[root@station1 Downloads]# vim /etc/init.d/tomcat
    #!/bin/bash
    # description: Tomcat Start Stop Restart
    # processname: tomcat
    # chkconfig: 234 20 80
    JAVA_HOME=/usr/java/jdk1.7.0_07
    export JAVA_HOME
    PATH=$JAVA_HOME/bin:$PATH
    export PATH
    CATALINA_HOME=/usr/share/apache-tomcat-7.0.30

    case $1 in
    start)
    sh $CATALINA_HOME/bin/startup.sh
    ;;
    stop)
    sh $CATALINA_HOME/bin/shutdown.sh
    ;;
    restart)
    sh $CATALINA_HOME/bin/shutdown.sh
    sh $CATALINA_HOME/bin/startup.sh
    ;;
    esac
    exit 0
[root@station1 ~]# chmod 755 /etc/init.d/tomcat
[root@station1 ~]# chkconfig --add tomcat
[root@station1 ~]# chkconfig --level 234 tomcat on
[root@station1 ~]# chkconfig --list tomcat
tomcat             0:off    1:off    2:on    3:on    4:on    5:off    6:off
[root@station1 ~]# service tomcat stop
Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.30/temp
Using JRE_HOME:        /usr/java/jdk1.7.0_07
Using CLASSPATH:       /usr/share/apache-tomcat-7.0.30/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.30/bin/tomcat-juli.jar
[root@station1 ~]# service tomcat start
Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.30/temp
Using JRE_HOME:        /usr/java/jdk1.7.0_07
Using CLASSPATH:       /usr/share/apache-tomcat-7.0.30/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.30/bin/tomcat-juli.jar
[root@station1 ~]# service tomcat restart
Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.30/temp
Using JRE_HOME:        /usr/java/jdk1.7.0_07
Using CLASSPATH:       /usr/share/apache-tomcat-7.0.30/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.30/bin/tomcat-juli.jar
Using CATALINA_BASE:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_HOME:   /usr/share/apache-tomcat-7.0.30
Using CATALINA_TMPDIR: /usr/share/apache-tomcat-7.0.30/temp
Using JRE_HOME:        /usr/java/jdk1.7.0_07
Using CLASSPATH:       /usr/share/apache-tomcat-7.0.30/bin/bootstrap.jar:/usr/share/apache-tomcat-7.0.30/bin/tomcat-juli.jar

For logs

[root@station1 ~]# less /usr/share/apache-tomcat-7.0.30/logs/catalina.out
We can now access the Tomcat Manager page at
[root@station1 ~]# firefox http://station1.ranjihat.com:8080


Sunday 23 September 2012

How to Configure NIS in rhel 6 / centos 6.3


-->
[root@station1 ~]# vim /etc/exports
/nis *(rw,sync)
[root@station1 ~]# chkconfig nfslock on
[root@station1 ~]# chkconfig rpcbind on
[root@station1 ~]# chkconfig nfs on
[root@station1 ~]# service nfslock restart
[root@station1 ~]# service rpcbind restart
[root@station1 ~]# service nfs restart
[root@station1 Desktop]# showmount -e
Export list for station1.ranjihat.com:
/nis *
[root@station1 ~]# vim /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=station1.ranjihat.com
NISDOMAIN=ranjihat.com
[root@station1 ~]# vim /etc/hosts
127.0.0.1 station1 station1.ranjihat.com
10.65.62.35 station2 station2.ranjihat.com
[root@station1 ~]# vim /etc/yp.conf
ypserver 127.0.0.1
[root@station1 ~]# service rpcbind restart
[root@station1 ~]# yum install ypserv
[root@station1 ~]# service ypserv start
Setting NIS domain name ranjihat.com: [ OK ]
Starting YP server services: [ OK ]
[root@station1 ~]# chkconfig ypserv on
[root@station1 ~]# service ypxfrd start
Starting YP map server: [ OK ]
[root@station1 ~]# chkconfig ypxfrd on
[root@station1 ~]# /usr/lib64/yp/ypinit -m

At this point, we have to construct a list of the hosts which will run NIS
servers. station1 is in the list of NIS server hosts. Please continue to add
the names for the other hosts, one per line. When you are done with the
list, type a <control D>.
next host to add: station1
next host to add: station2
next host to add:
The current list of NIS servers looks like this:

station1
station2

Is this correct? [y/n: y] y
We need a few minutes to build the databases...
Building /var/yp/ranjihat.com/ypservers...
Running /var/yp/Makefile...
gmake[1]: Entering directory `/var/yp/ranjihat.com'
Updating passwd.byname...
Updating passwd.byuid...
Updating group.byname...
Updating group.bygid...
Updating hosts.byname...
Updating hosts.byaddr...
Updating rpc.byname...
Updating rpc.bynumber...
Updating services.byname...
Updating services.byservicename...
Updating netid.byname...
Updating protocols.bynumber...
Updating protocols.byname...
Updating mail.aliases...
gmake[1]: Leaving directory `/var/yp/ranjihat.com'

station1 has been set up as a NIS master server.

Now you can run ypinit -s station1 on all slave server.


Friday 21 September 2012

How to install transmission bitTorrent Client in rhel 6.3 / centos 6.3

To download the Package click here

[root@station1 Downloads]# tar -xzvf transmission.tar.gz
[root@station1 Downloads]# cd transmission
[root@station1 transmission]# rpm -ivh *

Thats it see the app in Applications -> Internet -> Transmission BitTorrent Client

Thursday 20 September 2012

How to install mplayer in rhel 6.x / centos 6.3

I have collected the packages required for mplayer and kept it in a zip file
To download the mplayer zip file click here

[root@vellore Downloads]$ unzip mplayer.zip
Archive:  mplayer.zip
   creating: mplayer/
   creating: mplayer/repodata/
  inflating: mplayer/xvidcore-1.2.2-1.el6.rf.x86_64.rpm 
  inflating: mplayer/x264-0.0.0-0.4.20101111.el6.rf.x86_64.rpm 
  inflating: mplayer/schroedinger-1.0.10-1.el6.rf.x86_64.rpm 
  inflating: mplayer/svgalib-1.9.25-8.el6.x86_64.rpm 
  inflating: mplayer/orc-0.4.16-6.el6.x86_64.rpm 
  inflating: mplayer/opencore-amr-0.1.2-1.el6.rf.x86_64.rpm 
  inflating: mplayer/mplayer-common-1.0-0.47.svn20100703.el6.rf.x86_64.rpm 
  inflating: mplayer/mpg123-1.14.4-1.el6.rf.x86_64.rpm 
  inflating: mplayer/lzo-2.03-3.1.el6.x86_64.rpm 
  inflating: mplayer/live555-0-0.27.2012.02.04.el6.rf.x86_64.rpm 
  inflating: mplayer/libvdpau-0.4.1-1.el6.rf.x86_64.rpm 
  inflating: mplayer/librtmp-2.3-1.el6.rf.x86_64.rpm 
  inflating: mplayer/libmad-0.15.1b-4.el6.rf.x86_64.rpm 
  inflating: mplayer/libdca-0.0.5-1.el6.rf.x86_64.rpm 
  inflating: mplayer/libcaca-0.99-0.9.beta16.el6.x86_64.rpm 
  inflating: mplayer/lame-3.99.5-1.el6.rf.x86_64.rpm 
  inflating: mplayer/fribidi-0.10.9-1.el6.rf.x86_64.rpm 
  inflating: mplayer/freeglut-2.6.0-1.el6.x86_64.rpm 
  inflating: mplayer/faac-1.26-1.el6.rf.x86_64.rpm 
  inflating: mplayer/enca-1.13-1.el6.x86_64.rpm 
  inflating: mplayer/dirac-libs-1.0.2-4.el6.x86_64.rpm 
  inflating: mplayer/mplayer-fonts-1.1-3.0.rf.noarch.rpm 
  inflating: mplayer/aalib-1.4.0-5.el6.rf.x86_64.rpm 
  inflating: mplayer/audiofile-0.2.6-11.1.el6.x86_64.rpm 
  inflating: mplayer/esound-libs-0.2.41-3.1.el6.x86_64.rpm 
  inflating: mplayer/arts-1.5.10-10.el6.x86_64.rpm 
  inflating: mplayer/mplayer-1.0-0.47.svn20100703.el6.rf.x86_64.rpm 
  inflating: mplayer/a52dec-0.7.4-8.el6.rf.x86_64.rpm 
  inflating: mplayer/repodata/repomd.xml 
 extracting: mplayer/repodata/other.xml.gz 
 extracting: mplayer/repodata/filelists.xml.gz 
 extracting: mplayer/repodata/primary.xml.gz 
[root@vellore Downloads]$ cd mplayer
[root@vellore mplayer]$ rm -rf repodata
[root@vellore mplayer]$ rpm -ivh *

If some packages missing then download that rpm packages from rpmfind site

http://rpmfind.net/linux/rpm2html/search.php

Check the manual page for keyboard shortcuts "man mplayer"

[root@station1 English_movies]# mplayer TRANSFORMERS\ 3D.mkv


How to install webmin in rhel 6

[root@station1 Desktop]# yum install -y httpd*
[root@station1 Desktop]# vim /etc/httpd/conf/httpd.conf
276 ServerName station1.ranjihat.com:80
285 UseCanonicalName On
[root@station1 Desktop]# chkconfig httpd on
[root@station1 Desktop]# service httpd start
Starting httpd: [ OK ]

To Download Webmin click here

[root@station1 Downloads]# rpm -ivh webmin-1.590-1.noarch.rpm
warning: webmin-1.590-1.noarch.rpm: Header V3 DSA/SHA1 Signature, key ID 11f63c51: NOKEY
Preparing... ########################################### [100%]
Operating system is CentOS Linux
1:webmin ########################################### [100%]
Webmin install complete. You can now login to http://station1.ranjihat.com:10000/
as root with your root password.
[root@station1 Downloads]# service httpd restart


Friday 7 September 2012

how to configure squirrelmail in rhel6

First you should have a well configured dns in the system in which u are going to configure you mail server.

your forward zone should look like this
your reverse zone should look like this
Then install postfix service
[root@station1 ~]# yum install -y postfix
75 myhostname = station1.example.com
83 mydomain = example.com
99 myorigin = $mydomain
113 inet_interfaces = all
116 #inet_interfaces = localhost
164 #mydestination = $myhostname, localhost.$mydomain, localhost
165 mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain
419 home_mailbox = Maildir/
:wq save and quit
[root@station1 ~]# chkconfig postfix on
[root@station1 ~]# service postfix start
Starting postfix: [ OK ]
[root@station1 ~]# yum install dovecot
[root@station1 ~]# yum install fetchmail
[root@station1 ~]# yum install mutt
[root@station1 ~]# vim /etc/dovecot/dovecot.conf
20 protocols = imap pop3 lmtp
32 login_greeting = Dovecot ready.
[root@station1 ~]# vim /etc/dovecot/conf.d/10-mail.conf
24 mail_location = maildir:~/Maildir
[root@station1 ~]# vim /etc/dovecot/conf.d/20-pop3.conf
51 pop3_uidl_format = %08Xu%08Xv
85 pop3_client_workarounds = outlook-no-nuls oe-ns-eoh
[root@station1 ~]# cd /etc/pki/tls/certs/
[root@station1 certs]# make dovecot.pem
Country Name (2 letter code) [XX]:IN
State or Province Name (full name) []:Kerala
Locality Name (eg, city) [Default City]:Calicut
Organization Name (eg, company) [Default Company Ltd]:Hp
Organizational Unit Name (eg, section) []:Edms
Common Name (eg, your name or your server's hostname) []:station1.example.com
Email Address []:root@station1.example.com
[root@station1 certs]# cp dovecot.pem /etc/pki/tls/private/
[root@station1 certs]# cp dovecot.pem /etc/pki/dovecot/certs/
[root@station1 certs]# cp dovecot.pem /etc/pki/dovecot/private/
[root@station1 certs]# vim /etc/pki/dovecot/dovecot-openssl.cnf
[ req_dn ]
# country (2 letter code)
C=IN

# State or Province Name (full name)
ST=Kerala

# Locality Name (eg. city)
L=Calicut

# Organization (eg. company)
O=Hp

# Organizational Unit Name (eg. section)
OU=Edms

# Common Name (*.example.com is also possible)
CN=station1.example.com

# E-mail contact
emailAddress=root@station1.example.com

[ cert_type ]
nsCertType = server
[root@station1 certs]# chkconfig dovecot on
[root@station1 certs]# service dovecot restart
Stopping Dovecot Imap: [ OK ]
Starting Dovecot Imap: [ OK ]
[root@station1 certs]# yum install httpd
[root@station1 certs]# vim /etc/httpd/conf/httpd.conf
262 ServerAdmin root@station1.example.com
276 ServerName station1.example.com:80
[root@station1 certs]# service httpd restart
Stopping httpd: [ OK ]
Starting httpd: [ OK ]

To install squirrelmail download the packages form the link given below

for x86_64 epel package click here and install the rpm package epel

[root@station1 ~]# yum repolist
[root@station1 ~]# yum install squirrelmail

suppose if dependency issue occurs for php-mbstring download from here php-mbstring