Configure Local Yum Repository

Hi,

Task is to create a local yum repository where needed packages are already available in the /packages/downloaded_rpms directory and set the repository ID to localyum

I referred tutorials to how to sync to local repository https://www.tecmint.com/setup-local-http-yum-repository-on-centos-7/

In the second link it explains how to create repo for the local directory - createrepo /repository1
that is to set the createrepo /packages/downloaded_rpms

How to set the --repoid to localyum… Not able to figure out

I understand we need to create file with vim /etc/yum.repos.d/localyum.repo
and configure
[localyum]
name=localyum
baseurl=file:///packages/downloaded_rpms
gpgcheck=0

Is my understanding correct? Please correct if it is wrong, Thanks

yeah everything is perfect. Make sure install that vim package as well to mark task success.

Thanks for the reply, here i am not getting how to set the repository ID to localyum.

Task clearly says to “set the repository ID to localyum”

I understand --repoid is set during executing reposync tool while downloading the rpms…but here we already have the rpms/packages folder downloaded.

[localyum]
name = localyum
baseurl = file:///packages/downloaded_rpms
gpgcheck = 0
enabled = 1

repo id —> [ ]
so your repo id is localyum

2 Likes

@player001

Thank you so much, got little confused initially, was able to configure and install the required package.

I completed everything and still got failed. Any idea why ?

@InderpreetThis shows already installed. then why it got failed ? As the tasks are advanced, now i am frequently getting failure. I perform all the required steps still i get Failed as Status. This forum is the only step to improve myself and learn from those mistakes. your help is appreciated.

Hello, kp3642
Can i see your repo file? maybe I can help.

Hi @kp3642 the task is to just configure local yum repo

  1. when you do ls /packages/downloaded_rpms

you can find a metadata directory named “repodata” in it.

This means we do not need to run:
createrepo /packages/downloaded_rpms

because /packages/downloaded_rpms is already made as repo directory

the task is to just create a local_yum.repo file under /etc/yum.repos.d

For verification:

Before confguring local_yum.repo and set it to local file /packages/downloaded_rpms

just do following:

yum install httpd --> this will fail as we will not have any repos enabled.

next do : yum repolist --> this will result in 0 repos

then check the rpm package which was asked to install:
rpm -aq httpd* --> no such rpm packages

now try to create the local_yum.repo file under /etc/yum.repos.d with the configs required.

try to check the repolists again

yum repolists --> this time you will get the repo ID and metadata from /packages/downloaded_rpms in the result.

now install httpd or samba or vim-enhanced

yum install -y httpd

once completed check the package version

rpm -aq httpd*

the result package version will match with the rpm package available in /packages/downloaded_rpms