DEV Community

Cover image for 9.Configure Local Yum repos
Thu Kha Kyawe
Thu Kha Kyawe

Posted on

9.Configure Local Yum repos

Lab Information

The Nautilus production support team and security team had a meeting last month in which they decided to use local yum repositories for maintaing packages needed for their servers. For now they have decided to configure a local yum repo on Nautilus Backup Server. This is one of the pending items from last month, so please configure a local yum repository on Nautilus Backup Server as per details given below.

a. We have some packages already present at location /packages/downloaded_rpms/ on Nautilus Backup Server.

b. Create a yum repo named localyum and make sure to set Repository ID to localyum. Configure it to use package's location /packages/downloaded_rpms/.

c. Install package samba from this newly created repo.

Lab Solutions

🧭 Part 1: Lab Step-by-Step Guidelines

Objective

On Nautilus Backup Server (stbkp01):

Create a local yum repository

Use packages located at

/packages/downloaded_rpms/

Repository name:

localyum

Install:

samba

from that repo.

1️⃣ Login to Jump Host

ssh thor@jump_host.stratos.xfusioncorp.com
Enter fullscreen mode Exit fullscreen mode

Password

mjolnir123

2️⃣ SSH into Backup Server

ssh clint@stbkp01
Enter fullscreen mode Exit fullscreen mode

Password

H@wk3y3

3️⃣ Switch to Root

sudo -i
Enter fullscreen mode Exit fullscreen mode

4️⃣ Create Repo File

Create the repo configuration file:

mkdir -p /etc/yum.repos.d
vi /etc/yum.repos.d/localyum.repo
Enter fullscreen mode Exit fullscreen mode

Add the following configuration:

[localyum]
name=localyum
baseurl=file:///packages/downloaded_rpms
enabled=1
gpgcheck=0
Enter fullscreen mode Exit fullscreen mode

Save and exit.

5️⃣ Clean and Refresh YUM

yum clean all
yum repolist
Enter fullscreen mode Exit fullscreen mode

You should see:

localyum

6️⃣ Install Samba from the Local Repo

yum install -y samba
Enter fullscreen mode Exit fullscreen mode

7️⃣ Verify Installation

rpm -qa | grep samba
Enter fullscreen mode Exit fullscreen mode

Example output:

samba-common-4.23.5-6.el9.noarch
samba-common-libs-4.23.5-6.el9.x86_64
samba-client-libs-4.23.5-6.el9.x86_64
samba-libs-4.23.5-6.el9.x86_64
samba-dcerpc-4.23.5-6.el9.x86_64
samba-ldb-ldap-modules-4.23.5-6.el9.x86_64
samba-common-tools-4.23.5-6.el9.x86_64
samba-4.23.5-6.el9.x86_64


🧠 Part 2: Simple Explanation (Beginner Friendly)

What the lab is testing

This lab tests Linux package repository configuration.

Key concept:

Local YUM repository

Instead of downloading packages from the internet, the system installs them from local files.

Why companies use local repositories

In enterprise environments:

Reason Explanation
Security Prevent downloading unknown packages
Speed Packages install faster
Control Only approved packages allowed
Offline systems Works without internet

Where the packages are stored

The lab provides:

/packages/downloaded_rpms/

This folder contains RPM files like:

samba.rpm
libsmb.rpm

These will act as our local repository.

What the repo configuration does

File created:

/etc/yum.repos.d/localyum.repo

This tells yum:

Use this directory as a package source
Repo configuration breakdown

[localyum]

Repository ID.

name=localyum

Display name.

baseurl=file:///packages/downloaded_rpms

Location of packages.

Important:

file:///

means local filesystem, not internet.

enabled=1

Enable the repository.

gpgcheck=0

Skip signature verification.

Why we run yum repolist

yum repolist

This shows all active repositories.

Example output:

repo id repo name
localyum localyum

Installing Samba

Finally:

yum install samba

Now yum installs from the local repo, not the internet.


Resources & Next Steps
📦 Full Code Repository: KodeKloud Learning Labs
📖 More Deep Dives: Whispering Cloud Insights - Read other technical articles
💬 Join Discussion: DEV Community - Share your thoughts and questions
💼 Let's Connect: LinkedIn - I'd love to connect with you

Credits
• All labs are from: KodeKloud
• I sincerely appreciate your provision of these valuable resources.

Top comments (0)