Linux Unix help !!

"Give respect to Time, One day at right Time, Time will respect You"

Thursday, October 28, 2010

my scripts

==========> Backup Script
#!/bin/bash
# Shirish Shukla backup script
# source-> /usr/rnd/*
# target-> /shirishva/backup/abcd-...
#
#------------ Backup string create: abcd-Wed-Oct-27-22:31 format

create=$(echo abcd-`date +%a-%b-%d-%H:%M`)

tar -jcf /shirishva/backup/$create.bz2 /usr/rnd/*

#------------------- delete 3 Hour old backup data del->string

t1=$(date --date='3 hour ago')

t2=$(echo $t1 | sed -e "s/[:]/ /g")

array=( `echo $t2` )

del=$(echo abcd-${array[0]}-${array[1]}-${array[2]}-${array[3]}:${array[4]})

rm -fr /shirishva/backup/$del.bz2

#---------------------------------

Tuesday, October 26, 2010

Software Raid

xxxxxxxxxxxxxxxxxx Raid using mdadm --By Shirish Shukla xxxxxxxxxxxxxxxxxxxx

### Configure raid0 of 700mb and mount it on /common2
        # fdisk  -l   <<---  verify raid partition
        # fdisk /dev/sda
            create 2 raid partition (type  fd) of 350mb each  say /dev/sda11 & /dev/sda12
        # partprobe  -s
        # fdisk  -l   <<---- confirm
        # mdadm     << just check is command appearing using tab.. if no install it from yum server
        # yum   –y   install mdadm*
        # mdadm  --create  /dev/md0  --level=0  --raid-devices=2  /dev/sda11  /dev/sda12
        # mkfs.ext3   /dev/md0    ß-format  md0
        # echo “DEVICE   /dev/sda11  /dev/sda12 “  > /etc/mdadm.conf
        # mdadm   --examine   --scan  --config=/etc/mdadm.conf   > > /etc/mdadm.conf
                    OR
        # mdadm –detail –scan >> /etc/mdadm.conf
        # cat /proc/mdstat     ß verify
        # vi /etc/fstab
            /dev/md0       /common2    ext3    defaults    0   0
        # mount –a
        # mount    or   # df   -h     ß----varify  /common to be have near about 700mb mounted.
         If above question will asked for RAID1, just change a single command:
        # mdadm  --create  /dev/md0  --level=1  --raid-devices=2  /dev/sda11  /dev/sda12
        all other same as above
RAID-1:
      # fdisk /dev/sdb
            ##create 2 raid partition (type  fd) of 350mb each  say /dev/sdb8 & /dev/sdb9
      # partprobe  -s
      # fdisk  -l   <<---- confirm
      ## Create Raid -1
      # mdadm  --create  /dev/md1  --level=1  --raid-devices=2  /dev/sdb8  /dev/sdb9
      # mkfs.ext3   /dev/md1    ß-format  md1
      # mdadm   --examine   --scan  --config=/etc/mdadm.conf   > > /etc/mdadm.conf
                    OR
     # mdadm –detail –scan >> /etc/mdadm.conf
     # cat /proc/mdstat     <<- verify
     ##Mount it on /EXTRA/RAID-1
    # mount /dev/md1  /EXTRA/RAID-1
   ###Recovery -- Suppose my raid partition 8 has been crashed Or have created it for 2 diff disks and my 1  st disk has crashed
  ## So how to recover data as have craeted mirror RAID, In our case /dev/sd9 conyain mirror data
  REcovery on Raid 1:
  # umount    /dec/mb1
  # mdadm --stop  /dev/md1
  # mount  -t  ext3   /dev/sdb9   /EXTRA/TEST   <-- Have a fun :)
 # Remount the RAID
 # mdadm --assemble /dev/md1
 # mount /dev/md1 /EXTRA/RAID-1

#Simulation
# cat /proc/mdstat
Personalities : [raid0] [raid1]
md1 : active raid1 sdb8[0] sdb9[1]
      200704 blocks [2/2] [UU]

md0 : active raid0 sdb7[1] sdb6[0]
      305024 blocks 64k chunks

unused devices: <none>

## mdadm --detail /dev/md1
/dev/md1:
        Version : 00.90.03
  Creation Time : Wed Apr 13 09:58:15 2011
     Raid Level : raid1
     Array Size : 200704 (196.03 MiB 205.52 MB)
  Used Dev Size : 200704 (196.03 MiB 205.52 MB)
   Raid Devices : 2
  Total Devices : 2
Preferred Minor : 1
    Persistence : Superblock is persistent

    Update Time : Wed Apr 13 10:18:37 2011
          State : clean
 Active Devices : 2
Working Devices : 2
 Failed Devices : 0
  Spare Devices : 0

           UUID : 44493b73:98b654f0:a313390c:1000baf6
         Events : 0.2

    Number   Major   Minor   RaidDevice State
       0       8       24        0      active sync   /dev/sdb8
       1       8       25        1      active sync   /dev/sdb9

##add the new replacement partition to the RAID. It will be resynchronized to the original partition
# mdadm --add /dev/md0 /dev/sda15
# mdadm --detail /dev/md0



# Faced any problem Feedback in above contact me
#===============================Scratch===============================#
# AND Many More .....................Linux is Endless                                                                          #
#========================== Hope you Liked IT ===========================#
#                                                                                                   RAID  -- BY Shirish Shukla #
#                                                                                                               RHC Engineer 2010 #
#                                                                                                          shirish.linux@gmail.com #
#                                                                                                          shirishlinux.blogspot.com #
#                            "Give Respect To Time One Day At Right Time, Time Will Respect You" #
#=====================================================================#
# TRy Hard theres nothing that are un-achievable by HARDdd-WORKkk                                   #
#=====================================================================#
Implement s/w raid linux, mdadm, raid0, raid 1, raid1, raid0, linux raid, how to configure raid on linux, linux raid configuration ....

Tuesday, October 12, 2010

Yum Server

XX Yum Server Client Configuration By - Shirish Shukla XX


1> yum server Setup :
==================

>> Install Linux with > 6+ gb of /var partition

# lokkit and do the following
Security level : Disabled
SElinux : Disabled
Reboot the system (To Avoide any obstacle)
# mount /dev/dvd /mnt    (mount your Linux dvd )
# cd /mnt
# You will see dir called “Server”
# Go to “Server” dir
# You will see all RPMs (3842)
# rpm -ivh vsftpd* (Do this in “Server” Dir)
# cp -r /mnt/* /var/ftp/pub/ (Do this outside the “Server” Dir)
# rpm -ivh createrepo* (Do this in “Server” Dir)
# createrepo -v /var/ftp/pub/Server (Will show lots of files)
# service vsftpd restart
# chkconfig vsftpd on
# iptables -F
# service iptables save


2> Server yum-client :
===================


On Server side it’s optional, but in future it’ s good for you to install any package on server

# cd /etc/yum.repos.d/
# cp rhel-debuginfo.repo vadapav1.repo
# Now open vadapav1.repo and you will see this :

[rhel-debuginfo]
name=Red Hat Enterprise Linux $releasever - $basearch – Debug baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

Change the above to the following or make a copy of above and do below changes
[vadapav1]
name=Red hat Enterprise Linux $releasever - $basearch - Debug
baseurl=ftp://192.168.0.2>>>/pub/Server
enabled=1 ----> by default it is 0 --set to 1
gpgcheck=0 ----> by default it is 1 --set to 0
[Delete or comment last line gpgkey=file…… ]

# yum update list
# yum info gftp*

(If above two commands don't work, it means you have done something wrong in above two setups.)




3> Yum Client :
=============


Finally, configure yum server for the CLIENT.

>>>a. Go to this dir:

# cd /etc/yum.repos.d/

>>>b. Make a copy of this only file in this dir:

# cp rhel-debuginfo.repo station11.repo (any filename with .repo extention)

>>>c. Open that file:

# vi station11.repo

>>>d. Do the following changes so finally station11.repo file looks like this:

[rhel-debuginfo] change to [station11]
name=Red hat Enterprise Linux $releasever - $basearch - Debug---> Given DNT
Change this line to the following:
baseurl=ftp://192.168.0.2>>>/pub/Server
enabled=0----> change to 1
gpgcheck=1---> change to 0
[Delete or comment gpgkey(i.e, delete the last line)]

>>>e. To Check whether the yum server for the Client is OK, Do the follow command:

# yum update list
# yum info gftp*




4> Yum important Commands :
===========================


>> install packages:

# yum -y install dhcpd*

>> Remove packages:

# yum remove dhcpd*

>> Package info:

# yum info dhcpd*

>> To know whether package installed or not:

# yum list dhcpd*

>> To clean yum server catch:

# yum clean all

>> Patch up system by applying all updates
# yum update
>> To update yum server list
# yum update list

>>Check for and update specified packages
# yum update  package-name

>>Search for packages by name
# yum list  package-name*

>>Display the list of available packages
# yum list all

>>Check for and update specified packages
# yum update  package-name

>>Search for packages by name
# yum list  package-name*

>>Search for packages by name
# yum list  package-name*

>>Lists all the packages available to be installed
# yum list installed

>>yum check-update yum list updates but returns an exit code of 100 if there are updates available
# yum check-update

>>Display what package provides the file
# yum whatprovides Filename

-->You can use same command to list packages that satisfy dependencies:
# yum whatprovides  dep-1  dep-1

.... See man yum for more info
# man yum



x x x x xx x x x xx x x x xx x x x xx x x x xx x x x xx x x x xx x x x xx x x
hOW YUM SERVER WORK LINUX, LINUX, YUM sERVER, SERVER YUM, YUM CONFIGURATION, MAN YUM, YUM COMMANDS,CONFIGURE LOCAL YUM SERVER, CONFIGURE LIVE YUM SERVER, HOW TO CONFIGURE YUM SERVER, MY YUM SERVER, YUM SERVER CONFIG LINUX, LOVE YUM SERVER, YUM, YUM YUM YUM ,LINUX+YUM

Followers

Pls LIKE my Story !!!