0
What is YUM ?
YUM stands for Yellow dog Updater, Modified because it is based on YUP, the Yellow dog Updater. Yellow Dog is a version of Linux for the Power Architecture hardware. YUP, and later YUM, were written by the Linux community as a way to maintain an RPM-based system.
 
 
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.
 
 
The Yum configuration file for yum and related utilities is located at /etc/yum.conf. This file contains one mandatory  section, which allows you to set Yum options that have global effect, and can also contain one or more [repository] sections, which allow you to set repository-specific options. However, it is recommended to define individual repositories in new or existing .repo files in the /etc/yum.repos.d/directory. The values you define in the [main] section of the /etc/yum.conf file can override values set in individual [repository] sections.
This section shows you how to:
  • set global Yum options by editing the [main] section of the /etc/yum.conf configuration file;
  • set options for individual repositories by editing the [repository] sections in /etc/yum.conf and .repo files in the /etc/yum.repos.d/ directory;
  • use Yum variables in /etc/yum.conf and files in the /etc/yum.repos.d/ directory so that dynamic version and architecture values are handled correctly;
  • add, enable, and disable Yum repositories on the command line; and,
  • set up your own custom Yum repository. 
     
     
     
    Here we go again fallow Step by Step :

    1. Verify if ‘createrepo’ is already installed. If it is installed, skip step 2 and continue from step 3. Otherwise, proceed to the next step.

    [root@rep-serv ~]# rpm -qi createrepo

    2. If ‘createrepo’ isn’t already installed, since it isn’t by default; install it.

    [root@rep-serv ~]# yum -y install createrepo

    3. Launch your favorite text editor (for me it’s ‘vim’) to create a simple bash script called ‘repo-setup.sh’.

    [root@rep-serv ~]# vim repo-setup.sh

    4. Copy, paste and save the following bash script into newly created file (repo-setup.sh):

    #!/bin/sh -e
     mkdir -p /packages/centos/6/{SRPMS,updates,i386,x86_64}
     destdir="/packages/centos/6"
     for arch in i386 x86_64 updates
     do
     chown -R root:root ${destdir}/${arch}
     chmod -R o-w+r ${destdir}/${arch}
     pushd ${destdir}/${arch} >/dev/null 2>&1
     createrepo .
     popd >/dev/null 2>&1
     done

    Info: The script creates a directory structure, setups its ownership and permissions as necessary; and creates the repository using ‘createrepo’ command.

    5. Once saved, make it executable.

    [root@rep-serv ~]# chmod u+x repo-setup.sh

    6. Execute ‘repo-setup.sh.

    [root@rep-serv ~]# ./repo-setup.sh

    Info: Up to this point, basically, you have created the repository: if you do a ‘ls -lart’ of the directory structure ‘/packages/centos/6/*’ created by the script, you shall see the appropriate repository files listed there. Yet, you need to finish the last touches – that is configuring the repository. In this document, I called the repository ‘local’, but you may call yours whatever you prefer. To make this repository available to clients we need to create the following repository file ‘local.repo’ under ‘/etc/yum.repos.d/’.

    7. Launch your favorite text editor again (mine is ‘vim’) to create ‘/etc/yum.repos.d/local.repo’, your local repository’s configuration file:

    [root@rep-serv ~]# vim /etc/yum.repos.d/local.repo

    8. Copy the following, paste into ‘/etc/yum.repos.d/local.repo’ and save the file and exit :

    [local]
     name=CentOS-$releasever - local packages for $basearch
     baseurl=file:///packages/centos/$releasever/$basearch
     #baseurl=ftp://internalhost.com/yumrepo/centos/$releasever/$basearch
     #baseurl=http://internalhost.com/localrepo/centos/$releasever/$basearch
     enabled=1
     gpgcheck=1
     gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6-LocalRepo
     protect=1

    Before going further, let me explain some of the keywords above listed in the file:
    name: is self explanatory – repository’s name.
    baseurl: is the physical location of the repository. In the above file, NFS location is enabled while FTP and HTTP locations are disabled (commented).
    enable: basically is self explanatory. When set to 1, it’s on. And when set to 0, it is off.
    gpgcheck: enables or disables GPG-Key checking; can be turned either on or off by using (1 or 0).
    gpgkey: gives the physical location of the public-ascii-gpg-key file.
    protect: is basically something that yum uses to protect a repository from updating from other repositories. In this case it’s turned on, so this repository shall not update its files by downloading newer files from a mirror repository. This brings me to the concept of synchronizing to mirrors, which I am not going to explain further but simply show how it can be done next in case you want this feature.

    Synchronize to a mirror of your choice: list of mirror.
    9. Following command triggers sync activity of the local repo with usc.edu’s mirrors (it basically gets all the updates from usc.edu mirror).

    [root@rep-serv ~]# rsync -avrt rsync://mirrors.usc.edu/centos/6/updates/i386 –exclude=debug/ /packages/centos/6/updates/

    In order for the protect feature to work, ‘yum-plugin-protectbase’ or ‘yum-protectbase’ must be installed. Basically for CentOS 4 and 6 you shall install ‘yum-plugin-protectbase’. For CentOS 5, however, you shall install ‘yum-protectbase’. They both do the same thing; the names are different because developers chose to give them different names.
    10. Check if ‘protectbase pluin’ is installed:

    [root@rep-serv ~]# rpm -qi yum-plugin-protectbase # For CentOS version 4 or 6
    [root@rep-serv ~]# rpm -qi yum-protectbase  # For CentOS version 5

    11. If not installed, install it as following

    [root@rep-serv ~]# yum install yum-plugin-protectbase # For CentOS version 4 or 6
     [root@rep-serv ~]# yum install yum-protectbase # For CentOS version 5
     
    Now you will success fully yum configuration.
    If reposdir is not set, yum uses the default directory /etc/yum.repos.d/.  

Post a Comment

 
Top