Monday, May 28, 2012

How to add a repository manually in RHEL6 and Centos 6

How to add a repository manually in RHEL6 and Centos 6


Make a Derectory
[root@server1 ~]# mkdir /data
[root@server1 ~]# mkdir /data/yum

Copy Packages For Local Derectory
[root@server1 ~]# cp -rv /media/CentOS_6.0_Final/Packages/ /data/yum/

Change Derectory
[root@server1 ~]# cd /data/yum/Packages/

Install packages & Dependency
[root@server1 Packages]# rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm
warning: createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
    deltarpm is needed by createrepo-0.9.8-4.el6.noarch
    python-deltarpm is needed by createrepo-0.9.8-4.el6.noarch
[root@server1 Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.i686.rpm
warning: deltarpm-3.5-0.5.20090913git.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:deltarpm               ########################################### [100%]
[root@server1 Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm
warning: python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:python-deltarpm        ########################################### [100%]
[root@server1 Packages]# rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm warning: createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:createrepo             ########################################### [100%]

change Derectory
[root@server1 Packages]# cd

To create repository
[root@server1 ~]# createrepo /data/
 676/4558 - yum/Packages/slf4j-manual-1.5.8-7.el6.noarch.rpm                   
iso-8859-1 encoding on Ville Skytt� <ville.skytta@iki.fi> - 2.8.2-2

4558/4558 - yum/Packages/netlabel_tools-0.19-6.el6.i686.rpm                    
Saving Primary metadata
Saving file lists metadata
Saving other metadata

To Make repository file
[root@server1 ~]# vim /etc/yum.repos.d/base.repo

[yum]
baseurl=file:///data/
gpgcheck=0

save :wq!

To Run Clean all
[root@server1 ~]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit
Repository 'yum' is missing name in configuration, using id
Cleaning up Everything
Cleaning up list of fastest mirrors

To Run Update all
[root@server1 ~]# yum update all
Loaded plugins: fastestmirror, refresh-packagekit
Repository 'yum' is missing name in configuration, using id
Determining fastest mirrors
yum                                                      | 1.3 kB     00:00 ...
yum/primary                                              | 1.8 MB     00:00 ...
yum                                                                   4558/4558
Setting up Update Process
No Match for argument: all
No package all available.
No Packages marked for Update
[root@server1 ~]#

NFS Server configuration Centos 6 And RHEL 6

Network File System (NFS)

Network File System (NFS) is a network file system protocol originally developed by Sun Micro systems. It allows your users or client compute to access files over a network. Linux and UNIX like operating systems (including MS-Windows) can mount file system over a network and work as they are mounted locally. This is perfect for sharing files or centralized home directories.

NFS version 4 provides the following benefits over NFSv3 or earlier NFS versions:

  1  Performance improvements
  2  Mandates security and ACL
  3  NFS v4 by default works over TCP s
  4  Easy to setup firewall option
  5  And much more.

Required Packages

nfs-utils - The nfs-utils package provides a daemon for the kernel NFS server and related tools, which provides a much higher level of performance than the traditional Linux NFS server used by most users.

Install NFS Server

[root@server Desktop]# yum install nfs*

[root@server Desktop]# mksdir /data

[root@server Desktop]# chmod 777 /data

Share File System

[root@server Desktop]# vim /etc/exports

/data   *(rw,sync)

save :wq!

Start NFS services

[root@server Desktop]#service nfs restart
Sample outputs:

Starting NFS services:                                [  OK  ]
Starting NFS quotas:                                  [  OK  ]
Starting NFS daemon:                                  [  OK  ]
Starting NFS mountd:                                  [  OK  ]

Turn on services

[root@server Desktop]#chkconfig nfs on

To Show Mount

[root@server Desktop]# showmount -e 10.90.12.1
Export list for 10.90.12.1:
/data *
       

Client End

To Show Mount
[root@server Desktop]# showmount -e 10.90.12.1
Export list for 10.90.12.1:
/data *
To Mount Share File
[root@server1 ~]# mount 10.90.12.1:/data /mnt

[root@server1 ~]# ls /mnt/
abc  bnd  yt
[root@server1 ~]# touch /mnt/abc


[root@server1 ~]# umount /mnt

Sunday, May 27, 2012

YUM Server configuration Centos 6 and RHEL 6



Advantages of YUM

Automatic resolution of software dependencies. If a package installation or upgrade request is made and requires the installation or upgrade of additional packages, YUM can list these dependencies and prompt the user to install or upgrade them.
Command-line and graphical versions. The command-line version can be run on a system with a minimal number of software packages. The graphical versions offer ease-of-use and a user-friendly graphical interface to software management.
Multiple software locations at one time. YUM can be configured to look for software packages in more than one location at a time.
Ability to specify particular software versions or architectures. Software locations accessible by YUM can contain multiple versions of the same RPM package and different builds for different architectures such as one for i686 and one for x86_64. yum can easily check the appropriate version and download it.
While it's unlikely that you'll have an Internet connection during the exam, you could have a network connection to a local repository. So you should be ready to use the yum command during the Red Hat exam.

Server side configuration:
Step 1:
Install createrepo.rpm from the DVD for creating repository.

[root@server Desktop]# cd /media/CentOS_6.0_Final/Packages/


[root@server Packages]# rpm -ivh vsftpd-2.2.2-6.el6.i686.rpm
warning: vsftpd-2.2.2-6.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:vsftpd                 ########################################### [100%]

[root@server Packages]# service vsftpd restart
Shutting down vsftpd:                                      [FAILED]
Starting vsftpd for vsftpd:                                [  OK  ]


[root@server Packages]# chkconfig vsftpd on


[root@server Packages]# rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm
warning: createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
    deltarpm is needed by createrepo-0.9.8-4.el6.noarch
    python-deltarpm is needed by createrepo-0.9.8-4.el6.noarch

Install the dependencies first, if any [eg:deltarpm, python-deltarpm]

[root@server Packages]# rpm -ivh deltarpm-3.5-0.5.20090913git.el6.i686.rpm
warning: deltarpm-3.5-0.5.20090913git.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:deltarpm               ########################################### [100%]


[root@server Packages]# rpm -ivh python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm
warning: python-deltarpm-3.5-0.5.20090913git.el6.i686.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:python-deltarpm        ########################################### [100%]


[root@server Packages]# rpm -ivh createrepo-0.9.8-4.el6.noarch.rpm warning: createrepo-0.9.8-4.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing...                ########################################### [100%]
   1:createrepo             ########################################### [100%]

[root@server Packages]# mkdir /var/ftp/yum

Step 2:
Copy all rpm form the DVD and past over the hard disk share them up in NFS.

[root@server Packages]# cp -rv /media/CentOS_6.0_Final/Packages/ /var/ftp/yum/

[root@server Packages]# ls /var/ftp/yum/
Packages

Step3
 To Create Repo
[root@server Packages]# createrepo /var/ftp/
  68/4558 - yum/Packages/atlas-sse3-devel-3.8.3-12.4.el6.i686.rpm
iso-8859-1 encoding on Ville Skytt� <ville.skytta@iki.fi> - 2.8.2-2
4558/4558 - yum/Packages/perl-Time-Piece-1.15-115.el6.i686.rpm                 
Saving Primary metadata
Saving file lists metadata
Saving other metadata

[root@server Packages]# cd /etc/yum.repos.d/

[root@server yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo
 Step3:
To Rename Defaults repo 

[root@server yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.old
[root@server yum.repos.d]# mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.old
[root@server yum.repos.d]# mv CentOS-Media.repo CentOS-Media.repo.old

[root@server yum.repos.d]# ls
CentOS-Base.repo.old  CentOS-Debuginfo.repo.old  CentOS-Media.repo.old
Step4
Create File Repo.base
[root@server yum.repos.d]# vi base.repo

[yum]
baseurl=ftp://10.23.145.1
gpgcheck=0

to Save :wq!

[root@server yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit
Repository 'yum' is missing name in configuration, using id
Cleaning up Everything

[root@server yum.repos.d]# yum update all
Loaded plugins: fastestmirror, refresh-packagekit
Repository 'yum' is missing name in configuration, using id
Determining fastest mirrors
yum                                                      | 1.3 kB     00:00    
yum/primary                                              | 1.8 MB     00:00    
yum                                                                   4558/4558
Setting up Update Process
No Match for argument: all
No package all available.
No Packages marked for Update
[root@server yum.repos.d]#

________________________________________________________________________

Yum Client

[root@server Packages]# cd /etc/yum.repos.d/

[root@server yum.repos.d]# ls
CentOS-Base.repo  CentOS-Debuginfo.repo  CentOS-Media.repo

[root@server yum.repos.d]# mv CentOS-Base.repo CentOS-Base.repo.old

[root@server yum.repos.d]# mv CentOS-Debuginfo.repo CentOS-Debuginfo.repo.old

[root@server yum.repos.d]# mv CentOS-Media.repo CentOS-Media.repo.old

[root@server yum.repos.d]# ls
CentOS-Base.repo.old  CentOS-Debuginfo.repo.old  CentOS-Media.repo.old

[root@server yum.repos.d]# vi base.repo

[yum]
baseurl=ftp://10.23.145.1
gpgcheck=0

to Save :wq!

[root@server yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit
Repository 'yum' is missing name in configuration, using id
Cleaning up Everything

[root@server yum.repos.d]# yum update all
Loaded plugins: fastestmirror, refresh-packagekit
Repository 'yum' is missing name in configuration, using id
Determining fastest mirrors
yum                                                      | 1.3 kB     00:00    
yum/primary                                              | 1.8 MB     00:00    
yum                                                                   4558/4558
Setting up Update Process
No Match for argument: all
No package all available.
No Packages marked for Update


[root@localhost ~]# vi /etc/yum/pluginconf.d/fastestmirror.conf
 to enable=1 to change enable=0

Monday, May 14, 2012

How to Configure Primary DNS Server in redhat 6 Step by Step

Domain Name Server (DNS) Configuration and Administration


Domain Name System

The Domain Name System (DNS) is the crucial glue that keeps computer networks in harmony by converting human-friendly hostnames to the numerical IP addresses computers require to communicate with each other. DNS is one of the largest and most important distributed databases the world depends on by serving billions of DNS requests daily for public IP addresses. Most public DNS servers today are run by larger ISPs and commercial companies but private DNS servers can also be useful for private home networks. This article will explo

To Check IP
[root@www Desktop]# ifconfig
eth0      Link encap:Ethernet  HWaddr 00:0C:29:84:6D:8C 
          inet addr:10.90.12.1  Bcast:10.90.12.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe84:6d8c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:6624 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1474 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:442710 (432.3 KiB)  TX bytes:1901220 (1.8 MiB)
          Interrupt:19 Base address:0x2000

eth1      Link encap:Ethernet  HWaddr 00:0C:29:84:6D:96 
          inet addr:10.23.151.66  Bcast:10.23.159.255  Mask:255.255.224.0
          inet6 addr: fe80::20c:29ff:fe84:6d96/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:13927 errors:0 dropped:0 overruns:0 frame:0
          TX packets:7518 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:9215651 (8.7 MiB)  TX bytes:948169 (925.9 KiB)
          Interrupt:19 Base address:0x2080

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:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0
          RX bytes:480 (480.0 b)  TX bytes:480 (480.0 b)

To Set DNS Server IP
vi /etc/sysconfig/network-scripts/ifcfg-eth0

EVICE=eth0
HWADDR=00:0c:29:84:6d:8c
NM_CONTROLLED=no
ONBOOT=yes
IPADDR=10.90.12.1
BOOTPROTO=none
NETMASK=255.255.255.0
DNS=10.90.12.1
TYPE=Ethernet
IPV6INIT=no
USERCTL=no

save :wq

To Set Host Name
[root@station Desktop]# vim /etc/sysconfig/network

NETWORKING=yes
HOSTNAME=station.example.com

save :wq

[root@station Desktop]# vim /etc/hosts
0.90.12.1      station.example.com     station

save :wq

[root@station Desktop]# vim /etc/resolv.conf
search station.example.com
nameserver 10.90.12.1

save :wq

[root@station Desktop]# hostname station.example.com

[root@station Desktop]# hostname
station.example.com

To Install Package
[root@station Desktop]# yum install bind*
Loaded plugins: fastestmirror, refresh-packagekit, security
Repository 'yum' is missing name in configuration, using id
Loading mirror speeds from cached hostfile
Setting up Install Process
Package 32:bind-utils-9.7.3-8.P3.el6.i686 already installed and latest version
Package 32:bind-libs-9.7.3-8.P3.el6.i686 already installed and latest version
Resolving Dependencies
--> Running transaction check
---> Package bind.i686 32:9.7.3-8.P3.el6 will be installed
---> Package bind-chroot.i686 32:9.7.3-8.P3.el6 will be installed
---> Package bind-dyndb-ldap.i686 0:0.2.0-7.el6 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

================================================================================
 Package                Arch        Version                    Repository  Size
================================================================================
Installing:
 bind                   i686        32:9.7.3-8.P3.el6          yum        3.9 M
 bind-chroot            i686        32:9.7.3-8.P3.el6          yum         67 k
 bind-dyndb-ldap        i686        0.2.0-7.el6                yum         49 k

Transaction Summary
================================================================================
Install       3 Package(s)

Total download size: 4.0 M
Installed size: 7.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/3): bind-9.7.3-8.P3.el6.i686.rpm                      | 3.9 MB     00:00    
(2/3): bind-chroot-9.7.3-8.P3.el6.i686.rpm               |  67 kB     00:00    
(3/3): bind-dyndb-ldap-0.2.0-7.el6.i686.rpm              |  49 kB     00:00    
--------------------------------------------------------------------------------
Total                                            20 MB/s | 4.0 MB     00:00    
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Warning: RPMDB altered outside of yum.
  Installing : 32:bind-9.7.3-8.P3.el6.i686                                  1/3
  Installing : 32:bind-chroot-9.7.3-8.P3.el6.i686                           2/3
  Installing : bind-dyndb-ldap-0.2.0-7.el6.i686                             3/3

Installed:
  bind.i686 32:9.7.3-8.P3.el6            bind-chroot.i686 32:9.7.3-8.P3.el6   
  bind-dyndb-ldap.i686 0:0.2.0-7.el6   

Complete!
[root@station Desktop]#

 To Copy named.conf file
[root@station Desktop]# cp /etc/named.conf  /var/named/chroot/etc/named.conf


To Change directory
 cd /var/named/chroot/etc/

To edit configuration file
[root@station etc]#vim named.conf
options {
        directory       "/var/named";
};

zone "example.com" IN {
        type master;
        file "for.zone";
};

zone "12.90.10.in-addr.arpa" IN {
        type master;
        file "rev.zone";
};

save :wq

To Change Group Name
[root@station etc]# chgrp named named.conf

To Copy File same Location
[root@station etc]# cp /var/named/named.localhost /var/named/chroot/var/named/for.zone
[root@station etc]# cp /var/named/named.loopback /var/named/chroot/var/named/rev.zone

To change directory
[root@station etc]# cd /var/named/chroot/var/named/

To edit configuration file
[root@station named]# vim for.zone
$TTL 1D
@       IN SOA  example.com. root.example.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
@       IN      NS      station.example.com.
station IN      A       10.90.12.1

save :wq

To edit configuration file
[root@station named]# vim rev.zone
$TTL 1D
@       IN SOA  example.com. root.example.com. (
                                        0       ; serial
                                        1D      ; refresh
                                        1H      ; retry
                                        1W      ; expire
                                        3H )    ; minimum
@       IN      NS      station.example.com.
1       IN      PTR     station.example.com.

save :wq

To Change Group Name
[root@station named]# chgrp named for.zone
[root@station named]# chgrp named rev.zone
[root@station named]# ll
total 8
-rw-r-----. 1 root named 190 Jun  1 19:12 for.zone
-rw-r-----. 1 root named 196 Jun  1 19:15 rev.zone
[root@station named]#

To Restart Service & On
[root@station named]# service named restart
Stopping named:                                            [  rajesh  ]
Starting named:                                            [  rajesh  ]

[root@station named]# chkconfig named on

To Check Named Server
[root@station named]# dig 10.90.12.1

; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> 10.90.12.1
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 23819
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;10.90.12.1.            IN    A

;; AUTHORITY SECTION:
.            10800    IN    SOA    a.root-servers.net. nstld.verisign-grs.com. 2012060501 1800 900 604800 86400

;; Query time: 193 msec
;; SERVER: 113.193.1.14#53(113.193.1.14)
;; WHEN: Fri Jun  1 19:17:27 2012
;; MSG SIZE  rcvd: 103

[root@station named]# dig station.example.com

; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> station.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24133
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;station.example.com.        IN    A

;; ANSWER SECTION:
station.example.com.    86400    IN    A    10.90.12.1

;; AUTHORITY SECTION:
example.com.        86400    IN    NS    station.example.com.

;; Query time: 1 msec
;; SERVER: 10.90.12.1#53(10.90.12.1)
;; WHEN: Fri Jun  1 19:17:47 2012
;; MSG SIZE  rcvd: 67

[root@station named]#


Client end Setting



[admin@station1]$vim /etc/resolve.conf

search station.example.com
nameserver 10.90.12.1
Save :wq
[admin@station1]$ dig station.example.com

; <<>> DiG 9.7.3-P3-RedHat-9.7.3-8.P3.el6 <<>> station.example.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 24133
;; flags: qr aa rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 1, ADDITIONAL: 0

;; QUESTION SECTION:
;station.example.com.        IN    A

;; ANSWER SECTION:
station.example.com.    86400    IN    A    10.90.12.1

;; AUTHORITY SECTION:
example.com.        86400    IN    NS    station.example.com.

;; Query time: 1 msec
;; SERVER: 10.90.12.1#53(10.90.12.1)
;; WHEN: Fri Jun  1 19:17:47 2012
;; MSG SIZE  rcvd: 67