Pages

Sunday, December 13, 2015

Yum configuration on Linux OS

Home

Yum is the best and suggested option to carry out any package installation on a Linux OS
Installation done through yum do not create any major hurdles or problems in case of any update to be carried out on the Linux OS
There are multiple options to use yum we will see each of them in this document
-          Local YUM repository through CD/DVD or ISO or local folders
-          YUM repository Server Hosted in internal infrastructure
-          YUM repository Server Hosted over internet

Local YUM repository through CD/DVD or ISO or local folders
-          To get the local repository configured using CD/DVD or local folder we will first need to locate all the repodata folders present in the location
-          If its not present then various additional steps are required to be followed, we will see those in next section of this document

First we will try to use content of CD/DVD or ISO mount point itself
-          Syntax to be checked for the presence of repodata folder on the specified location and
df -h /mnt/cdrom/
find /mnt/cdrom/ -ls |grep repomd.xml |awk '{print $11}'
-          Sample output for the above command would be as below,
[root@TestVM001 yum.repos.d]# df -h /mnt/cdrom/
Filesystem            Size  Used Avail Use% Mounted on
/dev/hdc              2.7G  2.7G     0 100% /mnt/cdrom
[root@TestVM001 yum.repos.d]# find /mnt/cdrom/ -ls |grep repomd.xml |awk '{print $11}'
/mnt/cdrom/Cluster/repodata/repomd.xml
/mnt/cdrom/ClusterStorage/repodata/repomd.xml
/mnt/cdrom/Server/repodata/repomd.xml
/mnt/cdrom/VT/repodata/repomd.xml

-          Now we will create repo file for all the repodata folders found in previous step
-          Sample content of the cdrom-cluster.repo file is as below,
#cat cdrom-cluster.repo
[cdrom-cluster]
name=CDROM Repo Cluster
baseurl=file:///mnt/cdrom/Cluster
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
-          We will get a separate file created for each repodata folder obtained in the first output findings list of those is as below,
[root@TestVM001 yum.repos.d]# ls -lrt
total 24
-rw-r--r-- 1 root root 145 Feb 12 07:06 cdrom-vt.repo
-rw-r--r-- 1 root root 153 Feb 12 07:06 cdrom-server.repo
-rw-r--r-- 1 root root 169 Feb 12 07:06 cdrom-clusterstorage.repo
-rw-r--r-- 1 root root 155 Feb 12 07:06 cdrom-cluster.repo

-          To clean the Yum configuration present on the server use below syntax,
yum clean all
-          Sample output for the above command would be as below,
[root@SIDCHDUPCLERA01 ~]# yum clean all
Loaded plugins: fastestmirror, refresh-packagekit, security
Cleaning up Everything
Cleaning up list of fastest mirrors

-          We will do a first yum list with nely craeted repo files using below syntax,
yum list all
-          Sample output for the above command would be as below,
[root@TestVM001 yum.repos.d]# yum list
Setting up repositories
cdrom-server              100% |=========================| 1.3 kB    00:00
cdrom-vt                  100% |=========================| 1.3 kB    00:00
cdrom-cluster             100% |=========================| 1.3 kB    00:00
cdrom-clusterstorage      100% |=========================| 1.3 kB    00:00
Reading repository metadata in from local files
primary.xml.gz            100% |=========================| 663 kB    00:00
################################################## 2113/2113
primary.xml.gz            100% |=========================| 6.0 kB    00:00
################################################## 31/31
primary.xml.gz            100% |=========================| 6.4 kB    00:00
################################################## 32/32
primary.xml.gz            100% |=========================| 4.2 kB    00:00
################################################## 32/32
Installed Packages
Deployment_Guide-en-US.noarch            5.0.0-19               installed
. . . . . . . . . . . . .
Available Packages
Cluster_Administration-as-IN.noarch      5.0.0-5                cdrom-cluster
. . . . . . . . . . . . .
Deployment_Guide-as-IN.noarch            5.0.0-19               cdrom-server
. . . . . . . . . . . . .
Global_File_System-as-IN.noarch          5.0.0-4                cdrom-clusterstorage
. . . . . . . . . . . . .
Virtualization-as-IN.noarch              5.0.0-7                cdrom-vt
. . . . . . . . . . . . .

Now we will try to use content of local folder which has RPMs copied within it.
-          Things to be ensured are,
·         All rpm files should be present in the desired folder
·         The folder should not be read only
·         createrepo rpm should be present
-          Syntax to be used for the creation of repodata folder within the desired folder is as below,
wget http://mirror.centos.org/centos/6/os/i386/Packages/createrepo-0.9.9-22.el6.noarch.rpm
rpm –ivh --test createrepo-0.4.4-2.fc6.noarch.rpm
mkdir /tmp/yum.createrepo
createrepo -u /custom_rpm_folder /tmp/yum.createrepo/
-          Sample output for the above command would be as below,
[root@TestVM001 yum.repos.d]# mkdir /tmp/yum.createrepo
[root@TestVM001 yum.repos.d]# cd /tmp/yum.createrepo
[root@TestVM001 yum.createrepo]# pwd
/tmp/yum.createrepo
[root@TestVM001 yum.createrepo]# ls -lrt
total 0
[root@TestVM001 yum.createrepo]# createrepo -u /custom_rpm_folder  /tmp/yum.createrepo/
Saving Primary metadata
Saving file lists metadata
Saving other metadata
[root@TestVM001 yum.createrepo]# ls -lrt
total 4
drwxr-xr-x 2 root root 4096 Feb 12 07:29 repodata
[root@TestVM001 yum.createrepo]# ls -lrt repodata/
total 16
-rw-r--r-- 1 root root 1041 Feb 12 07:29 repomd.xml
-rw-r--r-- 1 root root  177 Feb 12 07:29 primary.xml.gz
-rw-r--r-- 1 root root  165 Feb 12 07:29 other.xml.gz
-rw-r--r-- 1 root root  170 Feb 12 07:29 filelists.xml.gz

YUM repository Server hosted in internal infrastructure
TODO

YUM repository Server hosted over internet

TODO




Back To Top
Home

No comments:

Post a Comment