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://<ip>:8081/nexus
<ip> 可通过在本地机器上输入命令 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中添加如下配置

<profile>
<id>nexusProfile</id>
<repositories>
<repository>
<id>nexusProfile</id>
<name>nexus repository</name>
<layout>default</layout>
<url>http://120.24.200.128:8081/nexus/content/groups/public/</url>
<releases><enabled>true</enabled></releases>
<!-- snapshots 默认是关闭的,需手动开启配置-->
<snapshots><enabled>true</enabled></snapshots>
</repository>
</repositories>
</profile>

<profile>
<id>centralProfile</id>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<!-- 配置了镜像之后这里的url不再起作用,但其他配置会应用上,
此处主要是为了开启snapshots的配置为true ,默认是false关闭 -->
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>

<activeProfiles>
<!-- activeProfile 配置的是profile的id,可以激活多个profile-->
<activeProfile>nexusProfile</activeProfile>
<activeProfile>centralProfile</activeProfile>
</activeProfiles>


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

<!-- 工厂的镜像,只有mirrorOf中的工厂要访问,都会自动来查找镜像,
如果镜像无法访问就不会再去中央工厂下载,使用*表示所有工厂访问都使用这个
镜像,这是推荐的做法
-->
<mirror>
<id>mirrorId</id>
<mirrorOf>*</mirrorOf>
<name>Human Readable Name for this Mirror.</name>
<url>http://120.24.200.128:8081/nexus/content/groups/public/</url>
</mirror>

<profile>
<id>centralProfile</id>
<repositories>
<repository>
<id>central</id>
<name>Central Repository</name>
<!-- 配置了镜像之后这里的url不再起作用,但其他配置会应用上,
此处主要是为了开启snapshots的配置为true ,默认是false关闭 -->
<url>https://repo.maven.apache.org/maven2</url>
<layout>default</layout>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
</profile>

<activeProfiles>
<!-- activeProfile 配置的是profile的id,可以激活多个profile-->
<activeProfile>centralProfile</activeProfile>
</activeProfiles>



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

<distributionManagement>
<repository>
<id>frame-releases</id>
<url>http://120.24.245.128:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>frame-snapshots</id>
<url>http://120.24.245.128:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>


第二步:在settings.xml中添加发布用的用户账号
 <server>
<id>frame-releases</id>
<username>deployment</username>
<password>deployment123</password>
</server>
<server>
<id>frame-snapshots</id>
<username>deployment</username>
<password>deployment123</password>
</server>


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

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


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

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.wzh.frame</groupId>
<artifactId>parent</artifactId>
<version>1.0</version>
<packaging>pom</packaging>


<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<current.version>1.0-SNAPSHOT</current.version>
<jdk.version>1.6</jdk.version>
<libthrift.version>0.9.2</libthrift.version>
<!--
<spring.version>3.2.13.RELEASE</spring.version>
-->
<spring.version>3.0.5.RELEASE</spring.version>


<spring-modules-validation.version>1.0</spring-modules-validation.version>
<mybatis.version>3.2.8</mybatis.version>
<mybatis-spring.version>1.2.2</mybatis-spring.version>
<druid.version>1.0.9</druid.version>
<standard.version>1.1.2</standard.version>
<log4j.version>1.2.17</log4j.version>
<quartz-all.version>1.6.3</quartz-all.version>
<commons-validator.version>1.4.1</commons-validator.version>
<commons-beanutils.version>1.9.2</commons-beanutils.version>
<commons-lang.version>2.6</commons-lang.version>
<commons-fileupload.version>1.3.1</commons-fileupload.version>
<aspectjweaver.version>1.8.5</aspectjweaver.version>
<bcprov-jdk16.version>1.46</bcprov-jdk16.version>
<ezmorph.version>1.0.6</ezmorph.version>
<sigar.version>1.6.4</sigar.version>
<slf4j-log4j12.version>1.7.10</slf4j-log4j12.version>
<thumbnailator.version>0.4.8</thumbnailator.version>
<json-lib.version>2.4-jdk15</json-lib.version>
<gson.version>2.3.1</gson.version>
<dom4j.version>1.6.1</dom4j.version>
<cglib-nodep.version>3.1</cglib-nodep.version>
<spymemcached.version>2.11.6</spymemcached.version>
<simple-xml.version>2.7.1</simple-xml.version>
<antisamy.version>1.5.3</antisamy.version>
<httpclient.version>4.4</httpclient.version>
<poi.version>3.11</poi.version>
<poi-ooxml.version>3.11</poi-ooxml.version>
<poi-ooxml-schemas.version>3.11</poi-ooxml-schemas.version>
<opencsv.version>2.3</opencsv.version>
<fastjson.version>1.2.4</fastjson.version>
<servlet-api.version>7.0</servlet-api.version>
<jsp-api.version>7.0</jsp-api.version>
<jstl.version>1.2</jstl.version>
<junit.version>4.0</junit.version>
<mysql-connector-java.version>5.1.34</mysql-connector-java.version>

</properties>

<dependencyManagement>
<dependencies>
<!-- spring3.0.5 begin -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-framework</artifactId>
<version>${spring.version}</version>
</dependency>
<!-- spring3.0.5 end -->

<!-- spring3.2.13 begin -->
<!--
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-jdbc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
</dependency>
-->
<!-- spring3.2.13 end -->

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springmodules</groupId>
<artifactId>spring-modules-validation</artifactId>
<version>${spring-modules-validation.version}</version>
</dependency>


<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis</artifactId>
<version>${mybatis.version}</version>
</dependency>
<dependency>
<groupId>org.mybatis</groupId>
<artifactId>mybatis-spring</artifactId>
<version>${mybatis-spring.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>druid</artifactId>
<version>${druid.version}</version>
</dependency>
<dependency>
<groupId>taglibs</groupId>
<artifactId>standard</artifactId>
<version>${standard.version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
<dependency>
<groupId>opensymphony</groupId>
<artifactId>quartz-all</artifactId>
<version>${quartz-all.version}</version>
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
<version>${commons-validator.version}</version>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
<version>${aspectjweaver.version}</version>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcprov-jdk16</artifactId>
<version>${bcprov-jdk16.version}</version>
</dependency>
<dependency>
<groupId>net.sf.ezmorph</groupId>
<artifactId>ezmorph</artifactId>
<version>${ezmorph.version}</version>
</dependency>
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
<version>${commons-beanutils.version}</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
<version>${commons-fileupload.version}</version>
</dependency>
<dependency>
<groupId>org.apache.thrift</groupId>
<artifactId>libthrift</artifactId>
<version>${libthrift.version}</version>
</dependency>
<dependency>
<groupId>org.fusesource</groupId>
<artifactId>sigar</artifactId>
<version>${sigar.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>${slf4j-log4j12.version}</version>
</dependency>
<dependency>
<groupId>net.coobird</groupId>
<artifactId>thumbnailator</artifactId>
<version>${thumbnailator.version}</version>
</dependency>
<dependency>
<groupId>net.sf.json-lib</groupId>
<artifactId>json-lib</artifactId>
<version>${json-lib.version}</version>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>${gson.version}</version>
</dependency>
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>${dom4j.version}</version>
</dependency>
<dependency>
<groupId>cglib</groupId>
<artifactId>cglib-nodep</artifactId>
<version>${cglib-nodep.version}</version>
</dependency>
<dependency>
<groupId>net.spy</groupId>
<artifactId>spymemcached</artifactId>
<version>${spymemcached.version}</version>
</dependency>
<dependency>
<groupId>org.simpleframework</groupId>
<artifactId>simple-xml</artifactId>
<version>${simple-xml.version}</version>
</dependency>
<dependency>
<groupId>org.owasp.antisamy</groupId>
<artifactId>antisamy</artifactId>
<version>${antisamy.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>${poi.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>${poi-ooxml.version}</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml-schemas</artifactId>
<version>${poi-ooxml-schemas.version}</version>
</dependency>
<dependency>
<groupId>net.sf.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>${opencsv.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>fastjson</artifactId>
<version>${fastjson.version}</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
<version>${commons-lang.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>${httpclient.version}</version>
</dependency>
<!--
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.0.1</version>
</dependency>
-->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>${servlet-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
<version>${jsp-api.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jstl</groupId>
<artifactId>jstl</artifactId>
<version>${jstl.version}</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>${mysql-connector-java.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.3.2</version>
<configuration>
<source>${jdk.version}</source>
<target>${jdk.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
</build>

<modules>
<module>../common</module>
<module>../module-datasource</module>
<module>../module-base-dal</module>
<module>../module-dept-dal</module>
<module>../common-web</module>
<module>../admin-dept-biz</module>
<!--
<module>../admin</module>
-->

</modules>

<distributionManagement>
<repository>
<id>frame-releases</id>
<url>http://120.24.200.100:8081/nexus/content/repositories/releases</url>
</repository>
<snapshotRepository>
<id>frame-snapshots</id>
<url>http://120.24.200.100:8081/nexus/content/repositories/snapshots</url>
</snapshotRepository>
</distributionManagement>

</project>
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值