Sunday 21 December 2014

Web server configuration with one than one web site (VIRTUAL HOSTING)

Web server configuration with one than one web site (VIRTUAL HOSTING)

(1)    Install the web server packages by yum server.
[root@www /]# yum install httpd*


(2)    Open the httpd.conf file
[root@www /] vim  /etc/httpd/conf/httpd.conf

(3) Make changes like the below in the httpd.conf file


















(4)    Make index.html   & fb.html  file in /var/www/html  directory
[root@www /]# cd  /var/www/html/
[root@www html]# vim  index.html
















[root@www html]# vim  fb.html














(5)     Run syntax check for config files
[root@www html]# httpd –t
Syntax OK


(6)    Restart the httpd service
[root@www html]# /etc/init.d/httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]


(7)   Open Firefox for testing the working of Web Server.


































(8)   Now open the url http://www.facebook.com:80 in firefox.







Sunday 30 November 2014

How to configure DNS Server in Chroot envirment with more than one domains

How to configure DNS Server in Chroot envirment with more than one domains

(1)    Give static IP to your server.

[root@Server data]#  cd /etc/sysconfig/network-scripts/
[root@Server network-scripts]# ls
ifcfg-eth0      ifdown-eth    ifdown-post    ifdown-tunnel  ifup-ippp   ifup-plip    ifup-sit          net.hotplug
ifcfg-eth0.bak  ifdown-ippp   ifdown-ppp     ifup           ifup-ipsec  ifup-plusb   ifup-sl           network-functions
ifcfg-lo        ifdown-ipsec  ifdown-routes  ifup-aliases   ifup-ipv6   ifup-post    ifup-tunnel       network-functions-ipv6
ifdown          ifdown-ipv6   ifdown-sit     ifup-bnep      ifup-ipx    ifup-ppp     ifup-wireless

ifdown-bnep     ifdown-isdn   ifdown-sl      ifup-eth       ifup-isdn   ifup-routes  init.ipv6-global

[root@Server network-scripts]# vim ifcfg-eth0














[root@Server data]# /etc/init.d/network restart
Shutting down interface eth0:                              [  OK  ]
Shutting down loopback interface:                          [  OK  ]
Bringing up loopback interface:                            [  OK  ]
Bringing up interface eth0:                                [  OK  ]



(2)    Install  bind , caching-nameserver packages by yum server.

[root@Server network-scripts]# yum install bind*
[root@Server network-scripts]# yum install caching-nameserver

(3)    Open /etc/named.conf file make the changes as per below file

[root@Server network-scripts]# vim /etc/named.conf






















(4)    Copy localhost.zone file to zone.com & rev_192.168.1

[root@Server data]# cp /var/named/localhost.zone   /var/named/chroot/var/named/data/zone.com
[root@Server data]# cp /var/named/localhost.zone   /var/named/chroot/var/named/data/ rev_192.168.1

[root@Server network-scripts]# cd /var/named/chroot/var/named/data/

[root@Server data]# ls
rev_192.168.1  zone.com

(5)    Make changes in file zone.com and rev_192.168.1 file as per below file .

[root@Server data]# vim  zone.com






















[root@Server data]# vim rev_192.168.1





















(6)    Change permissions of the files

[root@Server data]# chown named.named /var/named/chroot/var/named/data/rev_192.168.1
[root@Server data]#   chown named.named /var/named/chroot/var/named/data/zone.com


(7)    Restart the service named

[root@Server data]# /etc/init.d/named restart
Stopping named:                                            [  OK  ]
Starting named:                                            [  OK  ]



(8)    Make entry of DNS server in resolv.conf file

[root@Server data]# vim /etc/resolv.conf






















(9) Check the the DNS Server Working  

[root@Server data]# nslookup www.google.com

Server:                 192.168.1.2
Address:              192.168.1.2#53

Address: 192.168.1.2


[root@Server data]# nslookup 192.168.1.2
Server:                 192.168.1.2
Address:              192.168.1.2#53

2.1.168.192.in-addr.arpa               name = www.google.com.


[root@Server data]# nslookup www.facebook.com
Server:                 192.168.1.2
Address:              192.168.1.2#53

Address: 192.168.1.2

Saturday 30 August 2014

VM Installation on RHEL 6.3

We Need Virtualization Packages to install VM .

[root@ARUN network-scripts]# yum install  libvirtd*
[root@ARUN network-scripts]# yum install  libvirt-guests *
[root@ARUN network-scripts]# yum install  libvirt-qmf*

Restart the following services

[root@ARUN network-scripts]# /etc/init.d/qemu-ga restart
[root@ARUN network-scripts]# /etc/init.d/libvirt-qmf restart
[root@ARUN network-scripts]# /etc/init.d/libvirtd restart

Run the following command

[root@ARUN network-scripts]# virt-manager 


If the following error comes when you start virt-manager













Then Enable Virtualization Technology from Mother board BIOS 




Network Bonding In RHEL 6

[root@ARUN network-scripts]# cd /etc/sysconfig/network-scripts/

[root@ARUN network-scripts]# ls


 ifcfg-em2   ifdown-bnep  ifdown-post    ifup          ifup-ipv6   ifup-ppp       init.ipv6-global
 ifcfg-em1  ifcfg-lo    ifdown-eth   ifdown-ppp     ifup-aliases  ifup-isdn   ifup-routes    net.hotplug
 ifcfg-p3p1  ifdown-ippp  ifdown-routes  ifup-bnep     ifup-plip   ifup-sit       network-functions
 ifcfg-p3p2  ifdown-ipv6  ifdown-sit     ifup-eth      ifup-plusb  ifup-tunnel    network-functions-ipv6

 ifdown      ifdown-isdn  ifdown-tunnel  ifup-ippp     ifup-post   ifup-wireless

There are 4 interface or NIC card in this server . But In RHEL 5 * these interface are shown as
ifcfg-eth0 
ifcfg-eth1 
ifcfg-eth2 
ifcfg-eth3

The 2 NIC are speed of 1 GBPS and 2 NIC of 10GBPS. How to check.


[root@ARUN network-scripts]# ethtool  em1
Settings for em1:
                Supported ports: [ TP FIBRE ]
                Supported link modes:   10baseT/Half 10baseT/Full
                                        100baseT/Half 100baseT/Full
                                        1000baseT/Full
                Supports auto-negotiation: Yes
                Advertised link modes:  1000baseT/Full
                                        2500baseX/Full
                Advertised pause frame use: No
                Advertised auto-negotiation: Yes
                Speed: 1000Mb/s
                Duplex: Full
                Port: FIBRE
                PHYAD: 2
                Transceiver: internal
                Auto-negotiation: on
                Supports Wake-on: g
                Wake-on: d
                Link detected: yes


              

[root@ARUN network-scripts]# ethtool  em2
Settings for em2:
                Supported ports: [ TP FIBRE ]
                Supported link modes:   10baseT/Half 10baseT/Full
                                        100baseT/Half 100baseT/Full
                                        1000baseT/Full
                Supports auto-negotiation: Yes
                Advertised link modes:  1000baseT/Full
                                        2500baseX/Full
                Advertised pause frame use: No
                Advertised auto-negotiation: Yes
                Speed: 1000Mb/s
                Duplex: Full
                Port: FIBRE
                PHYAD: 2
                Transceiver: internal
                Auto-negotiation: on
                Supports Wake-on: g
                Wake-on: d
                Link detected: yes




[root@ARUN network-scripts]# ethtool  p3p1
Settings for p3p1:
                Supported ports: [ FIBRE ]
                Supported link modes:   10baseT/Half 10baseT/Full
                                        100baseT/Half 100baseT/Full
                                        1000baseT/Full
                                        2500baseX/Full
                                        10000baseT/Full
                Supports auto-negotiation: Yes
                Advertised link modes:  10baseT/Half 10baseT/Full
                                        100baseT/Half 100baseT/Full
                                        1000baseT/Full
                                        2500baseX/Full
                                        10000baseT/Full
                Advertised pause frame use: Symmetric Receive-only
                Advertised auto-negotiation: Yes
                Speed: 10000Mb/s
                Duplex: Full
                Port: FIBRE
                PHYAD: 1
                Transceiver: internal
                Auto-negotiation: on
                Supports Wake-on: d
                Wake-on: d
                Current message level: 0x00000000 (0)
                Link detected: yes




[root@ARUN network-scripts]# ethtool  p3p2
Settings for p3p2:
                Supported ports: [ FIBRE ]
                Supported link modes:   10baseT/Half 10baseT/Full
                                        100baseT/Half 100baseT/Full
                                        1000baseT/Full
                                        2500baseX/Full
                                        10000baseT/Full
                Supports auto-negotiation: Yes
                Advertised link modes:  10baseT/Half 10baseT/Full
                                        100baseT/Half 100baseT/Full
                                        1000baseT/Full
                                        2500baseX/Full
                                        10000baseT/Full
                Advertised pause frame use: Symmetric Receive-only
                Advertised auto-negotiation: Yes
                Speed: 10000Mb/s
                Duplex: Full
                Port: FIBRE
                PHYAD: 1
                Transceiver: internal
                Auto-negotiation: on
                Supports Wake-on: d
                Wake-on: d
                Current message level: 0x00000000 (0)
                Link detected: yes



[root@ARUN network-scripts]#  vi  ifcfg-em1
DEVICE="em1"
BOOTPROTO="none"
HWADDR="8B:8F:69:56:99:55"
#NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
#UUID="6d04da01-9197-4c6d-bd93-bc2fb85a96f2"
MASTER="bond1"
SLAVE="yes"




[root@ARUN network-scripts]#  vi  ifcfg-em2
DEVICE="em2"
BOOTPROTO="none"
HWADDR="8D:8F:69:55:A9:56"
#NM_CONTROLLED="no"
ONBOOT="yes"
TYPE="Ethernet"
#UUID="6b04da01-9197-456d-bd93-bb2fb95a96f6"
MASTER="bond1"
SLAVE="yes"



[root@ARUN network-scripts]#  vi  ifcfg-p3p1
DEVICE="p3p1"
BOOTPROTO="none"
HWADDR="80:8B:69:57:99:5A"
#NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="fda1e6e9-b3f4-4b9d-8084-b46fac099b5b"
MASTER="bond0"
SLAVE="yes"


[root@ARUN network-scripts]#  vi ifcfg-p3p2
DEVICE="p3p2"
BOOTPROTO="none"
HWADDR="80:8B:69:57:99:5B"
#NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE="Ethernet"
UUID="bda1e5e1-b3f4-4b4d-8084-v46fac099b5c"
MASTER="bond0"
SLAVE="yes"


[root@ARUN network-scripts]#  vi ifcfg-bond0
DEVICE="bond0"
BOOTPROTO="none"
ONBOOT="yes"
IPADDR="192.164.224.61"
NETMASK="255.255.255.0"
GATEWAY="192.164.224.1"

[root@ARUN network-scripts]#  vi ifcfg-bond1
DEVICE="bond1"
BOOTPROTO="none"
ONBOOT="yes"
IPADDR="192.168.248.161"
NETMASK="255.255.255.0"
GATEWAY="192.168.248.1"



[root@ARUN network-scripts]#   cat /etc/modprobe.d/dist.conf 

alias bond0 bonding
alias bond1 bonding

options mode=1 miimon=100



[root@ARUN network-scripts]#  /etc/init.d/network restart













Sunday 4 May 2014

MAIL SERVER CONFIGURATION USING SQUIRREL MAIL WEB MAIL SERVER

(1) SET HOST NAME  
[root@www ~]# hostname www.arunmail.com
[root@www ~]# vi /etc/sysconfig/network

































[root@www ~]# vi /etc/hosts




(2) Configure DNS Server

For DNS  There are 3 Utility. Before configure DNS we  have to install following packages using yum.


[root@www ~]# yum install bind
[root@www ~]# yum install bind-utils
[root@www ~]# yum install caching-nameserver

[root@www ~]# vi /etc/named.conf




[root@www ~]# cd /var/named/
[root@www named]# ll
total 40
drwxr-x--- 5 root  named 4096 May  4 04:47 chroot
drwxrwx--- 2 named named 4096 Dec  2  2011 data
-rw-r----- 1 root  named  198 Dec  2  2011 localdomain.zone
-rw-r----- 1 root  named  195 Dec  2  2011 localhost.zone
-rw-r----- 1 root  named  427 Dec  2  2011 named.broadcast
-rw-r----- 1 root  named 1892 Dec  2  2011 named.ca
-rw-r----- 1 root  named  424 Dec  2  2011 named.ip6.local
-rw-r----- 1 root  named  426 Dec  2  2011 named.local
-rw-r----- 1 root  named  427 Dec  2  2011 named.zero
drwxrwx--- 2 named named 4096 Dec  2  2011 slaves

[root@www named]# cp localhost.zone for
[root@www named]# cp localhost.zone rev



## Edit for file like this 


[root@www named]# vim for




## Edit Rev file Like This

[root@www named]# vim rev





[root@www named]# service named restart
Stopping named:                                            [  OK  ]
Starting named:                                            [  OK  ]

[root@www named]# chkconfig named  --list
named           0:off   1:off   2:off   3:off   4:off   5:off   6:off
[root@www named]# chkconfig named on

[root@www named]# nslookup www.arunmail.com
Server:         192.168.88.140
Address:        192.168.88.140#53

Name:   www.arunmail.com
Address: 192.168.88.140

[root@www named]# nslookup 192.168.88.140
Server:         192.168.88.140
Address:        192.168.88.140#53

140.88.168.192.in-addr.arpa     name = www.arunmail.com.

(3) Configure Postfix MTA (MAIL TRANSPORT AGENT)

[root@www ~]# yum install postfix*


Make change in configuration file as bellow

[root@www ~]# vi /etc/postfix/main.cf

(1) myhostname = www.arunmail.com.
#myhostname = virtual.domain.tld

(2)mydomain = arunmail.com

(3)#myorigin = $myhostname
myorigin = $mydomain

(4)inet_interfaces = all
#inet_interfaces = $myhostname
#inet_interfaces = $myhostname, localhost
#inet_interfaces = localhost


(5)mydestination = $myhostname, localhost.$mydomain, localhost, $mydomain




[root@www named]# alternatives --config mta

There are 2 programs which provide 'mta'.

  Selection    Command
-----------------------------------------------
*  1           /usr/sbin/sendmail.sendmail
 + 2           /usr/sbin/sendmail.postfix

Enter to keep the current selection[+], or type selection number: 2


[root@www named]# chkconfig sendmail off

[root@www named]# service postfix restart
Shutting down postfix:                                     [FAILED]
Starting postfix:                                          [  OK  ]

[root@www named]# chkconfig postfix on


(4) Now Configure Dovecot MRA( Mail Retrieving Agent ) 



[root@www named]# yum install dovecot*



## Make change in the configuration file like bellow

[root@www named]# vi /etc/dovecot.conf

protocols = imap imaps pop3 pop3s



[root@www named]# service dovecot restart
Stopping Dovecot Imap:                                     [FAILED]
Starting Dovecot Imap:                                     [  OK  ]
[root@www named]# service dovecot restart
Stopping Dovecot Imap:                                     [  OK  ]
Starting Dovecot Imap:                                     [  OK  ]

[root@www named]# chkconfig dovecot on







(5) Now configure Squirrel mail web mail server


[root@www named]# yum install  squirrelmail*

[root@www ~]# cd /usr/share/squirrelmail/config/
[root@www config]# ll
total 188
-rwxrwxrwx 1 root root  29548 Oct  5  2009 config_default.php
lrwxrwxrwx 1 root root     45 May  4 06:13 config_local.php -> ../../../../etc/squirrelmail/config_local.php
lrwxrwxrwx 1 root root     39 May  4 06:13 config.php -> ../../../../etc/squirrelmail/config.php
-rwxrwxrwx 1 root root 148706 Oct  5  2009 conf.pl
-rwxrwxrwx 1 root root    492 Oct  5  2009 index.php

root@www config]# ./conf.pl











(6) Now Configure Apache web Server 


[root@www named]# yum install  httpd*


## Make change in the configuration file like bellow


[root@www named]# vi /etc/httpd/conf/httpd.conf

(1) ServerName www.arunmail.com:80


(2) NameVirtualHost 192.168.88.140:80

(
3)
  <VirtualHost 192.168.88.140:80>
#    ServerAdmin webmaster@dummy-host.example.com
    DocumentRoot /usr/share/squirrelmail
    ServerName www.arunmail.com
#    ErrorLog logs/dummy-host.example.com-error_log
#    CustomLog logs/dummy-host.example.com-access_log common
</VirtualHost>

[root@www named]# vi /etc/httpd/conf/httpd.conf
[root@www named]# service httpd restart
Stopping httpd:                                            [FAILED]
Starting httpd:                                            [  OK  ]
[root@www named]# service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]


[root@www named]# chkconfig httpd on




(7) Now add 2 user for testing.



(1) root@www ~]# useradd arun
[root@www ~]# passwd arun
Changing password for user arun.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.


(2) [root@www ~]# useradd gaurav
[root@www ~]# passwd gaurav
Changing password for user gaurav.
New UNIX password:
BAD PASSWORD: it is WAY too short
Retype new UNIX password:
passwd: all authentication tokens updated successfully.



(8) Open Firefox and open the url www.arunmail.com






















Saturday 4 January 2014

Find Command in Linux with Examples

FIND:- Find  - searches for files in a directory hierarchy

FIND command  uses and example

(1) Find all files whose name is abc in pwd (Present Working Directory)
[root@CLIENT ~ ] #  find . -name abc
./abc

(2) Find all file in /home directory  whose name is abc
[root@CLIENT ~ ] # find  /home  -name  abc

(3) Find all file whose name is abc ignoring case senstivity
[root@CLIENT ~ ] # find /home  -iname abc

(4) Find a directory in  /home directory  whose name is arun
[root@CLIENT ~ ] # find /home -type d -name arun
/home/arun

(5) Find all html files in Linux file system
[root@CLIENT ~ ] # find  / -type f -name "*.html"

(6) Find files base on their permissions
[root@CLIENT ~ ] # find  / -type f   -perm 700

(7) Find all files with their permission 700 and change permission with  600
[root@CLIENT ~ ] # find  / -type  f  -perm 700 -exec chmod 600 {} \;

(8) Find all files  base on user arun
[root@CLIENT ~ ] # find  /  -user arun

(9) Find all files  base on group Linux
[root@CLIENT ~ ] # find  /  -group Linux

(10) Find a particular file named abc.txt of user arun
[root@CLIENT ~ ] # find  /  -type f -user arun -name abc.txt

(11) Find files and directory on base of date and time

-atime    access time              |          +90          more than 90 days back
-mtime   modified time           |           90           exact 90 days back
-ctime    change time             |           -90          less than 90 days back

[root@CLIENT ~ ] #  find  / -ctime +90

(12) Find  files whose size is less than 10 MB
[root@CLIENT ~ ] #  find  /  -size  -10M

(13) Find  files whose size is less than 100 MB and more than 50 MB
[root@CLIENT ~ ] #  find  /  -size  -100M  -size  +50M











Thursday 2 January 2014

Boot Process of Linux

There are 6 process occurs during booting process of kernel

(1) BIOS
(2) MBR
(3) GRUB
(4) KERNEL
(5) INIT
(6) RUN LEVEL PROGRAMS


BIOS:- BIOS stands for Basic Input Output System
Bios search , loads & execute boot loader program.Once the boot loader program is detected & loaded into memory.Bios gives control to it.


MBR:- MBR stands for master boot record
 The first sector  of bootable device is MBR
Its size is 512 bytes


 446 Bytes
 (Primary Bootloader Info)
64 Bytes
 (Partition table info) 
2Bytes (validation check)




GRUB:- GRUB stands Grand Unified Bootloader 
It loads and execute the defaults kernel image as specified in grub configuration file /boot/grub/grub.conf


KERNEL:- Mount the root file system . Kernel execute the /sbin/init .INIT is the first prog executed in Linux kernel .Kernel contains device driver compiled inside which help to access the hardware.

INIT:- INIT decide the run levels. These run levels are mention in /etc/inittab file
There are 7 run levels in linux

0  -->  Halt
1  -->  Single user mode
2  -->  Multiuser mode without NFS
3  -->  Full multiuser mode
4  -->  Unused
5  -->  Graphical
6  -->  Reboot

RUN LEVEL PROGRAMS:- When the Linux system booting up various services getting started.
for example   httpd ---- OK
                     named----OK
                     vsftpd -----OK
Depending on your default init level setting , the system will execute the programs from one of the following directory.


Run level 0 – /etc/rc.d/rc0.d/
Run level 1 – /etc/rc.d/rc1.d/
Run level 2 – /etc/rc.d/rc2.d/
Run level 3 – /etc/rc.d/rc3.d/
Run level 4 – /etc/rc.d/rc4.d/
Run level 5 – /etc/rc.d/rc5.d/
Run level 6 – /etc/rc.d/rc6.d/