Add

Wednesday 27 November 2013

Time to edit /etc/hosts file

Unlocking /etc/hosts file

Looking inside of /etc/hosts  - It’s simply a list of names mapped to IP address of every host on the network in order to provide name resolution( name resolution - .
If you have a small host network, easiest way to provide name resolution is by /etc/hosts, which contains the name and address information for important hosts on the local network. This is will be useful when DNS is not running, hosts file has power to override DNS. 

Whenever new host added trick was keeping all those Hosts files up to date, its triggered invention of (BIND) Berkeley Internet Name Domain Server - (DNS) Domain Naming Service to solve this problem

EXAMPLE :
$ vim /etc/hosts
      
# IP_address         canonical_hostname                 [aliases...]

127.0.0.1               localhost.localdomain               localhost
192.168.1.10         bat.mydomain.org                      bat
192.168.1.13         cat.mydomain.org                      cat
146.82.138.7         master.mydomain.org                master

This enables users to access a host by using the alias as an alternative name, Now, you can test "ping bat" or "ping cat.mydomain.org", any of the hosts inside using names instead of its IP address.

Operating System
Location of Hosts File
Windows 9x/Me
c:\windows\hosts
Windows NT/2000
c:\winnt\system32\drivers\etc\hosts
Windows XP/Vista/2003/2008
c:\windows\system32\drivers\etc\hosts
Unix/Linux
/etc/hosts

Tuesday 26 November 2013

HOSTNAME - Secrete Key of Linux

Setting up HOSTNAME in Linux

In any network HOSTNAME represents a system for various purpose from application end to mail, web and DB server etc, anything messed up in HOSTNAME service will get disrupted. Learning to re(set) the HOSTNAME very essential key step of any initial troubleshooting or fixing issue.

You should fallow naming conventions while choosing a HOSTNAME in any production site – something more meaningful geographical locations, famous gods, Highest mountain ranges. I would say it like MyProdApp1.shiva.com, MyDbStage.krishna.com, …. So would be easier for anyone to remember.

Only Constraints are -
·      It cannot be longer than 64 characters
·      It can only contain letters, numbers, and dashes

Check your current hostname by using cmd.

# hostname
ProdApp1

FQDN – Fully Qualified Domain Name nothing but your hostname + domain (something.org or anything.com) combined together. 
         
# hostname –f
ProdApp1.himalayan.com

( hostname = ProdApp1  and domainname = himalayan.com )

Five basic Step to get your hostname working fine.
         
STEP1:  
Setting the Hostname Using hostname command

# hostaname –v ProdApp2
Setting hostname to ProdApp2
         
         
STEP2:
Modifying the old hostname

# vi /etc/hostname                              (Debian / Ubuntu)
ProdApp2

Debian has an init script, /etc/init.d/hostname.sh which is called at boot time and sets the hostname what is given in /etc/hostname.
or
sudo service hostname start              
To change the hostname, place only the unqualified hostname in /etc/hostname and run sudo /etc/init.d/hostname.sh

# vi /etc/HOSTNAME                        (SUSE)
ProdApp2

Or

Edit line HOSTNAME="”

# vi /etc/sysconfig/network               (CentOS /RedHat/ Fedora)
         
NETWORKING=yes
HOSTNAME="ProdApp2 "
GATEWAY="192.168.10.10"
GATEWAYDEV="eth0"
FORWARD_IPV4="yes"

STEP 3:
Make new entry /etc/hosts for FQDN resolution.

192.168.10.10                 ProdApp2.himalayan.com                ProdApp2

STEP 4:
Now job would be setting it permanent without any reboot (You won’t get a downtime for just resetting HOSTNAME in Production sites)

#service network restart

Or

#/etc/init.d/network restart

STEP 5:
Checking hostname is set to correct name by using
# hostname –f
ProdApp2.himalayan.com


That’s it – you are done! – Not a big task, but its key task for sure, In STEP 1 command will change the HOSTNAME to new value temporarily.
For Permanent fix, change the configuration file as discussed in STEP 2 & 3 and next time it boots it will read the those configuration file for setting hostname.



Wednesday 6 November 2013

ESSENTIALS OF APACHE WEB SERVER


ESSENTIALS OF APACHE WEB SERVER

Apache Web Server Installation Notes


Install command
Install httpd service boot script start at  boot time
Starting  httpd
Fedora / RHEL / Cent OS
# yum install httpd

# chkconfig httpd on

# /etc/init.d/httpd start
Debian Linux
# apt-get install apache2
# update-rc.d apache2 defaults

# /etc/init.d/apache2 start
Open SUSE
# zypper in apache2

# yast2 -i apache2
# chkconfig --add apache2

# /etc/init.d/apache2 start


Document root location and configuration scripts


Document root of the default web site
httpd.conf location
Fedora / RHEL / Cent OS
# /var/www/html
# /etc/httpd/conf/httpd.conf
Debian Linux
# /var/www/
# /etc/apache2/apache2.conf

# /etc/apache2/ports.conf
Open SUSE
# cd /srv/www/htdocs/

# /etc/apache2/httpd.conf


Compiling and Installing

Compiling and Installing
Download
# lynx http://httpd.apache.org/download.cgi
Extract
# gzip -d  httpd-2.4.6.tar.gz
# tar xvf  httpd-2.4.6.tar.gz
# cd  httpd-2.4.6
Configure
# ./configure --prefix= /usr/local/apache2/
Compile
# make
Install
# make install
Customize
# vi /usr/local/apache2/conf/httpd.conf
Test
#  /usr/local/apache2/bin/apachectl -k start




Other essential details of Apache
server log
/etc/httpd/logs                     à( symbolic link)

/var/log/httpd
server modules
/etc/httpd/modules             à( symbolic link)

/usr/lib/httpd/modules
server process ID
/var/run                                 à( symbolic link)
           
/var/run/httpd.pid