Article sections

    출처: https://wnw1005.tistory.com/289 [씨실과 날실 – IT]

     

    기존 저장소 백업

    개별 압축 백업

    sudo bzip2 /etc/yum.repos.d/CentOS-*.repo

    기존 저장소 파일 확인

    [study@localhost ~]$ ls /etc/yum.repos.d
    CentOS-AppStream.repo  CentOS-Extras.repo      CentOS-Vault.repo
    CentOS-Base.repo       CentOS-Media.repo       CentOS-centosplus.repo
    CentOS-CR.repo         CentOS-PowerTools.repo  CentOS-fasttrack.repo
    CentOS-Debuginfo.repo  CentOS-Sources.repo
    [study@localhost ~]$
    

     

    저장소 파일 개별 압축 백업

    [study@localhost ~]$ sudo bzip2 /etc/yum.repos.d/CentOS-*.repo
    [sudo] study의 암호: 
    [study@localhost ~]$ 
    

     

    저장소 파일 개별 압축 백업 후 확인

    [study@localhost ~]$ ls /etc/yum.repos.d
    CentOS-AppStream.repo.bz2  CentOS-PowerTools.repo.bz2
    CentOS-Base.repo.bz2       CentOS-Sources.repo.bz2
    CentOS-CR.repo.bz2         CentOS-Vault.repo.bz2
    CentOS-Debuginfo.repo.bz2  CentOS-centosplus.repo.bz2
    CentOS-Extras.repo.bz2     CentOS-fasttrack.repo.bz2
    CentOS-Media.repo.bz2
    [study@localhost ~]$ 
    

     

    확장자 변경 백업

    $ sudo rename -v .repo .bak *.repo

    [study@localhost ~]$ cd /etc/yum.repos.d
    [study@localhost yum.repos.d]$ sudo rename -v .repo .bak *.repo
    [sudo] study의 암호: 
    `CentOS-AppStream.repo' -> `CentOS-AppStream.bak'
    `CentOS-Base.repo' -> `CentOS-Base.bak'
    `CentOS-CR.repo' -> `CentOS-CR.bak'
    `CentOS-Debuginfo.repo' -> `CentOS-Debuginfo.bak'
    `CentOS-Extras.repo' -> `CentOS-Extras.bak'
    `CentOS-Media.repo' -> `CentOS-Media.bak'
    `CentOS-PowerTools.repo' -> `CentOS-PowerTools.bak'
    `CentOS-Sources.repo' -> `CentOS-Sources.bak'
    `CentOS-Vault.repo' -> `CentOS-Vault.bak'
    `CentOS-centosplus.repo' -> `CentOS-centosplus.bak'
    `CentOS-fasttrack.repo' -> `CentOS-fasttrack.bak'
    [study@localhost yum.repos.d]$ 
    

    새로운 단일 저장소 설정 파일 생성

    gedit로 저장소(repo) 파일 편집

    $ sudo gedit

    [study@localhost yum.repos.d]$ sudo gedit
    

     

    gedit 실행 오류의 경우

    X11 디스플레이 서버로 구동하여 실행하면 위와 같은 문제 없이 실행됩니다.

    X11 디스플레이 서버는 리눅스의 전통적인 디스플레이 서버로써 오랬동안 그 역할을 해왔고 지금도 하고 있습니다. 따라서 오래 전에 설계된 시스템이라 현대의 컴퓨터 환경과는 잘 맞지 않을망정 반대로 오랬동안 개선되어 온 디스플레이 서버기 때문에 일반 사용자 입장에서 볼 때 안정화가 잘되어 있으며 문제가 생기더라도 지금까지 축적된 수많은 문제 해결책들을 토대로 손쉽게 해결할 수 있습니다.

    따라서 리눅스 초보라면 디스플레이 서버로 Xorg 스탠다드(X11 디스플레이 서버)를 구동하시는 것을 권장합니다.

    이에 반해 Wayland 디스플레이 서버는 X11 디스플레이 서버를 대체하기 위해 2008년부터 개발이 시작된 디스플레이 서버입니다.

    사실 이 Wayland 디스플레이 서버는 하드웨어와의 약한 호환성과 불안정성 문제 등으로 널리 보급되지 않다가 데스크톱 환경 중 하나인 GNOME이 기본값으로 Wayland를 채택하면서 GNOME을 채택하고 있는 페도라, 데비안 등 많은 리눅스 배포판도 기본값으로 지원하게 되었습니다.

    그러나 솔직히 Wayland는 아직 앞서 언급한 호환성과 안정성 문제를 극복하지 못해 많은 문제를 일으키고 있습니다. 물론 예전보다는 굉장히 나아진 상태입니다.)

    그러나 리눅스 초보가 문제를 혼자서 해결하기에는 정보량이 굉장히 적어 추천드리지 않습니다.

    [study@localhost yum.repos.d]$ sudo gedit
    [sudo] study의 암호: 
    No protocol specified
    Unable to init server: 연결할 수 없습니다: 연결이 거부됨
    
    (gedit:????): Gtk-WARNING **: ??:??:??.???: cannot open display: :0
    [study@localhost yum.repos.d]$ 
    

    현재 CentOS 8은 기본 디스플레이 서버가 Wayland(스탠다드)로 설정 되어 있습니다.  이런 경우 관리자 권한으로 gedit 같은  GUI 프로그램을 실행하는 경우 위 메시지처럼 cannot open display: :0 오류 메시지를 출력하며 실행되지 않습니다.

    이것을 해결하기 위해서는 아래의 명령을 실행해주어야 합니다.

    $ xhost +SI:localuser:root

    위 명령은 관리자 권한(root) 사용자가 실행중인 X 서버에 액세스할 수 있도록 권한을 부여해주는 명령입니다.

    [study@localhost ~]$ xhost +SI:localuser:root
    localuser:root being added to access control list
    [study@localhost ~]$
    

    위 명령을 실행 후 관리자 권한(sudo)으로 gedit를 실행하면 문제 없이 실행되는 것을 확인할 수 있습니다.

    저장소 미러 주소 고정

    CentOS 8 단일 저장소 파일 생성

    CentOS 8의 저장소는 기본적으로 11의 저장소가 각각의 파일로 관리 됩니다. 하나의 파일 안에 모든 저장소 설정을 담는 것이 관리하기 편할 것입니다.

    국내에는 CentOS 미러 저장소로 포털사이트인 Kakao와 Naver 그리고 호스팅 업체인 Aonenetworks가 정식으로 등록되어 있으며 이외에도 다른 미러 서버가 존재할 수 있습니다.(만약 아시는 분들은 댓글로 알려주시기 바랍니다.)

    참고

    2020년 1월 6일 기준으로 부경대의 하루카상 서버는 애초에 CentOS 저장소를 구축하지 않았으며, 네오위즈 미러서버의 경우는 CentOS 7까지는 저장소를 운영하고 있으나 CentOS 8 저장소는 존재하지 않습니다.

    카카오 미러 : http://mirror.kakao.com

    네이버 미러 : http://mirror.navercorp.com

    Aone네트웍스 미러 : http://data.aonenetworks.kr

    개인적으로 카카오의 미러를 사용할 것을 추천드립니다.

    저장소 파일 생성

    파일명.repo

    위와 같은 형식으로 파일을 생성해주시면 됩니다. 확장자명을 .repo로 정해주시면 됩니다.

    기본 활성화 저장소

    [AppStream]
    name=CentOS-$releasever – AppStream
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra
    ##baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/
    baseurl=http://mirror.kakao.com/$contentdir/$releasever/AppStream/$basearch/os/
    gpgcheck=1
    enabled=1
    #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    gpgkey=http://mirror.kakao.com/centos/RPM-GPG-KEY-CentOS-Official

    [BaseOS]
    name=CentOS-$releasever – Base
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra
    ##baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/
    baseurl=http://mirror.kakao.com/$contentdir/$releasever/BaseOS/$basearch/os/
    gpgcheck=1
    enabled=1
    #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    gpgkey=http://mirror.kakao.com/centos/RPM-GPG-KEY-CentOS-Official

    [extras]
    name=CentOS-$releasever – Extras
    #mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
    ##baseurl=http://mirror.centos.org/$contentdir/$releasever/extras/$basearch/os/
    baseurl=http://mirror.kakao.com/$contentdir/$releasever/extras/$basearch/os/
    gpgcheck=1
    enabled=1
    #gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial
    gpgkey=http://mirror.kakao.com/centos/RPM-GPG-KEY-CentOS-Official

    기본 활성화 저장소 포함 추가 저장소 활성화

    기본값에서 수정할 내용

    기존의 mirrorlist=~, baseurl=~, gpgkey=~ 줄 주석처리

    baseurl=~, gpgkey=~ 줄을 원하는 미러의 주소를 적어 추가

    enabled=0을 enabled=1로 변경

    추가 저장소 역시 위 예시처럼 수정하여 내용을 추가해주시면 됩니다.

    CentOS 8 저장소 기본값은 /etc/yum.repos.d 디렉터리리 안의 파일들을 참고하시거나, 아래 링크를 참고하시기 바랍니다.


    외부 저장소 추가

    추천 저장소 추가

    EPEL 저장소 추가

    $ sudo dnf install epel-release

    [study@localhost ~]$ sudo dnf install epel-release
    [sudo] study의 암호: 
    CentOS-8 - AppStream                            1.6 kB/s | 4.3 kB     00:02    
    CentOS-8 - Base                                 1.6 kB/s | 3.9 kB     00:02    
    CentOS-8 - Extras                               646  B/s | 1.5 kB     00:02    
    종속성이 해결되었습니다.
    ================================================================================
     꾸러미                아키텍처        버전               리포지토리       크기
    ================================================================================
    Installing:
     epel-release          noarch          8-5.el8            extras           22 k
    
    거래 요약
    ================================================================================
    설치  1 꾸러미
    
    총 다운로드 크기 : 22 k
    설치 크기 : 30 k
    이게 괜찮습니까 [y / N] : y
    패키지 다운로드중:
    epel-release-8-5.el8.noarch.rpm                  21 kB/s |  22 kB     00:01    
    --------------------------------------------------------------------------------
    합계                                            9.1 kB/s |  22 kB     00:02     
    트랜잭션 점검 실행 중
    트랜잭션 검사가 성공했습니다.
    트랜잭션 테스트 실행 중
    트랜잭션 테스트가 완료되었습니다.
    거래 실행 중
      준비 중입니다  :                                                          1/1 
      Installing     : epel-release-8-5.el8.noarch                              1/1 
      스크립틀릿 실행: epel-release-8-5.el8.noarch                              1/1 
      확인 중        : epel-release-8-5.el8.noarch                              1/1 
    
    설치됨:
      epel-release-8-5.el8.noarch                                                   
    
    완료되었습니다!
    [study@localhost ~]$ 
    

    저장소 확인

    [study@localhost ~]$ dnf repolist
    Extra Packages for Enterprise Linux 8 - x86_64  1.0 MB/s | 5.1 MB     00:05    
    마지막 메타 데이터 만료 확인 : 0:00:05 전에 2020년 01월 05일 (일) 오후 01시 00분 00초.
    Repo ID            레포 이름                                               상태
    AppStream          CentOS-8 - AppStream                                    5,089
    BaseOS             CentOS-8 - Base                                         2,843
    *epel              Extra Packages for Enterprise Linux 8 - x86_64          4,352
    extras             CentOS-8 - Extras                                           3
    [study@localhost ~]$ 
    

    epel 관련 저장소 설정 파일 기본값

    epel 저장소 설정 파일 기본값

    [epel]
    name=Extra Packages for Enterprise Linux $releasever – $basearch
    #baseurl=https://download.fedoraproject.org/pub/epel/$releasever/Everything/$basearch
    metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-$releasever&arch=$basearch&infra=$infra&content=$contentdir
    failovermethod=priority
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever

    [epel-debuginfo]
    name=Extra Packages for Enterprise Linux $releasever – $basearch – Debug
    #baseurl=https://download.fedoraproject.org/pub/epel/$releasever/Everything/$basearch/debug
    metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-debug-$releasever&arch=$basearch&infra=$infra&content=$contentdir
    failovermethod=priority
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
    gpgcheck=1

    [epel-source]
    name=Extra Packages for Enterprise Linux $releasever – $basearch – Source
    #baseurl=https://download.fedoraproject.org/pub/epel/$releasever/Everything/SRPMS
    metalink=https://mirrors.fedoraproject.org/metalink?repo=epel-source-$releasever&arch=$basearch&infra=$infra&content=$contentdir
    failovermethod=priority
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
    gpgcheck=1

    epel-playground 저장소 설정 파일 기본값

    [epel-playground]
    name=Extra Packages for Enterprise Linux $releasever – Playground – $basearch
    #baseurl=https://download.fedoraproject.org/pub/epel/playground/$releasever/Everything/$basearch/os
    metalink=https://mirrors.fedoraproject.org/metalink?repo=playground-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
    failovermethod=priority
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever

    [epel-playground-debuginfo]
    name=Extra Packages for Enterprise Linux $releasever – Playground – $basearch – Debug
    #baseurl=https://download.fedoraproject.org/pub/epel/playground/$releasever/Everything/$basearch/debug
    metalink=https://mirrors.fedoraproject.org/metalink?repo=playground-debug-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
    failovermethod=priority
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
    gpgcheck=1

    [epel-playground-source]
    name=Extra Packages for Enterprise Linux $releasever – Playground – $basearch – Source
    #baseurl=https://download.fedoraproject.org/pub/epel/playground/$releasever/Everything/source/tree/
    metalink=https://mirrors.fedoraproject.org/metalink?repo=playground-source-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
    failovermethod=priority
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
    gpgcheck=1

    epel-testing 저장소 설정 파일 기본값

    [epel-testing]
    name=Extra Packages for Enterprise Linux $releasever – Testing – $basearch
    #baseurl=https://download.fedoraproject.org/pub/epel/testing/$releasever/Everything/$basearch
    metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
    failovermethod=priority
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever

    [epel-testing-debuginfo]
    name=Extra Packages for Enterprise Linux $releasever – Testing – $basearch – Debug
    #baseurl=https://download.fedoraproject.org/pub/epel/testing/$releasever/Everything/$basearch/debug
    metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-debug-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
    failovermethod=priority
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
    gpgcheck=1

    [epel-testing-source]
    name=Extra Packages for Enterprise Linux $releasever – Testing – $basearch – Source
    #baseurl=https://download.fedoraproject.org/pub/epel/testing/$releasever/Everything/SRPMS
    metalink=https://mirrors.fedoraproject.org/metalink?repo=testing-source-epel$releasever&arch=$basearch&infra=$infra&content=$contentdir
    failovermethod=priority
    enabled=0
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-$releasever
    gpgcheck=1

    Remi 저장소 추가

    Remi 저장소 공식 블로그

    https://rpms.remirepo.net/

    패키지 설치 마법사

    https://rpms.remirepo.net/wizard/

    sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm

    epel-release 패키지(Remi 저장소)는 epel-release에 종속성 관계가 있습니다. 따라서 Remi 저장소를 설치하기 위해서는 epel-release 패키지가 이미 설치되어 있거나 또는 같이 설치해주어야 합니다.

    [study@localhost ~]$ sudo dnf install https://rpms.remirepo.net/enterprise/remi-release-8.rpm
    [sudo] study의 암호: 
    마지막 메타 데이터 만료 확인 : 0:20:00 전에 2020년 01월 05일 (일) 오후 01시 20분 00초.
    remi-release-8.rpm                              8.2 kB/s |  20 kB     00:02    
    종속성이 해결되었습니다.
    ================================================================================
     꾸러미             아키텍처     버전                  리포지토리          크기
    ================================================================================
    Installing:
     remi-release       noarch       8.0-4.el8.remi        @commandline        20 k
    
    거래 요약
    ================================================================================
    설치  1 꾸러미
    
    총합 크기: 20 k
    설치 크기 : 14 k
    이게 괜찮습니까 [y / N] : y
    패키지 다운로드중:
    트랜잭션 점검 실행 중
    트랜잭션 검사가 성공했습니다.
    트랜잭션 테스트 실행 중
    트랜잭션 테스트가 완료되었습니다.
    거래 실행 중
      준비 중입니다  :                                                          1/1 
      Installing     : remi-release-8.0-4.el8.remi.noarch                       1/1 
      확인 중        : remi-release-8.0-4.el8.remi.noarch                       1/1 
    
    설치됨:
      remi-release-8.0-4.el8.remi.noarch                                            
    
    완료되었습니다!
    [study@localhost ~]$ 
    

     

    저장소 확인

    [study@localhost ~]$ dnf repolist
    Remi's Modular repository for Enterprise Linux   52 kB/s | 527 kB     00:10    
    Safe Remi's RPM repository for Enterprise Linux  90 kB/s | 1.4 MB     00:15    
    Repo ID       레포 이름                                                    상태
    AppStream     CentOS-8 - AppStream                                         5,089
    BaseOS        CentOS-8 - Base                                              2,843
    *epel         Extra Packages for Enterprise Linux 8 - x86_64               4,352
    extras        CentOS-8 - Extras                                                3
    remi-modular  Remi's Modular repository for Enterprise Linux 8 - x86_64       14
    remi-safe     Safe Remi's RPM repository for Enterprise Linux 8 - x86_64   2,092
    [study@localhost ~]$ 
    

    위 내용을 보면 아시겠지만 remi 저장소가 활성화되지 않으 것을 알 수 있습니다.

    remi 저장소는 설치해도 기본적으로 활성화 되지 않으므로  /etc/yum.repos.d/remi.repo 에서 enabled=1 로 설정해야 합니다.

    Remi 관련 저장소 설정 파일 기본값

    Remi  저장소 설정 파일 기본값

    # Repository: https://rpms.remirepo.net/
    # Blog:       https://blog.remirepo.net/
    # Forum:      https://forum.remirepo.net/

    [remi]
    name=Remi’s RPM repository for Enterprise Linux 8 – $basearch
    #baseurl=http://rpms.remirepo.net/enterprise/8/remi/$basearch/
    #mirrorlist=https://rpms.remirepo.net/enterprise/8/remi/$basearch/httpsmirror
    mirrorlist=http://cdn.remirepo.net/enterprise/8/remi/$basearch/mirror
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8

    [remi-test]
    name=Remi’s test RPM repository for Enterprise Linux 8 – $basearch
    #baseurl=http://rpms.remirepo.net/enterprise/8/test/$basearch/
    #mirrorlist=https://rpms.remirepo.net/enterprise/8/test/$basearch/mirror
    mirrorlist=http://cdn.remirepo.net/enterprise/8/test/$basearch/mirror
    # WARNING: If you enable this repository, you must also enable “remi”
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8

    [remi-debuginfo]
    name=Remi’s RPM repository for Enterprise Linux 8 – $basearch – debuginfo
    baseurl=http://rpms.remirepo.net/enterprise/8/debug-remi/$basearch/
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8

    [remi-test-debuginfo]
    name=Remi’s test RPM repository for Enterprise Linux 8 – $basearch – debuginfo
    baseurl=http://rpms.remirepo.net/enterprise/8/debug-test/$basearch/
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8

    Remi-modular 저장소 설정 파일 기본값

    # Repository: https://rpms.remirepo.net/
    # Blog:       https://blog.remirepo.net/
    # Forum:      https://forum.remirepo.net/

    [remi-modular]
    name=Remi’s Modular repository for Enterprise Linux 8 – $basearch
    #baseurl=http://rpms.remirepo.net/enterprise/8/modular/$basearch/
    #mirrorlist=https://rpms.remirepo.net/enterprise/8/modular/$basearch/httpsmirror
    mirrorlist=http://cdn.remirepo.net/enterprise/8/modular/$basearch/mirror
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8

    [remi-modular-test]
    name=Remi’s Modular testing repository for Enterprise Linux 8 – $basearch
    #baseurl=http://rpms.remirepo.net/enterprise/8/modular-test/$basearch/
    #mirrorlist=https://rpms.remirepo.net/enterprise/8/modular-test/$basearch/httpsmirror
    mirrorlist=http://cdn.remirepo.net/enterprise/8/modular-test/$basearch/mirror
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8

    Remi-safe 저장소 설정 파일 기본값

    # This repository is safe to use with RHEL/CentOS base repository
    # it only provides additional packages for the PHP stack
    # all dependencies are in base repository or in EPEL

    [remi-safe]
    name=Safe Remi’s RPM repository for Enterprise Linux 8 – $basearch
    #baseurl=http://rpms.remirepo.net/enterprise/8/safe/$basearch/
    #mirrorlist=https://rpms.remirepo.net/enterprise/8/safe/$basearch/httpsmirror
    mirrorlist=http://cdn.remirepo.net/enterprise/8/safe/$basearch/mirror
    enabled=1
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8

    [remi-safe-debuginfo]
    name=Remi’s RPM repository for Enterprise Linux 8 – $basearch – debuginfo
    baseurl=http://rpms.remirepo.net/enterprise/8/debug-remi/$basearch/
    enabled=0
    gpgcheck=1
    gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-remi.el8

     

    in Server Doc