Friday, January 24, 2014

YUM Server and Client set up

 YUM - yellow dog update modifier

- It helps to install packages which resolves the dependencies automatically
- It can be configure on one server and point the location on the yum client set up file and use on multiple servers using ftp or http. FTP, HHTP

YUM server set up
For initial you can use ISO image or DVD to set it up.


1. Mount cd or ISO image.
# mount -o loop ISOpath /mnt        // for ISO image file
  OR
# mount /dev/cdrom /mnt            // for CD/DVD
# cd Packages

2. Install following packages.

# rpm -ivh createrepo+tab            // Date Repository
# rpm -vh deltarpm+tab                // solves Dependency
# rpm -ivh python-deltarpm+tab            // solves Dependency
 # rpm -ivh vsftpd+tab                // Folder created /var/ftp/pub

3. Copy CD/ISO image content
# cp -rfv * /var/ftp/pub
# cf /mnt/repodata

# cp 1a........xml /var/ftp/pub

4. Create a repo
# createrepo -vg /var/ftp/pub/1a......xml    // -vg - verbose group
# cd /etc/yum.repos.d

# rm -rf *                    // To remove previous existing answer files
# vim yum.repo
    [MyRepo]
    home=My Custom Repository
    baseurl=file:///var/ftp/pub
    #baseurl=ftp://expanor.local/ks/packages/
    # baseurl=ftp://192.168.10.110/ks/rhel6
    gpgcheck=0
    enabled=1
    :wq

======================================
How to configure yum repo?
Note,
i. A configuration file for each repository (or group of related repos) should be created in /etc/yum.repos.d/
ii. The name of each repo config file should end in “.repo”.
iii. Yum Repository Mandatory Configuration Items

a. Repository ID: Short name to identify this repository in reports
 [MyRepo]

b. Name: Long description of this repository
 name=My Custom Repository

c. Baseurl: Description of protocol and location of packages to locate from the repo file.
 baseurl=ftp://192.168.10.110/ks/rhel6

d. gpgcheck: Defines whether yum should attempt to validate package signatures. “0? = “off”, “1? = “on”.
 gpgcheck=1

e. gpgkey: Defines (via URL) where the keys for signature validation are located
 (typically file:///etc/pki/rpm-gpg/<key name>)

gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

f. enabled (Optional) Defines whether this repository should be currently active. “0? = “off”, “1? = “on”.
 enabled=1

======================================
 # yum clean all  // To check
# yum list all             
# service vsftpd restart            // Restart FTP service
# chkconf vsftpd on

Setting up YUM Client

1. Install ftp package,
# yum install ftp -y
# cd /etc/yum.repos.d
# ls
# rm -rf *
# vim file.repo
    [Yum Client]
    name=client
    baseurl=ftp://192.168.10.110/pub        // FTP server IP
    gpgcheck=0
    enabled=1
    :wq


Some yum commands

# yum install yum* -y
# yum ls            // list all the packages
# yum history            // list the history

To see Shortcut :

# cat /etc/yum/aliases.conf

To search for the install file :

# yum whatprovides crond

How to set up yum client for a single host without ftp or http

1. Get the OS image.
# mount -o loop ISOpath /mnt        // for ISO image file
  OR
# mount /dev/cdrom /mnt            // for CD/DVD

# cd /mnt
# mkdir /opt/yum
# cp -rvf . /opt/yum
# vim /etc/yum.repos.d/base.repo
  Insert mode
  [Server]
  name=base
  baseurl=file:///opt/yum
  gpgcheck=0
  enabled=1
  :wq
# yum update

No comments:

Post a Comment