Wednesday 25 January 2012

Introduction of "Rsync"


"Rsync" utility is used to synchronize the files and directories from one location to another in an effective way. Backup location could be on local server or on remote server.

Important features of rsync

  • Speed: First time, rsync replicates the whole content between the source and destination directories. Next time, rsync transfers only the changed blocks or bytes to the destination location, which makes the transfer really fast.
  • Security: rsync allows encryption of data using ssh protocol during transfer
  • Less Bandwidth: rsync uses compression and decompression of data block by block at the sending and receiving end respectively. So the bandwidth used by rsync will be always less compared to other file transfer protocols.
  • Privileges: No special privileges are required to install and execute rsync

Syntax

            [root@server ~]#   rsync   options   source   destination

Source and destination could be either local or remote. In case of remote, specify the login name, remote server name and location.


If you want Rsync man page Click here

Sunday 15 January 2012

SSH installation on Centos

We need to install two package
                 1. Openssh-server
                 2. Openssh-clients

First check Openssh-server and Openssh-clients packages installed or not

  [root@sysadmin sysadmin]#  rpm  -qa   openssh*
output would like this

openssh-clients-5.3p1-70.el6_2.2.x86_64
openssh-askpass-5.3p1-70.el6_2.2.x86_64
openssh-server-5.3p1-70.el6_2.2.x86_64
openssh-5.3p1-70.el6_2.2.x86_64

You did not get above output .You need to install the Openssh packages ( which are installed by default untill and unless you removed it or skipped it while installing Centos)


           [root@sysadmin sysadmin]#  yum   install  openssh-server   openssh-clients

Then start the SSH service

          [root@sysadmin sysadmin]#   /etc/init.d/sshd   start

After that check SSH service running or not

          [root@sysadmin sysadmin]#   /etc/init.d/sshd   status

If you want to restart the service , using restart command

          [root@sysadmin sysadmin]#   /etc/init.d/sshd   restart

SSH starts automatically whenever the system boot so we will run this command

           [root@sysadmin sysadmin]#   chkconfig   sshd   on

Friday 6 January 2012

How to Setup Static or Dynamic IP Address in Centos

After centos operting system installation, i can't able to communicate another machine. At that time i checked and found my machine network interface (eth0) down. I got my network interface information using "ifconfig" command

            [root@localhost ~]# ifconfig

                   lo          Link encap:Local Loopback  
                                inet addr:127.0.0.1  Mask:255.0.0.0
                                inet6 addr: ::1/128 Scope:Host
                                UP LOOPBACK RUNNING  MTU:16436  Metric:1
                                RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                                TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                                collisions:0 txqueuelen:0 
                                RX bytes:0 (0.0 MiB)  TX bytes:0 (0.0 MiB)

Above result is showing network interface down. So i used below command to up the interface.

             [root@localhost ~]#  ifup  eth0

After that again i checked. It was up

              [root@localhost ~]# ifconfig

                    eth0      Link encap:Ethernet  HWaddr 10:78:D2:54:19:BD  
                                 inet6 addr: fe80::1278:d2ff:fe54:19bd/64 Scope:Link
                                 UP BROADCAST RUNNING MULTICAST  MTU:1500 Metric:1
                                RX packets:1055 errors:0 dropped:0 overruns:0 frame:0
                                TX packets:4 errors:0 dropped:0 overruns:0 carrier:5
                                collisions:0 txqueuelen:1000 
                                RX bytes:88232 (86.1KiB)  TX bytes:328 (328.0 b)

                    lo          Link encap:Local Loopback  
                                inet addr:127.0.0.1  Mask:255.0.0.0
                                inet6 addr: ::1/128 Scope:Host
                                UP LOOPBACK RUNNING  MTU:16436  Metric:1
                                RX packets:0 errors:0 dropped:0 overruns:0 frame:0
                                TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
                                collisions:0 txqueuelen:0 
                                RX bytes:0 (0.0 MiB)  TX bytes:0 (0.0 MiB)

I had tried two methods for setting up ip address,

    1. DHCP IP Address
    2. Static IP Address

Network interface configuration file location "/etc/sysconfig/network-scripts/ifcfg-eth0 "

Configure Dynamic IP Address :


 First i configured dynamic ip address for my machine. This steps i used for that.
        

         [root@localhost ~]# vim  /etc/sysconfig/network-scripts/ifcfg-eth0

                                  DEVICE="eth0"
                                  BOOTPROTO="dhcp"
                                  HWADDR=10:78:D2:54:19:BD
                                  NM_CONTROLLED="yes"
                                  ONBOOT="yes"
                                  TYPE="Ethernet"
                                  UUID="6b03d1a2-8bb1-4d7b-bd03-8a2e2b4acccf"

                      : wq

After that i restarted the network service

         [root@localhost ~]#  /etc/init.d/network  restart

Configure Static IP Address :


Second i tried static ip address for my machine. This steps i used for that

        [root@localhost ~]# vim  /etc/sysconfig/network-scripts/ifcfg-eth0

                                  DEVICE="eth0"
                                  BOOTPROTO="static"
                                  HWADDR=10:78:D2:54:19:BD
                                  NM_CONTROLLED="yes"
                                  ONBOOT="yes"
                                  TYPE="Ethernet"
                                  UUID="6b03d1a2-8bb1-4d7b-bd03-8a2e2b4acccf"
                                  IPADDR=192.168.0.100
                                  NETMASK=255.255.255.0
                                
                              :wq  


After that i restarted the network service

             [root@localhost ~]#  /etc/init.d/network  restart


Wednesday 4 January 2012

Linux Set Date and Time From a Command Prompt:

Here i am going to show how to check date and time using "date" command

  root@manivel-admin:~#  date
  Thu Mar 14 23:51:04 IST 2010

If it is showing wrong data and time, you can set date and time using following command

How to set date :

root@manivel-admin:~#  date   +%Y%m%d  -s   "20120104"

     -s   ----> set
    %Y ---> year
    %m  ----> month
    %d  ----> date

How to set time :

root@manivel-admin:~#   date   +%T%p  -s   "10:10:30AM"

     %T  ---> time
     %p  ---->either AM or PM