Linux下安装nexus私服

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

[html]  view plain  copy
  1. firewall-cmd --permanent --add-port=8888/tcp  
  2. firewall-cmd --permanent --add-port=8080/tcp  
  3. firewall-cmd --permanent --add-port=80/tcp  
  4. firewall-cmd --permanent --add-port=5050/tcp  
  5.   
  6. 重新加载  
  7.   
  8. firewall-cmd --reload  
  9.   
  10. 确认是否开放  
  11.   
  12. firewall-cmd --list-all  

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

添加运行级别345

$ 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 安装目录的OwnerGroupnexus

chown nexus nexus nexus

启动服务 

service nexus start

OK。访问成功!大家可以试试!
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值