Linux下搭建maven服务器nexus

1.下载nexus
http://download.sonatype.com/nexus/oss/nexus-2.11.1-01-bundle.zip这个地址下载,下载到的文件是nexus-2.11.1-01-bundle.zip
2.解压到相应的目录下
unzip nexus-2.11.1-01-bundle.zip,我这边是存放在/home/www/chendq/nexus 下
3.设置系统服务

[www@AY1302250124419032557 bin]$ cd /etc/init.d/
[www@AY1302250124419032557 init.d]$ cp /home/www/chendq/nexus/nexus-2.11.1-01/bin/nexus ./nexus

这里显示权限不够,切换为root用户

[www@AY1302250124419032557 init.d]$ su root
口令:
[root@AY1302250124419032557 init.d]# cp /home/www/chendq/nexus/nexus-2.11.1-01/bin/nexus ./nexus
[root@AY1302250124419032557 init.d]# chmod 755 nexus
[root@AY1302250124419032557 init.d]# chkconfig --add nexus                      #增加nexus服务
[root@AY1302250124419032557 init.d]#chkconfig --levels 345 nexus on             #添加运行级别3、4、5

有些机器可能不行,找/etc/目录下或者/etc/init.d/目录下的rc.local,
添加一行服务

/home/www/chendq/nexus/nexus-2.11.1-01/bin/nexus start

4.启动服务

[root@AY1302250124419032557 etc]# su www
[www@AY1302250124419032557 bin]$ cd ~/chendq/nexus/nexus-2.11.1-01/bin/
[www@AY1302250124419032557 bin]$ ./nexus start
Starting Nexus OSS...
Started Nexus OSS.
[www@AY1302250124419032557 bin]$ ps -ef |grep nexus
www      28633     1  0 17:21 ?        00:00:00 /home/www/chendq/nexus/nexus-2.11.1-01/bin/../bin/jsw/linux-x86-64/wrapper /home/www/chendq/nexus/nexus-2.11.1-01/bin/../bin/jsw/conf/wrapper.conf wrapper.syslog.ident=nexus wrapper.pidfile=/home/www/chendq/nexus/nexus-2.11.1-01/bin/../bin/jsw/linux-x86-64/nexus.pid wrapper.daemonize=TRUE
www      28637 28633 76 17:21 ?        00:00:06 java -XX:MaxPermSize=192m -Djava.io.tmpdir=./tmp -Djava.net.preferIPv4Stack=true -Dcom.sun.jndi.ldap.connect.pool.protocol=plain ssl -Xms256m -Xmx768m -Djava.library.path=bin/jsw/lib -classpath bin/jsw/lib/wrapper-3.2.3.jar:./lib/logback-classic-1.1.2.jar:./lib/jetty-jmx-8.1.11.v20130520.jar:./lib/plexus-interpolation-1.16.jar:./lib/javax.servlet-3.0.0.v201112011016.jar:./lib/jetty-continuation-8.1.11.v20130520.jar:./lib/nexus-bootstrap-2.11.1-01.jar:./lib/jetty-http-8.1.11.v20130520.jar:./lib/jetty-rewrite-8.1.11.v20130520.jar:./lib/jetty-xml-8.1.11.v20130520.jar:./lib/jetty-server-8.1.11.v20130520.jar:./lib/jetty-servlet-8.1.11.v20130520.jar:./lib/metrics-logback-2.2.0.jar:./lib/jetty-util-8.1.11.v20130520.jar:./lib/jul-to-slf4j-1.7.6.jar:./lib/metrics-core-2.2.0.jar:./lib/logback-access-1.1.2.jar:./lib/slf4j-api-1.7.6.jar:./lib/logback-core-1.1.2.jar:./lib/jetty-webapp-8.1.11.v20130520.jar:./lib/metrics-jetty-2.2.0.jar:./lib/jetty-security-8.1.11.v20130520.jar:./lib/jetty-deploy-8.1.11.v20130520.jar:./lib/jetty-io-8.1.11.v20130520.jar:./lib/jetty-client-8.1.11.v20130520.jar:./conf/ -Dwrapper.key=_AgRsJXb2WXyLipx -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=28633 -Dwrapper.version=3.2.3 -Dwrapper.native_library=wrapper -Dwrapper.service=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1 org.sonatype.nexus.bootstrap.jsw.JswLauncher ./conf/jetty.xml ./conf/jetty-requestlog.xml
www      28671 28560  0 17:21 pts/0    00:00:00 grep nexus

查看日志,日志路径在安装目录下的logs
打开日志

[www@AY1302250124419032557 logs]$ vi wrapper.log 

查看到错误信息

7 jvm 1    | 2015-06-10 17:22:21,921+0800 WARN  [jetty-main-1] *SYSTEM org.eclipse.jetty.util.component.AbstractLifeCycle - FAILED org.eclipse.jetty.server.Server@5d5d0293: java.net.BindException: 地址已
    在使用
208 jvm 1    | java.net.BindException: 地址已在使用
209 jvm 1    |  at sun.nio.ch.Net.bind0(Native Method) ~[na:1.7.0_15]
210 jvm 1    |  at sun.nio.ch.Net.bind(Net.java:344) ~[na:1.7.0_15]
211 jvm 1    |  at sun.nio.ch.Net.bind(Net.java:336) ~[na:1.7.0_15]
212 jvm 1    |  at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:199) ~[na:1.7.0_15]
213 jvm 1    |  at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.7.0_15]
214 jvm 1    |  at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:187) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
215 jvm 1    |  at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
216 jvm 1    |  at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:265) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
217 jvm 1    |  at org.sonatype.nexus.bootstrap.jetty.InstrumentedSelectChannelConnector.doStart(InstrumentedSelectChannelConnector.java:85) ~[nexus-bootstrap-2.11.1-01.jar:2.11.1-01]
218 jvm 1    |  at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) ~[jetty-util-8.1.11.v20130520.jar:8.1.11.v20130520]
219 jvm 1    |  at org.eclipse.jetty.server.Server.doStart(Server.java:293) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
220 jvm 1    |  at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) ~[jetty-util-8.1.11.v20130520.jar:8.1.11.v20130520]
221 jvm 1    |  at org.sonatype.nexus.bootstrap.jetty.JettyServer$JettyMainThread.run(JettyServer.java:247) [nexus-bootstrap-2.11.1-01.jar:2.11.1-01]
222 jvm 1    | 2015-06-10 17:22:21,922+0800 ERROR [WrapperListener_start_runner] *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Start failed
223 jvm 1    | java.net.BindException: 地址已在使用
224 jvm 1    |  at sun.nio.ch.Net.bind0(Native Method) ~[na:1.7.0_15]
225 jvm 1    |  at sun.nio.ch.Net.bind(Net.java:344) ~[na:1.7.0_15]
226 jvm 1    |  at sun.nio.ch.Net.bind(Net.java:336) ~[na:1.7.0_15]
227 jvm 1    |  at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:199) ~[na:1.7.0_15]
228 jvm 1    |  at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74) ~[na:1.7.0_15]
229 jvm 1    |  at org.eclipse.jetty.server.nio.SelectChannelConnector.open(SelectChannelConnector.java:187) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
230 jvm 1    |  at org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:316) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
231 jvm 1    |  at org.eclipse.jetty.server.nio.SelectChannelConnector.doStart(SelectChannelConnector.java:265) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
232 jvm 1    |  at org.sonatype.nexus.bootstrap.jetty.InstrumentedSelectChannelConnector.doStart(InstrumentedSelectChannelConnector.java:85) ~[nexus-bootstrap-2.11.1-01.jar:2.11.1-01]
233 jvm 1    |  at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) ~[jetty-util-8.1.11.v20130520.jar:8.1.11.v20130520]
234 jvm 1    |  at org.eclipse.jetty.server.Server.doStart(Server.java:293) ~[jetty-server-8.1.11.v20130520.jar:8.1.11.v20130520]
235 jvm 1    |  at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:64) ~[jetty-util-8.1.11.v20130520.jar:8.1.11.v20130520]
236 jvm 1    |  at org.sonatype.nexus.bootstrap.jetty.JettyServer$JettyMainThread.run(JettyServer.java:247) ~[nexus-bootstrap-2.11.1-01.jar:2.11.1-01]
237 jvm 1    | 2015-06-10 17:22:21,922+0800 ERROR [WrapperListener_start_runner] *SYSTEM org.sonatype.nexus.bootstrap.jsw.JswLauncher - Failed to start
238 jvm 1    | java.net.BindException: 地址已在使用

修改端口号

[www@AY1302250124419032557 conf]$ cd /home/www/chendq/nexus/nexus-2.11.1-01/conf
[www@AY1302250124419032557 conf]$ vi nexus.properties 

把application-port=8081 修改为application-port=8981
重启nexus

首先查看下进程ps -ef |grep nexus
有进程的话kill掉
再启动nexus

判断是否启动成功
输入地址:http://IP地址:8981/nexus/index.html#welcome,是否显示页面

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。