您的位置:首页 > 其它

ubuntu安装maven仓库nexus - 1

2016-05-24 11:13 597 查看
转自:http://blog.csdn.net/dengsilinming/article/details/17635191

现在简述一下在ubuntu下面安装nexus的步骤(这里默认已经安装好了JDK,JDK的安装可以参考的我另一篇文章ubuntu10.0.4安装和卸载jdk):

1. 下载nexus 下载最新版nexus(到目前为止最新版为nexus-2.7.0-05,下载地址http://www.sonatype.org/nexus/go,得到nexus-latest-bundle.tar.gz

2. 下载完成后将nexus-latest-bundle.tar.gz拷贝到/usr/local/目录下,并进入/usr/local目录

[html] view
plain copy







#:sudo cp nexus-latest-bundle.tar.gz /usr/local/

#:cd /usr/local

3. 解压nexus-latest-bundle.tar.gz,得到nexus-2.7.0-05和sonatype-work,并做一个软链接

[html] view
plain copy







tar -zxvf nexus-latest-bundle.tar.gz

ln -s nexus-2.7.0-04 nexus2

4.运行nexus

[html] view
plain copy







cd nexus2

./bin/nexus start

如果运气好会运行成功,这里之所以说运气,是因为各种原因会造成运行失败,如果成功会看到如下显示信息:

[html] view
plain copy







Starting Nexus OSS....

Started Nexus OSS

如果失败会看到:

[html] view
plain copy







Starting Nexus OSS...

Failed to start Nexus OSS.

引起失败的原因可能是权限问题:nexus所在的安装目录属于私有权限,它的拥有者是root用户,这时需要将nexus所在的目录分配给当前用户(Nexus不建议用root权限启动运行nexus),这里的授权就自己去看chown命令的用法了;
如果安装成功但在浏览器中访问不了(访问默认地址:http://localhost:8081/nexus),通过查看wrapper.log日志可能会看到“Unable to start java JVM:No such file or directory",此时需要将wrapper.conf文件里面的wapper.java.command=java修改成wapper.java.command=%JAVA_HOME%/bin/java(就是安装jdk所在的文件路径);
此外还有各种异常出现,这里就不再罗列,大家遇到就自己上网google吧。
下面说下我在安装后启动时遇到的问题:
1. Unable to start java JVM:No such file or directory,解决方法,修改wapper.conf配置文件里面的wapper.java.command。我开始修改成wapper.java.command={JAVA_HOME}/bin/java,但根本不起作用,看网上很我资料也说是改成那样,最后无意中看到一篇文章(具体是哪篇忘记了)说是改wapper.java.command=%JAVA_HOME%/bin/java,要用%%而不是用{}。

2.还有一个问题就是启动时报如下异常

[html] view
plain copy







/usr/local/nexus$ ./bin/nexus console

Running Nexus OSS...

wrapper | --> Wrapper Started as Console

wrapper | Launching a JVM...

jvm 1 | Wrapper (Version 3.2.3) http://wrapper.tanukisoftware.org
jvm 1 | Copyright 1999-2006 Tanuki Software, Inc. All Rights Reserved.

jvm 1 |

jvm 1 | 2013-12-31 20:07:56 INFO [WrapperListener_start_runner] - org.sonatype.nexus.bootstrap.jsw.JswLauncher - Starting with arguments: [./conf/jetty.xml]

jvm 1 | 2013-12-31 20:07:56 INFO [WrapperListener_start_runner] - org.sonatype.nexus.bootstrap.jsw.JswLauncher - JVM ID: 1, JVM PID: 2594, Wrapper PID: 2592, User: linming

jvm 1 | 2013-12-31 20:07:56 INFO [WrapperListener_start_runner] - org.sonatype.nexus.bootstrap.jsw.JswLauncher - Current directory: /usr/local/nexus-2.7.0-05

jvm 1 | 2013-12-31 20:07:57 INFO [WrapperListener_start_runner] - org.sonatype.nexus.bootstrap.jsw.JswLauncher - Temp directory: /usr/local/sonatype-work/nexus/tmp

jvm 1 | 2013-12-31 20:07:57 ERROR [WrapperListener_start_runner] - org.sonatype.nexus.bootstrap.jsw.JswLauncher - Failed to start

jvm 1 | java.nio.file.AccessDeniedException: /usr/local/sonatype-work/nexus/tmp

jvm 1 | at sun.nio.fs.UnixException.translateToIOException(UnixException.java:84) ~[na:1.7.0_07]

jvm 1 | at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:102) ~[na:1.7.0_07]

jvm 1 | at sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:107) ~[na:1.7.0_07]

jvm 1 | at sun.nio.fs.UnixFileSystemProvider.createDirectory(UnixFileSystemProvider.java:382) ~[na:1.7.0_07]

jvm 1 | at java.nio.file.Files.createDirectory(Files.java:628) ~[na:1.7.0_07]

jvm 1 | at java.nio.file.Files.createAndCheckIsDirectory(Files.java:732) ~[na:1.7.0_07]

jvm 1 | at java.nio.file.Files.createDirectories(Files.java:718) ~[na:1.7.0_07]

jvm 1 | at org.sonatype.nexus.bootstrap.Launcher.ensureTmpDirSanity(Launcher.java:247) ~[nexus-bootstrap-2.7.0-05.jar:2.7.0-05]

jvm 1 | at org.sonatype.nexus.bootstrap.Launcher.start(Launcher.java:95) ~[nexus-bootstrap-2.7.0-05.jar:2.7.0-05]

解决方法:

[html] view
plain copy







sudo chmod -R 777 sonatype-work/nexus

功夫不负有心人,看上去很简单的安装、启动操作,却让我费尽了脑汁(也许与我不太熟悉有关系),这里最想说的是动手、动手、最终还是得自己多动手。
在浏览器中访问:localhost:8081/nexus,OK,能成功访问,输入用户名与密码(默认的admin、admin123)就可以管理自己的maven本地仓库了
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: