IT

yum local repository 설정

Twinit 2026. 2. 27. 09:58
반응형

yum local repository 설정하는 방법

 

OS : RHEL 8.9 / Fedora 운영체제

 

해당하는 운영체제 OS ISO 파일을 시스템에 업로드 한다.

 

[root@rhel89 ~]# ls -l rhel-8.9-x86_64-dvd.iso 
-rw-r--r--. 1 root root 13516144640 Feb 27 09:31 rhel-8.9-x86_64-dvd.iso
[root@rhel89 ~]# 

 

해당 파일을 Mount하여 사용할 수 있도록 한다.

[root@rhel89 ~]# mkdir /repo_iso
[root@rhel89 ~]# mount -t iso9660 -o ro ./rhel-8.9-x86_64-dvd.iso /repo_iso
[root@rhel89 ~]# df -h /repo_iso
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0       13G   13G     0 100% /repo_iso
[root@rhel89 ~]# 

 

시스템 재부팅 시에도 사용할 수 있도록 /etc/fstab 파일에 정의한다.

 

 echo "/root/rhel-8.9-x86_64-dvd.iso   /repo_iso       iso9660 loop 0 0" >> /etc/fstab

 

설정 내용의 정상 확인을 위해 umount /mount 명령을 사용하여 확인한다.

 

[root@rhel89 ~]# df -h /repo_iso
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0       13G   13G     0 100% /repo_iso
[root@rhel89 ~]# umount /repo_iso
[root@rhel89 ~]# df -h /repo_iso
Filesystem                    Size  Used Avail Use% Mounted on
/dev/mapper/rhel_rhel89-root   40G   22G   19G  54% /
[root@rhel89 ~]# mount /repo_iso
mount: /repo_iso: WARNING: device write-protected, mounted read-only.
[root@rhel89 ~]# df -h /repo_iso
Filesystem      Size  Used Avail Use% Mounted on
/dev/loop0       13G   13G     0 100% /repo_iso
[root@rhel89 ~]# 

 

yum 설정을 위해 /etc/yum.repo.d/local.repo 파일을 생성

[root@rhel89 ~]# cat /etc/yum.repos.d/local.repo 
[rhel-BaseOS]

name=BaseOS

baseurl=file:///repo_iso/BaseOS/

gpgcheck=0

Enabled=1

 

[rhel-AppStream]

name=AppStream

baseurl=file:///repo_iso/AppStream/

gpgcheck=0

Enabled=1
[root@rhel89 ~]#

 

기존 yum 설정을 지운다.

[root@rhel89 ~]# yum clean all
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

22 files removed
[root@rhel89 ~]#

 

yum 동작 확인

[root@rhel89 ~]# yum list
Updating Subscription Management repositories.
Unable to read consumer identity

This system is not registered with an entitlement server. You can use subscription-manager to register.

BaseOS                                                                                                                                                                                                    16 MB/s | 2.4 MB     00:00    
AppStream                                                                                                                                                                                                 37 MB/s | 8.3 MB     00:00  

 

끄읕

반응형