목차

    반응형

    redhat 패키지들은 기본적으로 온라인으로 제공되는데 고객사가 외부통신이 되지 않는 경우가 많다. 따라서 필요한 패키지들을 다운받아서 고객사로 들고 가는 경우가 많은데, redhat 8부터는 기존과 명령어들이 변경 되어, 정리해 보도록 하자

    테스트 환경은 아래와 같다.

    [root@localhost yum.repos.d]# cat /etc/redhat-release

    Red Hat Enterprise Linux release 8.2 (Ootpa)

    1. subscription 등록

    레드햇을 subscription을 등록 하고 repository를 다운 받을 수 있다. 우선 cd에서 제공되는 기본 rpm (package)는 ISO CD를 마운트하여, 사용하면 된다. 나는 openstack package를 받기 위해 사용하였다.

     

    [root@localhost ~]# subscription-manager list --available --all --matches="Red Hat OpenStack"

    Registering to: subscription.rhsm.redhat.com:443/subscription
    Username: 레드햇계정
    Password: 비밀번호
    The system has been registered with ID: acae7ca4-e0ac-4fb6-a7e6-da8ce74f60ca
    The registered system name is: localhost.localdomain

    2.openstack pool 검색 및 등록

    [root@localhost ~]# subscription-manager list --available --all --matches="Red Hat OpenStack"

    +-------------------------------------------+
    Available Subscriptions
    +-------------------------------------------+
    Subscription Name: Red Hat OpenStack Platform, Standard (2-sockets)
    Provides: dotNET on RHEL Beta (for RHEL Server)
    Red Hat CodeReady Linux Builder for x86_64
    Red Hat Ansible Engine
    Red Hat Ceph Storage
    Red Hat CodeReady Linux Builder for Power, little endian
    Red Hat Enterprise Linux Atomic Host Beta
    Red Hat Enterprise Linux Fast Datapath
    Red Hat Developer Tools Beta (for RHEL Server for IBM Power 9)
    Red Hat OpenStack Beta
    Red Hat CloudForms
    Red Hat Enterprise Linux Load Balancer (for RHEL Server)
    Red Hat Enterprise Linux Advanced Virtualization Beta
    Red Hat Beta
    Red Hat Enterprise Linux High Availability for x86_64
    Red Hat Single Sign-On
    dotNET on RHEL (for RHEL Server)
    Red Hat Ceph Storage Calamari
    Red Hat Enterprise Linux Advanced Virtualization
    Red Hat Enterprise Linux High Availability for x86_64 - Extended Update Support
    Oracle Java (for RHEL Server)
    Red Hat Enterprise Linux for Power, little endian - Extended Update Support
    Red Hat Software Collections (for RHEL Server)
    Red Hat Enterprise Linux for Power, little endian
    Red Hat OpenStack
    Red Hat Enterprise Linux Atomic Host
    Red Hat Enterprise Linux Fast Datapath Beta for x86_64
    Red Hat Enterprise MRG Messaging
    Red Hat Software Collections Beta (for RHEL Server)
    Red Hat Enterprise Linux Server
    Red Hat Enterprise Linux for x86_64
    Red Hat Enterprise Linux for x86_64 - Extended Update Support
    Red Hat Ceph Storage MON
    Red Hat Software Collections (for RHEL Server for IBM Power 9)
    SKU: MCT2887F3
    Contract: 11600813
    Pool ID: 8a85f98c6163690b0161639abcf70e32
    Provides Management: No
    Available: Unlimited
    Suggested: 1
    Service Type: L1-L3
    Roles:
    Service Level: Standard
    Usage:
    Add-ons:
    Subscription Type: Stackable
    Starts: 01/15/2018
    Ends: 01/14/2021
    Entitlement Type: Virtual

    [root@localhost ~]# subscription-manager attach --pool=8a85f98c6163690b0161639abcf70e32

    [root@localhost ~]# subscription-manager repos --disable=*

    [root@localhost ~]# subscription-manager repos --enable=rhel-8-for-x86_64-baseos-rpms --enable=rhel-8-for-x86_64-appstream-rpms --enable=rhel-8-for-x86_64-highavailability-rpms --enable=ansible-2.8-for-rhel-8-x86_64-rpms --enable=openstack-16-for-rhel-8-x86_64-rpms --enable=fast-datapath-for-rhel-8-x86_64-rpms

    Repository 'rhel-8-for-x86_64-baseos-rpms' is enabled for this system.
    Repository 'rhel-8-for-x86_64-appstream-rpms' is enabled for this system.
    Repository 'rhel-8-for-x86_64-highavailability-rpms' is enabled for this system.
    Repository 'ansible-2.8-for-rhel-8-x86_64-rpms' is enabled for this system.
    Repository 'openstack-16-for-rhel-8-x86_64-rpms' is enabled for this system.
    Repository 'fast-datapath-for-rhel-8-x86_64-rpms' is enabled for this system.

    3. reposync install

    reposync는 외부 repository 를 내부로 sync하는 것으로 생각하면 되는데, redhat 7과 redhat 8은 rpm 이름이 변경 되었다.

    #rhel 7 기준

    [root@localhost ~]# yum -y install reposync

    #rhel 8 기준

    [root@localhost ~]# yum -y install dnf-plugins-core

     

    4. reposync 실행

    [root@localhost ~]# mkdir /repos

    [root@localhost ~]# cd /repos/

    [root@localhost repos]# vi reposync.sh

    #rhel 7 기준
    reposync -n --repoid=ansible-2.8-for-rhel-8-x86_64-rpms
    reposync -n --repoid=fast-datapath-for-rhel-8-x86_64-rpms
    reposync -n --repoid=openstack-16-for-rhel-8-x86_64-rpms
    reposync -n --repoid=rhel-8-for-x86_64-appstream-rpms
    reposync -n --repoid=rhel-8-for-x86_64-baseos-rpms
    reposync -n --repoid=rhel-8-for-x86_64-highavailability-rpms

    #rhel 8 기준
    dnf reposync -n --repoid=ansible-2.8-for-rhel-8-x86_64-rpms
    dnf reposync -n --repoid=fast-datapath-for-rhel-8-x86_64-rpms
    dnf reposync -n --repoid=openstack-16-for-rhel-8-x86_64-rpms
    dnf reposync -n --repoid=rhel-8-for-x86_64-appstream-rpms
    dnf reposync -n --repoid=rhel-8-for-x86_64-baseos-rpms
    dnf reposync -n --repoid=rhel-8-for-x86_64-highavailability-rpms

    [root@localhost repos]# sh reposync.sh

    =========================생략============
    (58/62):pacemaker-cts-2.0.3-5.el8_2.1.noarch.rpm 1.2 MB/s | 2.0 MB 00:01
    (59/62):pacemaker-remote-2.0.3-5.el8_2.1.x86_64.rpm 92 kB/s | 120 kB 00:01
    (60/62):pacemaker-libs-devel-2.0.3-5.el8_2.1.x86_64.rpm 99 kB/s | 138 kB 00:01
    (61/62):resource-agents-aliyun-4.1.1-44.el8_2.3.x86_64.rpm 2.6 MB/s | 6.8 MB 00:02
    (62/62):pcs-0.10.4-6.el8_2.1.x86_64.rpm 4.8 MB/s | 12 MB 00:02

    [root@localhost repos]# ls

    ansible-2.8-for-rhel-8-x86_64-rpms openstack-16-for-rhel-8-x86_64-rpms rhel-8-for-x86_64-appstream-rpms rhel-8-for-x86_64-highavailability-rpms fast-datapath-for-rhel-8-x86_64-rpms reposync.sh rhel-8-for-x86_64-baseos-rpm

    해당 패키지들이 디렉토리 상태로 다운로드 된 것을 확인 할 수 있다.

     

    5. createrepo install

    다운로드된 repository (rpm 묶음)을 이제 다시 repo로 만들어주어야 한다. repo를 사용하기 위해 directory 별로 repodata라는 것을 생성 해줘야하는데 createrepo 패키지를 다운 받아줘야 한다

    [root@localhost repos]# yum -y install createrepo_c

    =====================생략=======================
    Verifying:createrepo_c-0.15.1-2.el8.x86_64 3/3
    Installed products updated.

    Installed:
    createrepo_c-0.15.1-2.el8.x86_64createrepo_c-libs-0.15.1-2.el8.x86_64 drpm-0.4.1-1.el8.x86_64
    Complete!

    6. create repo

    [root@localhost repos]# vi repodata.sh

    createrepo ansible-2.8-for-rhel-8-x86_64-rpms
    createrepo fast-datapath-for-rhel-8-x86_64-rpms
    createrepo openstack-16-for-rhel-8-x86_64-rpms
    createrepo rhel-8-for-x86_64-appstream-rpms
    createrepo rhel-8-for-x86_64-baseos-rpms
    createrepo rhel-8-for-x86_64-highavailability-rpms

    [root@localhost repos]# sh repodata.sh

    Directory walk started
    Directory walk done - 2 packages
    Temporary output repo path: ansible-2.8-for-rhel-8-x86_64-rpms/.repodata/
    Preparing sqlite DBs
    Pool started (with 5 workers)
    Pool finished
    Directory walk started
    Directory walk done - 28 packages
    Temporary output repo path: fast-datapath-for-rhel-8-x86_64-rpms/.repodata/
    Preparing sqlite DBs
    Pool started (with 5 workers)
    Pool finished
    Directory walk started
    Directory walk done - 754 packages
    Temporary output repo path: openstack-16-for-rhel-8-x86_64-rpms/.repodata/
    Preparing sqlite DBs
    Pool started (with 5 workers)
    Pool finished
    Directory walk started
    Directory walk done - 5399 packages
    Temporary output repo path: rhel-8-for-x86_64-appstream-rpms/.repodata/
    Preparing sqlite DBs
    Pool started (with 5 workers)

     

    [root@localhost repos]# cd ansible-2.8-for-rhel-8-x86_64-rpms/

    [root@localhost ansible-2.8-for-rhel-8-x86_64-rpms]# ls

    Packages repodata

    repodata라는 디렉토리가 각 패키지 디렉토리 별로 되었는지 확인.

     

    7. local repository

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

    [root@localhost yum.repos.d]# vi OSP.repo

    OSP라는 이름은 임의로 했으며, 뒤에 .repo는 무조건 해줘야 repo로 사용 가능 하다

    [rhel-8-server-baseos-rpms]
    name=rhel-8-server-baseos-rpms
    baseurl=file:///repos/rhel-8-for-x86_64-baseos-rpms
    gpgcheck=0
    enabled=1

    [rhel-8-server-appstream-rpms]
    name=rhel-8-server-appstream-rpms
    baseurl=file:///repos/rhel-8-for-x86_64-appstream-rpms
    gpgcheck=0
    enabled=1

    [rhel-8-server-openstack-16-rpms]
    name=rhel-8-server-openstack-16-rpms
    baseurl=file:///repos/openstack-16-for-rhel-8-x86_64-rpms
    gpgcheck=0
    enabled=1

    [ha-for-rhel-8-server-rpms]
    name=ha-for-rhel-8-server-rpms
    baseurl=file:///repos/rhel-8-for-x86_64-highavailability-rpms
    gpgcheck=0
    enabled=1

    [rhel-8-ansible-2.8]
    name=rhel-8-ansible-2.8
    baseurl=file:///repos/ansible-2.8-for-rhel-8-x86_64-rpms
    gpgcheck=0
    enabled=1

    [rhel-fast-datapath-rhel-8-server-rpms]
    name=rhel-fast-datapath-rhel-8-server-rpms
    baseurl=file:///repos/fast-datapath-for-rhel-8-x86_64-rpms
    gpgcheck=0
    enabled=1

    이후 subscription을 제거 하고

     

    [root@localhost yum.repos.d]# subscription-manager clean

    [root@localhost yum.repos.d]# yum clean all

    [root@localhost yum.repos.d]# yum repolist

    Updating Subscription Management repositories.
    Unable to read consumer identity
    /usr/lib/python3.6/site-packages/dateutil/parser/_parser.py:70: UnicodeWarning: decode() called on unicode string, see https://bugzilla.redhat.com/show_bug.cgi?id=1693751
    instream = instream.decode()

    This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
    repo id repo name
    ha-for-rhel-8-server-rpms ha-for-rhel-8-server-rpms
    rhel-8-ansible-2.8 rhel-8-ansible-2.8
    rhel-8-server-appstream-rpms rhel-8-server-appstream-rpms
    rhel-8-server-baseos-rpms rhel-8-server-baseos-rpms
    rhel-8-server-openstack-16-rpms rhel-8-server-openstack-16-rpms
    rhel-fast-datapath-rhel-8-server-rpms rhel-fast-datapath-rhel-8-server-rpms

    로컬 레포지토리가 생성 된 것을 확인 할 수 있다.

     

    필요한 패키지들을 tar로 묶어서 고객사에 가져가서 설치 하면 된다.

    반응형
    • 네이버 블러그 공유하기
    • 네이버 밴드에 공유하기
    • 페이스북 공유하기
    • 카카오스토리 공유하기