ABOUT ME

-

Today
-
Yesterday
-
Total
-
  • [CentOS7/Rocky8] local-repo + docker-ce repo 생성하기
    Linux 2025. 3. 21. 12:17

    폐쇄망 환경에서 Kubernetes를 설치할 때 필요한 로컬 레포지토리 및 Docker CE 레포지토리를 온라인 환경에서 준비했던 방법입니다.

    [K8S][폐쇄망]Kubespray로 Kubernetes 설치하기 - CentOS7/Rocky8

     

     

     

     

    Local Repo 

    repposync 대상은 apppstream, baseos, epel 입니다.

    (GPU를 사용하지 않는다면 epel.tar.gz 파일을 제외해도 Kubernetes 설치에는 문제가 없습니다.)

     

     

    • 시스템에서 활성화된 yum 레포지토리 목록 확인
    yum repolist

     

     

    • 도구 설치 및 폴더 생성
    yum install httpd createrepo yum-utils
    
    mkdir /var/www/html/repos

     

     

    • reposync를 이용해 rehat 시스템 계열의 rpm 패키지 다운로드
    # reposync -m --repoid=[repoid] --newest-only --download-metadata -p /var/www/html/repo/ 
    
    # Rocky
    reposync --repoid=baseos --download-metadata --downloadcomps -p /var/www/html/repos/ && \
    reposync --repoid=appstream --download-metadata --downloadcomps -p /var/www/html/repos/ && \
    reposync --repoid=epel --download-metadata --downloadcomps -p /var/www/html/repos/ && \
    reposync --repoid=extra --download-metadata --downloadcomps -p /var/www/html/repos/
    
    # CentOS
    reposync -g -l -d -m --repoid=base --newest-only --download-metadata --download_path=/var/www/html/repos/ && \
    reposync -g -l -d -m --repoid=centosplus --newest-only --download-metadata --download_path=/var/www/html/repos/ && \
    reposync -g -l -d -m --repoid=extras --newest-only --download-metadata --download_path=/var/www/html/repos/ && \
    reposync -g -l -d -m --repoid=updates --newest-only --download-metadata --download_path=/var/www/html/repos/

     

     

    • 로컬 yum 레포지토리 및 메타데이터 생성
    createrepo -g comps.xml /var/www/html/repos/[repoid]/

     

     

    • 파일 압축
    cd /var/www/html/repo
    
    tar cvf baseos.tar.gz baseos
    tar cvf appstream.tar.gz appstream
    tar cvf epel.tar.gz epel

     

     

     

     

    Docker CE Repo

     

     

    • packages, repodata 압축
    wget --recursive --no-parent --reject "index.html*" https://download.docker.com/linux/centos/8/x86_64/stable
    tar cvf docker-ce.tar.gz docker-ce

     

     

Designed by Tistory.