Monday 8 September 2014

To install Local yum server or yum client on Centos 6 & Centos 7 ( Also Redhat 6 )



To install Local yum server or yum client  on Centos 6 & Centos 7 ( Also in Redhat 6 ) 


We are using 2 system , 1 for server & 2 for client system.

Yum Server OS               : Centos 6.4 & 7           
Yum Server IP Address   : 192.168.1.2
Client OS                       : Centos 6.4 & 7
Client IP Address           :  192.168.1.3

SERVER SIDE :- 192.168.1.2

Insert Your Centos DVD in server CD/DVD rom .

# mount /dev/cdrom /mnt/
# cd /mnt/
# cd Packages/
# rpm -ivh vsftpd-2.2.2-11.el6_3.1.i686.rpm

  warning: vsftpd-2.2.2-11.el6_3.1.i686.rpm: Header V3 RSA/SHA1 Signature, key ID
  c105b9de: NOKEY
  Preparing...               ########################################### [100%]
  1:vsftpd                    ########################################### [100%]

# service vsftpd restart
# chkconfig vsftpd on
# rpm -ivh libxml2-python-2.7.6-8.el6_3.4.i686.rpm
# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.i686.rpm
# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm
# rpm -ivh createrepo-0.9.9-17.el6.noarch.rpm
# mkdir /var/ftp/pub/Packages
# cp -ar /mnt/Packages/*.* /var/ftp/pub/Packages

{note :- remove or rename to all older repositories } 

# vi /etc/yum.repos.d/yum.repo
     
      [YumServer]
      name=Packages
      baseurl=file:///var/ftp/pub/Packages               (note:- We are using '///' in server )
      gpgcheck=0

      enabled=1

      :wq

# setsebool -P ftp_home_dir on
# vi /etc/sysconfig/iptables
      [...]
      -A INPUT -p udp -m state --state NEW --dport 21 -j ACCEPT
      -A INPUT -p tcp -m state --state NEW --dport 21 -j ACCEPT
      [...]

      :wq

# createrepo -v /var/ftp/pub/Packages



# yum clean all
# yum update

CLIENT SIDE :- 192.168.1.3

# vi /etc/yum.repos.d/yum.repo
      [YumServer]
      name=Packages
      baseurl=ftp://192.168.1.2/pub/Packages               (note:- We are using '//' in client )
      gpgcheck=0

      enabled=1

      :wq

# yum update



enjoy your yum server ......


Friday 5 September 2014

Backup through script on Centos, Redhat, Fedora ( Any flavor of Linux )


Backup through script on Centos, Redhat, Fedora ( Any flavor of Linux  )

Through this script , we can take backup of file , folder , any drive etc 

Create a folder to take backup . For Example :-

$mkdir ~/backup/
$cd  /usr/local/bin/
$vi backup.sh
***********************************************************************************
***********************************************************************************
         #!/bin/bash
         # A script for backing up any file & folder
         # First argument : The directory to be backed up
         # Second argument : The location to back-up to.
                        ORIG=$1
                        BACK=~/backups/

          if [ -e $BACK ]
          then
                        echo "WARNING:$BACK exists"
                        read -p "Press Ctrl+c to exit or Enter to Proceed:"
          fi
          cp -av $ORIG $BACK
          echo "Backup of $ORIG to $BACK completed at:$(date)"


       :wq
************************************************************************************
************************************************************************************
$ chmod 755 backup.sh
$ backup  (Path of file & folder Only )
$ cd  ~/backup/
$ ls -l                                             


*********************************************************************************
**************************************Enjoy *************************************
*********************************************************************************

Wednesday 3 September 2014

To Capture your own Desktop video & audio for Blog or youtube on Ubuntu 13.04.






To Capture your own Desktop video & audio for Blog or youtube on Ubuntu 13.04. 


In ubuntu 13.04 open "Ubuntu Software center " & search "RecordMyDesktop" . Install this software on ubuntu 13.04 .You can record audio & video both for Blog & YouTube. See all screen shot step by step .









Video to Capture or Play Same background Music


                                                     


In Last Screenshot you check your saved video location or path .Also click given link to see video. how to record .

https://www.youtube.com/watch?v=9jMQK4_qjEQ&feature=youtu.be






Enjoy .....


Tuesday 2 September 2014

Samba server installation step by step on CentOS 6.x or redhat 6.x


Samba server installation step by step on CentOS 6.x  or redhat 6.x.

Samba is a client/server system that implements network resource sharing for Linux & Windows computers. Through Samba server Printer can be shared linux & windows machine.



To install the samba package,enter the following command:

# yum install samba samba-client samba-common

Check the version of installed samba software by using this command:


# smbd --version
  Version 3.6.9-167.el6_5

Configure the samba service, so that, it will start automatically at boot time:


# chkconfig smb on
# chkconfig nmb on

Add these Iptables rules, so that samba will work perfectly:


# iptables -I INPUT 4 -m state --state NEW -m udp -p udp --dport 137 -j ACCEPT
# iptables -I INPUT 5 -m state --state NEW -m udp -p udp --dport 138 -j ACCEPT
# iptables -I INPUT 6 -m state --state NEW -m tcp -p tcp --dport 139 -j ACCEPT
# service iptables save


Backup the smb.conf file, then delete it and create the new one:


# cp /etc/samba/smb.conf /etc/samba/smb.conf.bak
# rm /etc/samba/smb.conf
# touch /etc/samba/smb.conf
# vi /etc/samba/smb.conf

Add these lines,in your smb.conf file (or change it according to your requirement):

#======================= Global Settings =====================================

[global]

workgroup = WORKGROUP

security = share

map to guest = bad user

#============================ Share Definitions ==============================

[MyShare]

path = /home/samba/share

browsable =yes

writable = yes

guest ok = yes

read only = no

:wq

# service smb restart
# service nmb restart

Change permission for samba share:


# chmod -R 0777 /home/samba/share


Access the samba share from windows(where 192.168.1.15 address of my samba server):






Add and manage Samba users and groups

Add a group in your CentOS server:

# useradd smbuser
# groupadd smbgrp
# usermod -a -G smbgrp smbuser
# smbpasswd -a smbuser

Create a new share, set the permission on the share:

# cd /home/samba/
# mkdir secure
# chown -R arbab:smbgrp secure/
# chmod -R 0770 secure/
# vi /etc/samba/smb.conf

*******Add the newly created samba share in smb.conf file:**********

[Secure]

path = /home/samba/secure

valid users = @smbgrp

guest ok = no

writable = yes

browsable = yes

:wq

# service smb restart
# service nmb restart

Check the syntax error with testparm:


# testparm
Testing from Windows Machine:




Crontab Examples on Linux { Centos ,Redhat, Fedora, ....etc }


Crontab Examples on Linux { Centos ,Redhat, Fedora, ....etc }

Using cron you can execute a shell-script or Linux commands at a
specific time and date. For example a sysadmin can schedule a backup
job that can run every day.

How to add a job to the cron?

# crontab –e

0 5 * * * /root/bin/backup.sh

This will execute /root/bin/backup.sh at 5 a.m every day.

Description of Cron fields

Following is the format of the crontab file.

{minute} {hour} {day-of-month} {month} {day-of-week}
{full-path-to-shell-script}

• minute:              Allowed range   0 – 59
• hour:                 Allowed range   0 – 23

• day-of-month:    Allowed range   0 – 31
• month:              Allowed range   1 – 12.    1 = January. 12 = December.
• Day-of-week:    Allowed range     0 – 7.    Sunday is either 0 or 7.

Crontab examples

1. Run at 12:01 a.m. 1 minute after midnight everyday. This is a good
time to run backup when the system is not under load.

      1 0 * * * /root/bin/backup.sh

2. Run backup every weekday (Mon – Fri) at 11:59 p.m.

      59 11 * * 1,2,3,4,5 /root/bin/backup.sh

Following will also do the same.

     59 11 * * 1-5 /root/bin/backup.sh

3. Execute the command every 5 minutes.

     */5 * * * * /root/bin/check-status.sh

4. Execute at 1:10 p.m on 1st of every month

     10 13 1 * * /root/bin/full-backup.sh

5. Execute 11 p.m on weekdays.

     0 23 * * 1-5 /root/bin/incremental-backup.sh


Crontab Options
The following are the available options with crontab:

• crontab –e : Edit the crontab file. This will create a crontab, if it
  doesn’t exist
• crontab –l : Display the crontab file.
• crontab -r : Remove the crontab file.
• crontab -ir : This will prompt user before deleting a crontab.