우분투에 넥서스 설치

1. 개요
우분투 16.04, Apache2, Tomcat7, JDK 1.8, Nexus nexus-2.13.0-01 버전을 기준으로 하여 설치

2. 넥서스 다운로드
톰캣과 연동하기 위해 war파일로 다운로드

wget http://www.sonatype.org/downloads/nexus-latest.war
mkdir nexus-2.13.0-01
mkdir sonatype-work
unzip nexus-latest.war -d nexus-2.13.0-01/

주의사항 : 퍼미션 문제가 발생한다면
WEB-INF/classes폴더에 nexus.properties파일을 열어보면 아래와 같이 되어있다.

nexus-work=${user.home}/sonatype-work/nexus

/usr/share/tomcat7 폴더밑으로
sonatype-work/nexus 라는 폴더 생성하고

chown -R tomcat7
chgrp -R tomcat7 로 부여하여 해결

3. Tomcat 설정
server.xml에 대한 설정

cd /etc/tomcat7
vi server.xml 로 아래 Host 추가


        
	

4. 가상호스트 등록
아래와 같이 파일을 만들어 가상호스트를 아파치에 등록한다.

cd /etc/apache2/sites-available
cp 000-default.conf repo.moramcnt.com.conf
vi repo.moramcnt.com.conf

	ServerAdmin admin@moramcnt.com
	DocumentRoot /home/moram/service/MoramWebSolution/nexus/nexus-2.13.0-01
	DirectoryIndex index.html

	ServerName repo.moramcnt.com
	
		Options FollowSymLinks
		AllowOverride None
		Order allow,deny
		Allow from all
		Require all granted
	

	LogLevel warn
	ErrorLog /var/log/apache2/error-repo.moramcnt.com.log
	CustomLog /var/log/apache2/access-repo.moramcnt.com.log combined

	JkMount /*.do ajp13_worker
	JkMount /*.jsp ajp13_worker
	JkMount /*.json ajp13_worker

	#----------------------------
	# nexus 설정
	#----------------------------
	JkMount /index.html ajp13_worker
	JkMount /service/* ajp13_worker
	JkMount /content/* ajp13_worker
	JkMount /static/* ajp13_worker
	#----------------------------

위 파일을 이용하여 가상호스트 등록

sudo a2ensite repo.moramcnt.com.conf

5. 서비스 재시작

sudo service tomcat7 restart
sudo service apache2 restart

6. 그 이외는 이전에 작성했던
http://blog.moramcnt.com/?p=630 를 참조

넥서스 설정

1. 개요

    Tomcat7, JDK1.6, nexus 2.2 버전을 기준으로 함

2. 넥서스 설치

  • http://www.sonatype.org/nexus/archived 에서 넥서스 2.2 다운 로드
  • 압축을 풀어 D:\Service\Nexus\nexus-2.2 폴더에 넣는다.

3. Tomcat 설정

    server.xml에 대한 설정

    
    	
    	
    
    				

    Tomcat Connectior의 uriworkermap.properties에 대한 설정

    #/=wlb
    #/*=wlb
    /*.jsp=wlb
    /*.do=wlb
    /*.json=wlb
    
    #----------------------------
    # nexus 설정
    #----------------------------
    /index.html=wlb
    /service/*=wlb
    /content/*=wlb
    /static/*=wlb
    #----------------------------
    
    # Optionally filter out all .jpeg files inside that context
    # For no mapping the url has to start with exclamation (!)
    #!/servlets-examples/*.jpeg=wlb
    #!/*.cfg=wlb
    # Mount jkstatus to /jkmanager
    # For production servers you will need to
    # secure the access to the /jkmanager url
    #
    /jkmanager=jkstatus
    
    				

4. IIS 설정

  • repo.moramcnt.com라는 사이트 생성
  • tomcat 연동을 위해 가상디렉토리 jakarta 를 만든다.
      C:\Program Files\Apache Software Foundation\tomcat-connectors-1.2.37\bin

      nexus-01

5. 톰캣 서비스 구동

    넥서스를 톰캣 서비스로 구동하면 넥서스의 환경설정 파일을 Documents and
    Settings 밑의 Default User에 sonatype-work라는 폴더를 생성하여
    기록한다.
    주의 할 점은 콘솔로 톰캣 구동시에는 로그인한 계정밑에 sonatype-work를
    만들어 실행하므로 착각하면 안된다.
    그리고 Default User는 히든 폴더이므로 탐색기 상단에 있는 주소줄에서
    입력하면 아래와 같이 나타난다.

    nexus-02

6. 로그인 및 패스워드 변경

  • 로그인
      http://repo.moramcnt.com/index.html 로 접속

      nexus-03

      기본 로그인 계정은 admin/admin123 이다.

  • Admin 패스워드 변경
      좌표 메뉴에서 Security > Users 메뉴 선택 한후 오른쪽 마우스를 누르면
      아래와 같이 컨텍스트 메뉴가 나오는데 Set password를 선택하여
      패스워드 변경

      nexus-04

7. 레포지토리 생성

  • Views/Repositories > Repositories 메뉴 선택
  • Add 버튼 > Hosted Repository 선택

    nexus-05
  • Hosted Repository 타입으로 모람프레임워크 릴리즈 레포지토리 생성

    nexus-06
  • Hosted Repository 타입으로 모람프레임워크 스냅샷 레포지토리 생성

    nexus-07
  • Repository Group타입의 외부에 공개할 Public Repositories 생성

    nexus-08

    주의: Ordered Group Repositories에 기본으로 있는 Snapshot, Releases,
    Public Repositories는 제외

8. 사용자 생성

  • Privileges 생성
      Security> Privileges 메뉴에서 Add

      nexus-09

      저장하게 되면 총 4개의 privilege가 추가된 것을 확인할 수 있다. (create, read, update, delete)

      nexus-10
  • Role 생성
      Security > Role 메뉴에서 Add

      nexus-11

      주의 : view privilege를 추가하지 않으면 나중에 로그인 했을 경우 프로젝트의 Public Repositories가 보이지 않는다.

  • 사용자 생성
      Security > Users에서 Add

      nexus-12

9. 새로운 사용자 로그인

    이전에 등록한 사용자로 로그인하여 아래와 같이 나오면 성공

    nexus-13

10. 넥서스 Deploy

  • 메이븐의 Settings.xml 파일 수정

    • 서버 등록

      	
      		moramframework-releases
      		moramcnt
      		XXXX
      	
      	
      		moramframework-snapshots
      		moramcnt
      		XXXX
      	
      							
    • 프로파일 등록

      
      
      	moramframework
      	
      		1.6
      	
      
      	
      		
      			moramframework-release
      			http://repo.moramcnt.com/content/repositories/moramframework-release
      			
      				false
      			
      		
      
      		
      			moramframework-snapshots
      			http://repo.moramcnt.com/content/repositories/moramframework-snapshots
      			
      				false
      			
      		
      	
      
      	
      		
      			moramframework-release
      			http://repo.moramcnt.com/content/repositories/moramframework-release
      			
      				false
      			
      		
      
      		
      			moramframework-snapshots
      			http://repo.moramcnt.com/content/repositories/moramframework-snapshots
      			
      				false
      			
      		
      	
      
      							
    • 프로파일 활성화

      
      	moramframework
      
      							
  • 최상위 pom 파일 수정

    • 플러그인 설정

      
      	org.apache.maven.plugins
      	maven-deploy-plugin
      	2.5
      	
      	   true
      	
      	
      							
    • distributionManagement 설정

      
      
      	
      		moramframework-releases
      		http://repo.moramcnt.com/content/repositories/moramframework-releases
      	
      	
      		moramframework-snapshots
      		http://repo.moramcnt.com/content/repositories/moramframework-snapshots
      	
      
      							
  • 이클립스 배포

      nexus-14

      컴파일시 에러가 날 경우, 보안상에 문제 가 있어서 업로드를 못한것이므로 직접 올린다.