목적: Local(Mac) 환경에서 Nexus를 설치하고, 패키지를 업로드 및 다운로드하는 과정을 정리
1. Nexus 설치 및 실행
Docker를 활용한 Nexus 설치 (Mac에서 가장 간단한 방법)
docker run -d -p 8081:8081 --name nexus sonatype/nexus3
➜ ~ docker run -d -p 8081:8081 --name nexus sonatype/nexus3
Unable to find image 'sonatype/nexus3:latest' locally
latest: Pulling from sonatype/nexus3
39e8a3230eee: Download complete
5aee836c3728: Download complete
b79c6a3ca05e: Download complete
d7a8a4cfddc1: Download complete
acd6ee2cf860: Download complete
56631da24b0d: Download complete
2fe94bbe475b: Download complete
Digest: sha256:af8e7276d6304515e36719b0bb95c3dca115f29af11fa334e41a3716c9182fc8
Status: Downloaded newer image for sonatype/nexus3:latest
fbb4dbf7813c6bfdde8491bbd410f18bbf64617b54afcf4901f36866a0b37a26
실행 확인
➜ ~ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
fbb4dbf7813c sonatype/nexus3 "/opt/sonatype/nexus…" 26 seconds ago Up 24 seconds 0.0.0.0:8081->8081/tcp nexus
Nexus Web UI 접속
http://localhost:8081
Nexus 리포지토리 생성
Nexus 웹 UI에서 설정
- http://localhost:8081 접속 후 로그인
- 좌측 Repositories → Create repository 클릭
- "Raw (hosted)" 선택
- Repository Name: spc-middleware
- Version Policy: Release
- Deployment Policy: Allow Redeploy
- "Create repository" 클릭
Repository 생성 완료 후 확인
http://localhost:8081/repository/spc-middleware/
3. 테스트용 패키지 다운로드
SPC Middleware 관련 패키지 다운로드 (Mac에서 실행)
mkdir -p ~/nexus_test
cd ~/nexus_test
# Apache 2.4.53 다운로드
wget https://archive.apache.org/dist/httpd/httpd-2.4.53.tar.gz
# WildFly 27 다운로드
wget https://github.com/wildfly/wildfly/releases/download/27.0.0.Final/wildfly-27.0.0.Final.tar.gz
4. SPC-Middleware Repository에 파일 업로드
cURL을 사용해 파일 업로드 (Mac에서 실행)
# WildFly 27 업로드
curl -v -u admin:<비밀번호> --upload-file wildfly-27.0.0.Final.tar.gz \
"http://localhost:8081/repository/spc-middleware/wildfly-27.0.0.Final.tar.gz"
# Apache 2.4.53 업로드
curl -v -u admin:<비밀번호> --upload-file httpd-2.4.53.tar.gz \
"http://localhost:8081/repository/spc-middleware/httpd-2.4.53.tar.gz"
5. SPC-Middleware Repository에서 파일 다운로드 테스트
Mac에서 wget 또는 curl로 다운로드 확인
wget http://localhost:8081/repository/spc-middleware/wildfly-27.0.0.Final.tar.gz -P ~/nexus_test/
wget http://localhost:8081/repository/spc-middleware/httpd-2.4.53.tar.gz -P ~/nexus_test/
➜ nexus_test wget http://localhost:8081/repository/spc-middleware/wildfly-27.0.0.Final.tar.gz -P ~/nexus_test/
wget http://localhost:8081/repository/spc-middleware/httpd-2.4.53.tar.gz -P ~/nexus_test/
--2025-03-14 14:46:06-- http://localhost:8081/repository/spc-middleware/wildfly-27.0.0.Final.tar.gz
localhost (localhost) 해석 중... ::1, 127.0.0.1
다음으로 연결 중: localhost (localhost)|::1|:8081... 연결했습니다.
HTTP 요청을 보냈습니다. 응답 기다리는 중... 200 OK
길이: 231344700 (221M) [application/x-gzip]
저장 위치: `/Users/ptty/nexus_test/wildfly-27.0.0.Final.tar.gz'
wildfly-27.0.0.Final.tar.gz 100%[====================================================================================================>] 220.63M --.-KB/s / 0.1s
2025-03-14 14:46:06 (1.52 GB/s) - `/Users/ptty/nexus_test/wildfly-27.0.0.Final.tar.gz' 저장함 [231344700/231344700]
--2025-03-14 14:46:06-- http://localhost:8081/repository/spc-middleware/httpd-2.4.53.tar.gz
localhost (localhost) 해석 중... ::1, 127.0.0.1
다음으로 연결 중: localhost (localhost)|::1|:8081... 연결했습니다.
HTTP 요청을 보냈습니다. 응답 기다리는 중... 200 OK
길이: 9726558 (9.3M) [application/x-gzip]
저장 위치: `/Users/ptty/nexus_test/httpd-2.4.53.tar.gz'
httpd-2.4.53.tar.gz 100%[====================================================================================================>] 9.28M --.-KB/s / 0.006s
2025-03-14 14:46:06 (1.43 GB/s) - `/Users/ptty/nexus_test/httpd-2.4.53.tar.gz' 저장함 [9726558/9726558]
➜ nexus_test ls -lh ~/nexus_test/
total 470848
-rw-r--r--@ 1 ptty staff 9.3M 3 14 14:43 httpd-2.4.53.tar.gz
-rw-r--r--@ 1 ptty staff 221M 3 14 14:43 wildfly-27.0.0.Final.tar.gz
Middleware 패키지 업로드 및 배포 준비 완료
Nexus가 모든 네트워크에서 접속 가능하도록 설정
Nexus 컨테이너 내부 설정 확인 (nexus.http.host=0.0.0.0 확인 필요)
docker exec -it nexus cat /nexus-data/etc/nexus.properties
nexus.http.host=0.0.0.0 설정이 없으면 추가 필요
docker exec -it nexus sh -c "echo 'nexus.http.host=0.0.0.0' >> /nexus-data/etc/nexus.properties"
docker restart nexus