1、nexus直接访问
一、环境准备
安装nexus这个软件的时候有点不是很爽,不知道以前nexus版本下载是不是会出现这样的情况,就现在而已(时间:2016.4.25),反正是官网是无法下载的,需要有使用代理去下载,我也是托一位同事帮忙下载的。官网地址就是:http://www.sonatype.org/nexus/archived,我下载的版本是nexus-2.13.0-01,貌似这个服务器需要JDK1.7以上,由于本人是JDK1.8版本,所以没有出现版本兼容情况。
有提供zip和tar.gz格式,随便下哪种都可以。
解压命令:zip---> unzip
tar.gz----->tar zxvf
解压后安装到/opt/nexus目录。
二、解压之后会有两个文件夹,nexus-2.13.0-01和sonatype-work,进入第一个文件夹的bin目录来启动nexus 。
1、进入启动目录,启动
cd nexus-2.13.0-01/bin/
./nexus start
2、这时候提示:
****************************************
WARNING – NOT RECOMMENDED TO RUN AS ROOT
****************************************
If you insist running as root, then set the environment variable RUN_AS_USER=root before running this script.
大概意思就是要在环境配置export RUN_AS_USER=root,临时配置
在命令行下输入:export RUN_AS_USER=root
然后执行./nexus start,就不会再提示了
3、也可以在系统里面永久配置
vim /etc/profile 加入export RUN_AS_USER=root
三、启动之后查看日志(日志路径:nexus/logs)
jvm 1 | 2016-04-27 07:34:44,363+0800 INFO [ar-4-thread-2] *SYSTEM org.sonatype.nexus.proxy.maven.routing.internal.ManagerImpl - Updated and published prefix file of "Snapshots" [id=snapshots]
jvm 1 | 2016-04-27 07:34:44,401+0800 INFO [ar-4-thread-5] *SYSTEM org.sonatype.nexus.proxy.maven.routing.internal.ManagerImpl - Updated and published prefix file of "3rd party" [id=thirdparty]
jvm 1 | 2016-04-27 07:34:44,728+0800 INFO [ar-4-thread-4] *SYSTEM org.sonatype.nexus.proxy.maven.routing.internal.ManagerImpl - Updated and published prefix file of "Releases" [id=releases]
jvm 1 | 2016-04-27 07:34:44,808+0800 INFO [jetty-main-1] *SYSTEM org.sonatype.nexus.rest.NexusApplication_UriMatching - Strict URI matching: true
jvm 1 | 2016-04-27 07:34:44,971+0800 INFO [jetty-main-1] *SYSTEM org.sonatype.nexus.configuration.ModelUtils - Loading model /opt/sonatype-work/nexus/conf/lvo-plugin.xml
jvm 1 | 2016-04-27 07:34:44,999+0800 INFO [jetty-main-1] *SYSTEM org.sonatype.nexus.configuration.ModelUtils - Loading model /opt/sonatype-work/nexus/conf/ldap.xml
jvm 1 | 2016-04-27 07:34:46,037+0800 INFO [jetty-main-1] *SYSTEM org.sonatype.nexus.webresources.internal.WebResourceServiceImpl - Discovered 1971 resources
jvm 1 | 2016-04-27 07:34:46,038+0800 INFO [jetty-main-1] *SYSTEM org.sonatype.nexus.webresources.internal.WebResourceServlet - Max-age: 30 days (2592000 seconds)
jvm 1 | 2016-04-27 07:34:46,229+0800 INFO [jetty-main-1] *SYSTEM org.sonatype.nexus.bootstrap.jetty.InstrumentedSelectChannelConnector - Metrics enabled
jvm 1 | 2016-04-27 07:34:46,305+0800 INFO [jetty-main-1] *SYSTEM org.eclipse.jetty.server.AbstractConnector -Started InstrumentedSelectChannelConnector@0.0.0.0:8081
jvm 1 | 2016-04-27 07:34:46,306+0800 INFO [jetty-main-1] *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Running
jvm 1 | 2016-04-27 07:34:46,306+0800 INFO [WrapperListener_start_runner] *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Started
jvm 1 | 2016-04-27 07:34:46,548+0800 INFO [ar-4-thread-3] *SYSTEM org.sonatype.nexus.proxy.storage.remote.httpclient.HttpClientRemoteStorage - Initializing remote transport for proxy repository "Apache Snapshots" [id=apache-snapshots]...
jvm 1 | 2016-04-27 07:34:47,603+0800 INFO [ar-4-thread-1] *SYSTEM org.sonatype.nexus.proxy.storage.remote.httpclient.HttpClientRemoteStorage - Initializing remote transport for proxy repository "Central" [id=central]...
jvm 1 | 2016-04-27 07:34:50,829+0800 INFO [ar-4-thread-1] *SYSTEM org.sonatype.nexus.proxy.maven.routing.internal.ManagerImpl - Updated and published prefix file of "Public Repositories" [id=public]
如果出现了红字部分相类似的提示,则说明你安装成功啦!
四、访问 http:/xx:8081/nexus
默认管理员用户名/密码: admin/admin123 , 此时发现并不能成功,因为我是用的linux系统版本是centos7,默认是开启了防火墙,所以有些端口需要自己手动开放。因为8081是需要对外开放的端口,此时需要输入如下命令:具体参考大神前辈写的:http://blog.csdn.net/zhouygjp/article/details/5059269
2、nexus设置为linux的访问服务,官网对各种环境下配置成服务的解释
以root用户身份,设置为系统服务
cd /etc/init.d
cp /usr/local/nexus/bin /nexus ./nexus
chmod 755 /etc/init.d/nexus
在Red Hat, Fedora, and CentOS中增加nexus服务
$ cd /etc/init.d
增加nexus服务
$ chkconfig --add nexus
添加运行级别3、4、5
$ chkconfig --levels 345 nexus on
启动nexus
$ service nexus start
验证关系成功启动
$ tail -f /usr/local/nexus/logs/wrapper.log
编辑/etc/init.d/nexus的文本
NEXUS_HOME="你安装的根目录"
PIDDIR="${NEXUS_HOME}"
RUN_AS_USER = "nexus" 此处用户名可随意选择,最好不要是root
注:①如果使用root,未创建其它用户,则改为root(不建议使用root)
②如果使用该设置,需要:
• nexus 用户存在
useradd nexus
• 更改nexus 安装目录的Owner和Group为nexus
chown nexus nexus nexus
启动服务
service nexus start
OK。访问成功!大家可以试试!