본문 바로가기

리눅스

[draft] CentOS 7에서 기본 저장소를 변경하는 방법

728x90

CentOS 7에서 기본 저장소를 변경하는 방법(yum repository)

기본 저장소

  • CentOS-Base.repo(/etc/yum.repos.d/CentOS-Base.repo)
cat /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the 
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

yum repository 국내 mirror 설정

카카오 저장소

  • 카카오 미러 저장소 : mirror.kakao.com
sed -i -E 's/^mirrorlist(.*)/#mirrorlist\1/g' CentOS-Base.repo
sed -i 's/^#baseurl=http:\/\/mirror.centos.org/baseurl=https:\/\/mirror.kakao.com/g' CentOS-Base.repo
vim /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#
[base]
name=CentOS-$releasever - Base
baseurl=https://mirror.kakao.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirror.kakao.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirror.kakao.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirror.kakao.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

네이버 저장소

  • 네이버 미러 저장소 : mirror.navercorp.com
sed -i -E 's/^mirrorlist(.*)/#mirrorlist\1/g' CentOS-Base.repo
sed -i 's/^#baseurl=http:\/\/mirror.centos.org/baseurl=https:\/\/mirror.navercorp.com/g' CentOS-Base.repo
728x90
vim /etc/yum.repos.d/CentOS-Base.repo
# CentOS-Base.repo
#

[base]
name=CentOS-$releasever - Base
baseurl=https://mirror.navercorp.com/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#released updates 
[updates]
name=CentOS-$releasever - Updates
baseurl=https://mirror.navercorp.com/centos/$releasever/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras
baseurl=https://mirror.navercorp.com/centos/$releasever/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus
baseurl=https://mirror.navercorp.com/centos/$releasever/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7

캐시된 데이터 제거

yum clean all
$ yum clean all
Loaded plugins: fastestmirror
Cleaning repos: base extras mariadb updates
Cleaning up list of fastest mirrors

메타데이터 캐시 생성

yum makecache
$ yum makecache
Loaded plugins: fastestmirror
Determining fastest mirrors
base                                                                            | 3.6 kB  00:00:00     
extras                                                                          | 2.9 kB  00:00:00     
mariadb                                                                         | 3.4 kB  00:00:00     
updates                                                                         | 2.9 kB  00:00:00     
(1/14): base/7/x86_64/group_gz                                                  | 153 kB  00:00:00     
(2/14): base/7/x86_64/primary_db                                                | 6.1 MB  00:00:00     
(3/14): base/7/x86_64/filelists_db                                              | 7.2 MB  00:00:00     
(4/14): base/7/x86_64/other_db                                                  | 2.6 MB  00:00:00     
(5/14): extras/7/x86_64/filelists_db                                            | 276 kB  00:00:00     
(6/14): extras/7/x86_64/other_db                                                | 149 kB  00:00:00     
(7/14): extras/7/x86_64/primary_db                                              | 249 kB  00:00:00     
(8/14): mariadb/updateinfo                                                      | 5.6 kB  00:00:02     
(9/14): mariadb/primary_db                                                      |  72 kB  00:00:01     
(10/14): updates/7/x86_64/filelists_db                                          |  10 MB  00:00:00     
(11/14): updates/7/x86_64/other_db                                              | 1.2 MB  00:00:00     
(12/14): mariadb/filelists_db                                                   | 359 kB  00:00:04     
(13/14): mariadb/other_db                                                       | 8.3 kB  00:00:00     
(14/14): updates/7/x86_64/primary_db                                            |  19 MB  00:00:01     
Metadata Cache Created

구성된 소프트웨어 저장소 표시

yum repolist
$ yum repolist
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id                                        repo name                                         status
base/7/x86_64                                  CentOS-7 - Base                                   10,072
extras/7/x86_64                                CentOS-7 - Extras                                    515
mariadb                                        MariaDB                                               96
updates/7/x86_64                               CentOS-7 - Updates                                 4,538
repolist: 15,221

구성된 소프트웨어 저장소 표시(disabled 까지 표지)

yum repolist all
$ yum repolist all
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
repo id                                   repo name                                     status
C7.0.1406-base/x86_64                     CentOS-7.0.1406 - Base                        disabled
C7.0.1406-centosplus/x86_64               CentOS-7.0.1406 - CentOSPlus                  disabled
C7.0.1406-extras/x86_64                   CentOS-7.0.1406 - Extras                      disabled
C7.0.1406-fasttrack/x86_64                CentOS-7.0.1406 - Fasttrack                   disabled
C7.0.1406-updates/x86_64                  CentOS-7.0.1406 - Updates                     disabled
...
C7.8.2003-updates/x86_64                  CentOS-7.8.2003 - Updates                     disabled
base/7/x86_64                             CentOS-7 - Base                               enabled: 10,072
base-debuginfo/x86_64                     CentOS-7 - Debuginfo                          disabled
base-source/7                             CentOS-7 - Base Sources                       disabled
c7-media                                  CentOS-7 - Media                              disabled
centos-kernel/7/x86_64                    CentOS LTS Kernels for x86_64                 disabled
centos-kernel-experimental/7/x86_64       CentOS Experimental Kernels for x86_64        disabled
centosplus/7/x86_64                       CentOS-7 - Plus                               disabled
centosplus-source/7                       CentOS-7 - Plus Sources                       disabled
cr/7/x86_64                               CentOS-7 - cr                                 disabled
extras/7/x86_64                           CentOS-7 - Extras                             enabled:    515
extras-source/7                           CentOS-7 - Extras Sources                     disabled
fasttrack/7/x86_64                        CentOS-7 - fasttrack                          disabled
mariadb                                   MariaDB                                       enabled:     96
updates/7/x86_64                          CentOS-7 - Updates                            enabled:  4,538
updates-source/7                          CentOS-7 - Updates Sources                    disabled
repolist: 15,221

 

참고URL

- Linux Software Repository for Microsoft Products : https://learn.microsoft.com/en-us/windows-server/administration/linux-package-repository-for-microsoft-software

 

728x90