linux下nexus-2.4.0-09-bundle.tar.gz安装与配置

http://www.sonatype.org/downloads/nexus-2.4.0-09-bundle.tar.gz

1、 软件

a) 下载Nexus 地址:http://www.sonatype.org/downloads/nexus-2.4.0-09-bundle.tar.gz
b) 如无特殊说明,本文档操作用户为nexus
c) nexus默认的管理员用户名密码是:admin/admin123

2、 安装

a) 解压

$ tar zxvf nexus-2.4.0-09-bundle.tar.gz

b) 移动到其他目录

$ mv nexus-2.4.0 /home/nexus/nexus

c) 设置为系统自启动服务(使用root用户)
[code="java"]# useradd nexus
# passwd nexus
Changing password for user nexus.
New password:
BAD PASSWORD: it is too short
BAD PASSWORD: is too simple
Retype new password:
passwd: all authentication tokens updated successfully.
#
#
# cd /home/
# ll
total 16
drwx------ 2 nexus nexus 4096 Mar 5 21:53 nexus
drwx------ 2 sky sky 4096 Jan 24 02:33 sky
drwx------ 2 steven steven 4096 Jan 24 02:34 steven
drwxr-xrwx 5 svn svn 4096 Jan 24 05:49 svn
# cd /soft/
# ll
total 85936
drwxr-xr-x 8 root root 4096 Apr 11 2013 nexus-2.4
-rw-r--r-- 1 root root 35460633 Mar 5 20:36 nexus-2.4.0-09-bundle.tar.gz
# mv nexus-2.4 /home/nexus/nexus
# ll
total 85932
-rw-r--r-- 1 root root 35460633 Mar 5 20:36 nexus-2.4.0-09-bundle.tar.gz
# cd /home/
# ll
total 16
drwx------ 3 nexus nexus 4096 Mar 5 21:55 nexus
drwx------ 2 sky sky 4096 Jan 24 02:33 sky
drwx------ 2 steven steven 4096 Jan 24 02:34 steven
drwxr-xrwx 5 svn svn 4096 Jan 24 05:49 svn
# cd nexus/
# ll
total 4
drwxr-xr-x 8 root root 4096 Apr 11 2013 nexus
# # cd /etc/init.d/
# # cp /home/nexus/nexus/bin/jsw/linux-x86-64/nexus nexus
# [/code]


编辑/etc/init.d/nexus文件,添加以下变量定义:
NEXUS_HOME=/home/nexus/nexus
PLATFORM=linux-x86-64
PLATFORM_DIR="${NEXUS_HOME}/bin/jsw/${PLATFORM}"


修改以下变量:

WRAPPER_CMD="${PLATFORM_DIR}/wrapper"
WRAPPER_CONF="${PLATFORM_DIR}/../conf/wrapper.conf"
PIDDIR="${NEXUS_HOME}"

修改如下变量,设置启动用户为nexus:

RUN_AS_USER=nexus

执行命令添加nexus自启动服务 ,在不同的环境下 此命令可能不可用 不过没关系 不影响操作

# chkconfig –add nexus
# chkconfig –levels 345 nexus on

执行如下命令启动、停止nexus服务

# service nexus start
# service nexus stop



d) 检查是否启动成功

在本机浏览器中访问URL: http://localhost:8081/nexus
会出现Nexus的欢迎页面
注:如果想远程通过浏览器访问,则在远程浏览器中输入http://:8081/nexus
可通过在本地机器上输入命令 ifconfig 查看
如果未能访问到nexus的欢迎页面,需要查看本机的防火墙设置,是否打开了端口8081

e) 修改配置

配置文件位置nexus/conf/nexus.properties,配置示例如下:

# Sonatype Nexus
# ==============
# This is the most basic configuration of Nexus.

# Jetty section
application-port=8081
application-host=0.0.0.0
nexus-webapp=${bundleBasedir}/nexus
nexus-webapp-context-path=/nexus

# Nexus section
nexus-work=${bundleBasedir}/../sonatype-work/nexus
runtime=${bundleBasedir}/nexus/WEB-INF
pr.encryptor.publicKeyPath=/apr/public-key.txt


主要配置参数:

application-port:nexus启动端口
nexus-work:指定构件库的存储位置


配置maven
D:\apache-maven-3.2.3\conf\settings.xml


第一中配置:先从本地查找,本地没有去私服务器查找
再settings.xml中添加如下配置


nexusProfile


nexusProfile
nexus repository
default
http://120.24.200.128:8081/nexus/content/groups/public/
true

true





centralProfile


central
Central Repository

https://repo.maven.apache.org/maven2
default

true







nexusProfile
centralProfile


第二种配置:不从本地查找 ,每次都从私服去查找
在settings.xml中做如下配置



mirrorId
*
Human Readable Name for this Mirror.
http://120.24.200.128:8081/nexus/content/groups/public/



centralProfile


central
Central Repository

https://repo.maven.apache.org/maven2
default

true







centralProfile




如何发布本地项目到私服
第一步:
在maven项目pom.xml中配置要发布的仓库地址



frame-releases
http://120.24.245.128:8081/nexus/content/repositories/releases


frame-snapshots
http://120.24.245.128:8081/nexus/content/repositories/snapshots




第二步:在settings.xml中添加发布用的用户账号
 
frame-releases
deployment
deployment123


frame-snapshots
deployment
deployment123


deployment/deployment123 是系统默认的发布账号密码

运行pom.xml 执行clean deploy命令 则发布项目到私服nexus仓库


这里填下 标准的webapp项目所需的 整理的最新的jar集合pom.xml配置文件
项目架构:spring3.0.5或者3.2.13 + mybatise3.2.8 + others Tools


4.0.0
com.wzh.frame
parent
1.0
pom



UTF-8
1.0-SNAPSHOT
1.6
0.9.2

3.0.5.RELEASE


1.0
3.2.8
1.2.2
1.0.9
1.1.2
1.2.17
1.6.3
1.4.1
1.9.2
2.6
1.3.1
1.8.5
1.46
1.0.6
1.6.4
1.7.10
0.4.8
2.4-jdk15
2.3.1
1.6.1
3.1
2.11.6
2.7.1
1.5.3
4.4
3.11
3.11
3.11
2.3
1.2.4
7.0
7.0
1.2
4.0
5.1.34







org.springframework
spring-framework
${spring.version}








org.springframework
spring-context
${spring.version}


org.springframework
spring-context-support
${spring.version}


org.springframework
spring-web
${spring.version}


org.springmodules
spring-modules-validation
${spring-modules-validation.version}




org.mybatis
mybatis
${mybatis.version}


org.mybatis
mybatis-spring
${mybatis-spring.version}


com.alibaba
druid
${druid.version}


taglibs
standard
${standard.version}


log4j
log4j
${log4j.version}


opensymphony
quartz-all
${quartz-all.version}


commons-validator
commons-validator
${commons-validator.version}


org.aspectj
aspectjweaver
${aspectjweaver.version}


org.bouncycastle
bcprov-jdk16
${bcprov-jdk16.version}


net.sf.ezmorph
ezmorph
${ezmorph.version}


commons-beanutils
commons-beanutils
${commons-beanutils.version}


commons-fileupload
commons-fileupload
${commons-fileupload.version}


org.apache.thrift
libthrift
${libthrift.version}


org.fusesource
sigar
${sigar.version}


org.slf4j
slf4j-log4j12
${slf4j-log4j12.version}


net.coobird
thumbnailator
${thumbnailator.version}


net.sf.json-lib
json-lib
${json-lib.version}


com.google.code.gson
gson
${gson.version}


dom4j
dom4j
${dom4j.version}


cglib
cglib-nodep
${cglib-nodep.version}


net.spy
spymemcached
${spymemcached.version}


org.simpleframework
simple-xml
${simple-xml.version}


org.owasp.antisamy
antisamy
${antisamy.version}


org.apache.poi
poi
${poi.version}


org.apache.poi
poi-ooxml
${poi-ooxml.version}


org.apache.poi
poi-ooxml-schemas
${poi-ooxml-schemas.version}


net.sf.opencsv
opencsv
${opencsv.version}


com.alibaba
fastjson
${fastjson.version}


commons-lang
commons-lang
${commons-lang.version}


org.apache.httpcomponents
httpclient
${httpclient.version}



javax.servlet
servlet-api
${servlet-api.version}
provided


javax.servlet
jsp-api
${jsp-api.version}
provided


jstl
jstl
${jstl.version}


junit
junit
${junit.version}
test


mysql
mysql-connector-java
${mysql-connector-java.version}







org.apache.maven.plugins
maven-compiler-plugin
2.3.2

${jdk.version}
${jdk.version}
${project.build.sourceEncoding}






../common
../module-datasource
../module-base-dal
../module-dept-dal
../common-web
../admin-dept-biz






frame-releases
http://120.24.200.100:8081/nexus/content/repositories/releases


frame-snapshots
http://120.24.200.100:8081/nexus/content/repositories/snapshots



你可能感兴趣的:(linux)