Local yum repository(CentOS8) 사용하기

hanim·2022년 8월 16일
0

CentOS

목록 보기
1/2
post-thumbnail

개요

인터넷을 사용할수 없는 상황에서 yum 을 사용하기 위해
iso파일을 이용하여 local yum repository를 만들어 yum을 사용한다.

1. 마운트

  1. iso 파일을 서버로 옮겼을때
    rhel-8.2-x86_64-dvd.iso 파일을 /root에 복사
mount -t iso9660 -o loop /root/rhel-8.2-x86_64-dvd.iso /media 

2.iodd 나 CD 롬에 이미지를 넣었을때

mount /dev/sr0 /media
  • media 폴더에 mount 된 상태로 사용하거나
    추가적으로 dir 를 생성하여 사용한다.

    mkdir /repository -> 폴더를 생성하고
    cp -a /media/* /repository/ -> 마운트 시킨 내용을 repository 에 복사

2. repo 파일 만들기

  1. 기존 repo 파일 백업
    /etc/yum.repos.d/ 디렉토리에 있는 모든 파일을 백업폴더를 생성하여 옮겨 놓는다
  1. Centos8.repo 파일을 만든다.
vi /etc/yum.repos.d/Centos8.repo 
  1. Centos8.repo 내부 작성내용

      [LocalBase]
      name=LocalBase
      baseurl=file:///media/BaseOS/
      gpgcheck=0
    
      [LocalAppStream]
      name=LocalAppStream
      baseurl=file:///media/AppStream/
      gpgcheck=0

3. 동작확인

[root@localhost yum.repos.d]# dnf clean all 
  • dnf클린 (8버전부터는 yum 말고 dnf 를 씁니다.)
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.

0 files removed

[root@localhost yum.repos.d]# subscription-manager clean 
로컬 데이터가 모두 삭제되었습니다

[root@localhost yum.repos.d]yum grouplist
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.

CentOS Linux 8 - BaseOS 222 MB/s | 2.3 MB 00:00

CentOS Linux 8 - AppStream 121 MB/s | 5.8 MB 00:00
profile
개발자가 되려는 개발자

0개의 댓글