Nexus Repository를 이용하여 yum proxy를 구성하는 방법에 대해 알아보겠습니다.
/etc/yum.repos.d/
하단에 nexus.repo
파일을 생성하여 Nexus를 통해 yum install
이 가능하도록 구성하였으며 구성 목적은 폐쇄망 서버에서의 yum package 사용입니다.
설명에 앞서 대략적인 구성을 그려보았습니다.
'EC2-SERVICE-PRI' 서버의 Image는 CentOS 7
을 사용했습니다.
(Amazon Linux
사용의 경우는 다음 포스팅을 참고 바랍니다.)
Remote storage를 CentOS의 mirror site URL(http://mirror.centos.org/centos/
)로 설정합니다.
CentOS의 mirror site를 Remote storage로 설정했던 Nexus-proxy 주소를 Remote storage로 설정합니다.
설정은 Sonatype docs를 참고했습니다. (repo 파일 path: /etc/yum.repos.d
/)
$ pwd
/etc/yum.repos.d
$ ls
nexus.repo
$ cat nexus.repo
[nexusrepo]
name=Nexus Repository
baseurl=https://nexus.xxxxx.com/repository/yum-proxy/7/os/x86_64/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-7
repo_gpgcheck=0
priority=1
구성이 잘 되었는지 테스트해 보기 위해 yum install telnet
을 수행해 보았고 Nexus repository를 통해 정상적으로 설치되는 것을 확인할 수 있었습니다.
$ yum install telnet
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Resolving Dependencies
--> Running transaction check
---> Package telnet.x86_64 1:0.17-65.el7_8 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
========================================================================================
Package Arch Version Repository Size
========================================================================================
Installing:
telnet x86_64 1:0.17-65.el7_8 nexusrepo 64 k
Transaction Summary
========================================================================================
Install 1 Package
Total download size: 64 k
Installed size: 113 k
Is this ok [y/d/N]: y
Downloading packages:
telnet-0.17-65.el7_8.x86_64.rpm | 64 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
Installing : 1:telnet-0.17-65.el7_8.x86_64 1/1
Verifying : 1:telnet-0.17-65.el7_8.x86_64 1/1
Installed:
telnet.x86_64 1:0.17-65.el7_8
Complete!
개인적으로 공부하며 작성한 글로, 내용에 오류가 있을 수 있습니다.
안녕하세요
위에 내용을 참고해서 yum-proxy 설정을 진행했는데요.
remote storage를 http://mirror.centos.org/centos/ 이 주소를 넣고 save한 후에 다시
remote storage에 http://nexus.xxxxxxrepository/yum-proxy/를 넣고 save한건가요??
저는 remote storage에 http://mirror.centos.org/centos/를 넣고 nexus.repo 수정 후 yum install시 [Errno 14] HTTP Error 401 - Unauthorized 에러가 발생하는데 왜 그런걸까요??