이전 포스팅 (사전 진행 사항)
[WAS] JEUS 21 설치 (feat. CentOS 8, JDK 8)
Linux(CentOS 8) 환경에 JEUS 21을 WAS로 설치하려 한다. JEUS의 다른 버전은 여기에서 다운로드가 가능하므로, 21버전이 허용(공개)되지 않은 사용자도 사용할 수 있다. TmaxSoft Technical Network [technet-02] 데
idox.tistory.com
[TmaxSoft] ProObject 21 설치 가이드 (1) - ProObject 21 설치 및 서버 생성
이전 포스팅 (사전 진행 사항) [WAS] JEUS 21 설치 (feat. CentOS 8, JDK 8) [WAS] JEUS 21 설치 (feat. CentOS 8, JDK 8) Linux(CentOS 8) 환경에 JEUS 21을 WAS로 설치하려 한다. JEUS의 다른 버전은 여기에서 다운로드가 가능
idox.tistory.com
Nexus
Nexus란 Maven에서 사용할 수 있는 Repository로, 외부에서 Dependency를 추가하는 수고를 덜고 Local Nexus를 사용함으로써 빠르게 라이브러리를 끌어올 수 있게 한다. 개발팀에서 사용하는 공통 라이브러리를 Nexus에 배포하면 팀원들 간 쉽고 빠른 공유가 가능하다.
1. Nexus 설치 파일 다운로드
(OSS버전 = 오픈소스 / PRO버전 = 라이센스 필요)
- 공식 최신 OSS 버전 : https://download.sonatype.com/nexus/3/latest-unix.tar.gz
Nexus 설치 파일을 업로드하고 압축을 해제한다. 압축 해제시 2개의 하위 디렉토리가 생성되므로 'nexus'라는 이름의 상위 디렉토리를 생성한 뒤 그 아래에서 압축을 해제해야 한다. 여기서는 nexus-3.42.0-01 버전을 이용하였다. (오류 발생시 3.29.2-02 버전 이용)
$ mkdir nexus # 해당 경로에 Nexus 설치 파일 업로드
$ tar zxvf nexus-* # 업로드한 Nexus 파일 압축 해제
2. Nexus 설정 파일 수정
/home/idox/nexus/nexus-3.42.0-01/etc/nexus-default.properties 파일에 IP, Port 정보를 작성한다.
application-port=8081
application-host=192.168.22.128
3. Nexus 기동
{NEXUS_HOME}/bin 위치로 이동하여 nohup 명령을 입력하면 Nexus를 기동할 수 있다.
- nohup : no hang up의 약자로, 세션과 연결을 종료해도 실행 시킨 프로그램이 종료되지 않음을 의미
- & : 해당 프로그램이 백그라운드에서 실행되도록 함
$ cd /home/idox/nexus/nexus-3.42.0-01/bin
$ nohup ./nexus run &
$ # Started Sonatype Nexus OSS 3.42.0-01
$ ps -ef | grep nexus # Nexus 기동 확인
4. Nexus 접속
1) 웹 접속 및 로그인
2번 과정의 nexus-default.properties 파일에 작성한 IP, Port 정보로 접속한다.
- URL : {application-host}:{application-port}
초기 비밀번호는 {NEXUS_HOME}/sonatype-work/nexus3 경로 내의 파일에 작성되어 있다.
$ cat /home/idox/nexus/sonatype-work/nexus3/admin.password
초기 비밀번호는 24시간 뒤 만료되므로, 로그인한 뒤 Sign In을 클릭하여 PW를 변경한다. (admin / admin)
2) Repository 생성
Server administration and configuration(톱니바퀴 아이콘) > Repository > Repositories > Create Repository > maven2(hosted) > Name(proobject-rte-ps-repo-release2) 입력 후 생성
3) Repository Group 생성
- Server administration and configuration(톱니바퀴 아이콘) > Repository -> Repositories > Create repository > maven2 (group) > Name(tmaxgroup2) 입력
- (아래로 스크롤) Group > Member repositories > Members > proobject-rte-ps-repo-release2 등록
3) 접근 허가 설정
Server administration and configuration > Security > Anonymous Access > Allow anonymous users to access the server 체크 (공용 서버 사용하는 경우 이미 설정되어 있으므로 건들지 않아도 됨)
5. 로컬에 Git 설치
- Git Download : https://gitforwindows.org/
Git for Windows
Git for Windows focuses on offering a lightweight, native set of tools that bring the full feature set of the Git SCM to Windows while providing appropriate user interfaces for experienced Git users and novices alike. Git BASH Git for Windows provides a BA
gitforwindows.org
쉘 스크립트 파일을 실행시키기 위해 Git Bash를 설치한다. (설치 과정은 생략)
1) Nexus 로컬 Repository의 sh 파일 수정
서버 자료의 Repository 파일을 압축 해제하고 nexus_bulk_upload.sh 파일을 수정한다.
username="admin"
password="admin"
nexusurl=http://{IP}:8082/repository/proobject-rte-ps-repo-release2/
2) proobject-meta-21.0.0.0.24.pom 파일 수정
Repository 폴더/com/tmax/proobject/proobject-meta/21.0.0.0.24 디렉토리 아래의 proobject-meta~ 파일을 수정한다.
3) 해당 로컬 Repository를 서버 Nexus로 업로드
Repository 폴더의 빈 곳 중 아무데서나 우클릭 > Git Bash Here을 클릭한다.
Git Bash 터미널에 sh nexus_bulk_upload.sh 명령을 입력하여 쉘 스크립트를 실행한다.
$ sh nexus_bulk_upload.sh
Nexus에서 Brows server contents -> Browse -> proobject-rte-ps-repo-release2 위치를 확인하면 업로드되어 있을 것이다.
Nexus - Repository 로컬로 내보내기
PRO 버전에서는 Nexus 공식 내보내기 툴 사용이 가능하지만, OSS 버전은 지원하지 않으므로 아래 링크 사용
- https://github.com/lbar/nexus3-export
- https://github.com/lbar/nexus3-export/archive/refs/heads/master.zip
GitHub - lbar/nexus3-export: Tool to export Nexus 3 repositories in a local directory
Tool to export Nexus 3 repositories in a local directory - GitHub - lbar/nexus3-export: Tool to export Nexus 3 repositories in a local directory
github.com
프로그램 실행시 인수를 넣어줘야 한다.
- (필수) Nexus 저장소의 URL
- (필수) Nexus의 저장소 ID (예: 릴리스)
- (선택) 내보낼 저장소의 로컬 디렉토리 (미지정시 임시 디렉토리 생성)
Maven
Java용 프로젝트 관리 도구로 Apache Ant의 대안으로 사용된다. pom.xml 파일을 통해 정형화된 빌드 시스템으로 프로젝트를 관리할 수 있으며, 프로젝트의 전체적인 Life Cycle 관리, 편리한 의존성 라이브러리 관리 등을 지원한다.
1. Maven 설치 파일 다운로드 및 압축 해제
### apache-maven.3.6.3-bin.tar.gz 파일 서버에 업로드
$ tar zxvf apache-maven-3.6.3-bin.tar.gz
### gzip: stdin: not in gzip format 발생시 z 옵션 삭제 후 재실행
2. Maven 환경 설정
.bash_profile 수정
# MAVEN Environment
export MAVEN_HOME=/home/idox/apache-maven-3.6.3
export PATH=$MAVEN_HOME/bin:$PATH
.bash_profile 실행(작성한 환경 설정 저장) → mvn -v 명령 실행
로컬의 settings.xml 파일 수정 (추후 STS에서 Maven 경로 지정시 사용하는 파일로, 서버의 {USER_HOME}/apache-maven-3.6.3/conf 디렉토리 settings.xml 파일이 아님)
Nexus에 생성한 Repository 이름 및 주소를 입력한다.
<?xml version="1.0"?>
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://maven.apache.org/SETTINGS/1.0.0">
<servers>
<server>
<id>proobject-rte-ps-repo-release2</id> <!-- Repository 이름 -->
<username>admin</username> <!-- ID -->
<password>admin</password> <!-- PW -->
</server>
</servers>
<mirrors>
<mirror>
<id>tmaxgroup2</id> <!-- Group 이름 -->
<mirrorOf>*</mirrorOf>
<name>proobject-rte-ps-repo-release2</name> <!-- Repository 이름 -->
<url>http://{IP}:8081/repository/{Repository 이름}/</url>
</mirror>
</mirrors>
</settings>
Master Server 재기동