You are on page 1of 9

How to configure local yum server ?

Step-1 connect rhel ISO image to copy all the dvd files into any
directory ...

[root@station1 ~]# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 3.8G 0 3.8G 0% /dev
tmpfs 3.9G 0 3.9G 0% /dev/shm
tmpfs 3.9G 9.9M 3.8G 1% /run
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/mapper/rhel-root 27G 4.0G 23G 15% /
/dev/sda1 1014M 169M 846M 17% /boot
tmpfs 780M 16K 780M 1% /run/user/42
tmpfs 780M 4.6M 775M 1% /run/user/0
/dev/sr0 6.7G 6.7G 0 100% /run/media/root/RHEL-8-0-
0-BaseOS-x86_64
[root@station1 ~]#
[root@station1 ~]# mkdir /redhatdvd
[root@station1 ~]#
[root@station1 ~]# cd /run/media/root
[root@station1 root]#
[root@station1 root]# ls
RHEL-8-0-0-BaseOS-x86_64
[root@station1 root]#
[root@station1 root]# cd RHEL-8-0-0-BaseOS-x86_64
[root@station1 RHEL-8-0-0-BaseOS-x86_64]# ls
AppStream EFI extra_files.json images media.repo
RPM-GPG-KEY-redhat-release
BaseOS EULA GPL isolinux RPM-GPG-KEY-redhat-beta
TRANS.TBL
[root@station1 RHEL-8-0-0-BaseOS-x86_64]#
[root@station1 RHEL-8-0-0-BaseOS-x86_64]# cp -rf * /redhatdvd
[root@station1 RHEL-8-0-0-BaseOS-x86_64]# cd
[root@station1 ~]#
[root@station1 ~]# ls /redhatdvd
AppStream EFI extra_files.json images media.repo
RPM-GPG-KEY-redhat-release
BaseOS EULA GPL isolinux RPM-GPG-KEY-redhat-beta
TRANS.TBL
[root@station1 ~]#
[root@station1 ~]# eject

Step-2 create repo file with any types of URL....

[root@station1 ~]# cd /etc/yum.repos.d


[root@station1 yum.repos.d]# ls
redhat.repo
[root@station1 yum.repos.d]#
[root@station1 yum.repos.d]# vim dvd.repo

[firsturl]
name=this is local yum for baseos directory.
baseurl=file:///redhatdvd/BaseOS
enabled=1
gpgcheck=0

[secondurl]
name=this is my local yum for appstream directory.
baseurl=file:///redhatdvd/AppStream
enabled=1
gpgcheck=0

save and quit from this file.

[root@station1 yum.repos.d]# cd
[root@station1 ~]#

[root@station1 ~]# yum clean all


Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
6 files removed
[root@station1 ~]#
[root@station1 ~]# yum repolist
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
this is local yum for baseos directory.
248 MB/s | 2.2 MB 00:00
this is my local yum for appstream directory.
53 MB/s | 5.3 MB 00:00
repo id repo name
status
firsturl this is local yum for baseos directory.
1,658
secondurl this is my local yum for appstream
directory. 4,672
[root@station1 ~]#
[root@station1 ~]# yum list

[root@station1 ~]# yum list | grep ftp


python3-requests-ftp.noarch 0.3.1-11.el8
@AppStream
ftp.x86_64 0.17-78.el8
secondurl
lftp.i686 4.8.4-1.el8
secondurl
lftp.x86_64 4.8.4-1.el8
secondurl
lftp-scripts.noarch 4.8.4-1.el8
secondurl
syslinux-tftpboot.noarch 6.04-1.el8
firsturl
tftp.x86_64 5.2-24.el8
secondurl
tftp-server.x86_64 5.2-24.el8
secondurl
vsftpd.x86_64 3.0.3-28.el8
secondurl
[root@station1 ~]#
[root@station1 ~]#
[root@station1 ~]# yum list | grep vsftpd
vsftpd.x86_64 3.0.3-28.el8
secondurl
[root@station1 ~]#

******YUM Repo files is working properly ********************

Step-3 How to Use YUM ?

[root@station1 ~]# yum install vsftpd -y

[root@station1 ~]# yum install targetcli


[root@station1 ~]# yum install targetcli -y
[root@station1 ~]# yum install samba* -y
[root@station1 ~]# yum install http* -y

[root@station1 ~]# yum info vsftpd


Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
Last metadata expiration check: 0:05:17 ago on Thu 17 Oct 2019
07:24:45 PM IST.
Installed Packages
Name : vsftpd
Version : 3.0.3
Release : 28.el8
Arch : x86_64
Size : 356 k
Source : vsftpd-3.0.3-28.el8.src.rpm
Repo : @System
From repo : secondurl
Summary : Very Secure Ftp Daemon
URL : https://security.appspot.com/vsftpd.html
License : GPLv2 with exceptions
Description : vsftpd is a Very Secure FTP daemon. It was written
completely from
: scratch.

[root@station1 ~]#
[root@station1 ~]#
[root@station1 ~]# yum search vsftpd
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
Last metadata expiration check: 0:05:38 ago on Thu 17 Oct 2019
07:24:45 PM IST.
================================================= Name Exactly
Matched: vsftpd =================================================
vsftpd.x86_64 : Very Secure Ftp Daemon
vsftpd.x86_64 : Very Secure Ftp Daemon
[root@station1 ~]#
[root@station1 ~]# rpm -qa vsftpd
vsftpd-3.0.3-28.el8.x86_64
[root@station1 ~]#
[root@station1 ~]# yum list installed vsftpd
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
Installed Packages
vsftpd.x86_64 3.0.3-
28.el8

[root@station1 ~]# yum list installed | grep zip


bzip2.x86_64 1.0.6-26.el8
@anaconda
bzip2-libs.x86_64 1.0.6-26.el8
@anaconda
gzip.x86_64 1.9-4.el8
@anaconda
unzip.x86_64 6.0-41.el8
@anaconda
zip.x86_64 3.0-23.el8
@anaconda
[root@station1 ~]#
[root@station1 ~]# yum list installed zip
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
Installed Packages
zip.x86_64 3.0-23.el8
@anaconda
[root@station1 ~]#

[root@station1 ~]# yum install ftp -y

[root@station1 ~]# yum list installed ftp


Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
Installed Packages
ftp.x86_64 0.17-78.el8
@secondurl
[root@station1 ~]#
[root@station1 ~]#
[root@station1 ~]#
[root@station1 ~]# yum remove ftp -y

[root@station1 ~]# yum history


Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
ID | Command line | Date and time | Action(s)
| Altered
----------------------------------------------------------------------
---------
7 | remove ftp -y | 2019-10-17 19:33 | Removed
| 1
6 | install ftp -y | 2019-10-17 19:33 | Install
| 1
5 | install http* -y | 2019-10-17 19:29 | Install
| 28
4 | install samba* -y | 2019-10-17 19:29 | Install
| 14
3 | install targetcli -y | 2019-10-17 19:28 | Install
| 7
2 | install vsftpd -y | 2019-10-17 19:28 | Install
| 1
1 | | 2019-09-11 11:49 | Install
| 1336 EE
[root@station1 ~]#
Step-4 How to Use GPG key concepts in YUM ?

[root@station1 ~]# ls /redhatdvd


AppStream EFI extra_files.json images media.repo
RPM-GPG-KEY-redhat-release
BaseOS EULA GPL isolinux RPM-GPG-KEY-redhat-beta
TRANS.TBL
[root@station1 ~]#
[root@station1 ~]# cat /redhatdvd/RPM-GPG-KEY-redhat-release
[root@station1 ~]# vim /etc/yum.repos.d/dvd.repo

change in this file with required parameters .....

[firsturl]
name=this is local yum for baseos directory.
baseurl=file:///redhatdvd/BaseOS
enabled=1
gpgcheck=1
gpgkey=file:///redhatdvd/RPM-GPG-KEY-redhat-release

[secondurl]
name=this is my local yum for appstream directory.
baseurl=file:///redhatdvd/AppStream
enabled=1
gpgcheck=1
gpgkey=file:///redhatdvd/RPM-GPG-KEY-redhat-release

save and quit from this file.

[root@station1 ~]# yum clean all


Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
12 files removed
[root@station1 ~]#
[root@station1 ~]# yum repolist
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
this is local yum for baseos directory.
257 MB/s | 2.2 MB 00:00
this is my local yum for appstream directory.
269 MB/s | 5.3 MB 00:00
Last metadata expiration check: 0:00:01 ago on Thu 17 Oct 2019
07:39:59 PM IST.
repo id repo name
status
firsturl this is local yum for
baseos directory. 1,658
secondurl this is my local yum for
appstream directory. 4,672
[root@station1 ~]#

[root@station1 ~]# yum install lftp


[root@station1 ~]# yum install dhcp* -y

Step-5 How to create repodata manually ...?

[root@station1 ~]# yum install createrepo -y

[root@station1 ~]# rm -rf /redhatdvd/AppStream/repodata


[root@station1 ~]# rm -rf /redhatdvd/BaseOS/repodata
[root@station1 ~]# ls /redhatdvd/AppStream
[root@station1 ~]# ls /redhatdvd/BaseOS
[root@station1 ~]# yum clean all
[root@station1 ~]# yum repolist
[root@station1 ~]# createrepo -v /redhatdvd/BaseOS

[root@station1 ~]# ls /redhatdvd/BaseOS


[root@station1 ~]# ls /redhatdvd/BaseOS/repodata

[root@station1 ~]# createrepo -v /redhatdvd/AppStream

[root@station1 ~]# yum repolist


Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
this is local yum for baseos directory.
264 MB/s | 2.1 MB 00:00
this is my local yum for appstream directory.
267 MB/s | 5.1 MB 00:00
repo id repo name
status
firsturl this is local yum for
baseos directory. 1,660
secondurl this is my local yum for
appstream directory. 4,987
[root@station1 ~]#

Second method:---

Step-6 How to Configure YUM using yum-config-manager command


[root@station1 ~]# cd /redhatdvd/BaseOS
[root@station1 BaseOS]#
[root@station1 BaseOS]# cd Packages
[root@station1 Packages]#
[root@station1 Packages]# rpm -ivh dnf-utils-4.0.2.2-3.el8.noarch.rpm
Verifying...
################################# [100%]
Preparing...
################################# [100%]
Updating / installing...
1:dnf-utils-4.0.2.2-3.el8
################################# [100%]
[root@station1 Packages]# cd
[root@station1 ~]#
[root@station1 ~]# rm -rf /etc/yum.repos.d/dvd.repo
[root@station1 ~]#
[root@station1 ~]# yum repolist
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
No repositories available
[root@station1 ~]#
[root@station1 ~]#
[root@station1 ~]#
[root@station1 ~]# yum-config-manager --add-
repo=file:///redhatdvd/BaseOS

Updating Subscription Management repositories.


Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
Adding repo from: file:///redhatdvd/BaseOS

[root@station1 ~]#
[root@station1 ~]#
[root@station1 ~]# yum-config-manager --add-
repo=file:///redhatdvd/AppStream

Updating Subscription Management repositories.


Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
Adding repo from: file:///redhatdvd/AppStream
[root@station1 ~]#
[root@station1 ~]#
[root@station1 ~]#
[root@station1 ~]# ls /etc/yum.repos.d
redhatdvd_AppStream.repo redhatdvd_BaseOS.repo redhat.repo
[root@station1 ~]#
[root@station1 ~]# cat /etc/yum.repos.d/redhatdvd_AppStream.repo
[redhatdvd_AppStream]
name=created by dnf config-manager from file:///redhatdvd/AppStream
baseurl=file:///redhatdvd/AppStream
enabled=1
[root@station1 ~]#

[root@station1 ~]# echo "gpgcheck=0" >>


/etc/yum.repos.d/redhatdvd_AppStream.repo
[root@station1 ~]#
[root@station1 ~]# echo "gpgcheck=0" >>
/etc/yum.repos.d/redhatdvd_BaseOS.repo
[root@station1 ~]#
[root@station1 ~]# yum repolist
Updating Subscription Management repositories.
Unable to read consumer identity
This system is not registered to Red Hat Subscription Management. You
can use subscription-manager to register.
created by dnf config-manager from file:///redhatdvd/AppStream
241 MB/s | 5.1 MB 00:00
created by dnf config-manager from file:///redhatdvd/BaseOS
271 MB/s | 2.1 MB 00:00
Last metadata expiration check: 0:00:01 ago on Thu 17 Oct 2019
07:57:34 PM IST.
repo id repo name
status
redhatdvd_AppStream created by dnf config-manager
from file:///redhatdvd/AppStream 4,987
redhatdvd_BaseOS created by dnf config-manager
from file:///redhatdvd/BaseOS 1,660
[root@station1 ~]#

[root@station1 ~]# yum install bind -y

**************************************************

How to configure YUM by using any network based URL ?

all steps will be same , we will only change the Baseurl location...

**************************** Complete *********************

You might also like