ubuntu14.04安装maven仓库管理器nexus

1 篇文章 0 订阅
1 篇文章 0 订阅

1.准备工作

   由于nexus依赖jdk,所以需要先安装jdk。这里jdk选择jdk8,安装过程可查看博客:ubuntu14.04安装jdk1.8

   nexus源码安装包: nexus-2.12.0-01-bundle.tar.gz    官方下载地址:去下载

2.开始安装

mkdir /home/install
chown -R server: /home/install

2.1把下载好的nexus安装包上传到  /home/install,解压

server@server:/home/install$ tar zxvf nexus-2.12.0-01-bundle.tar.gz 
server@server:/home/install$ ll
total 256564
drwxr-xr-x 4 server server      4096 Jun 21 17:27 ./
drwxr-xr-x 7 root   root        4096 Jun 21 15:46 ../
drwxr-xr-x 8 server server      4096 Dec 17  2015 nexus-2.12.0-01/
-rw-rw-r-- 1 server server  71971402 Jun 21 15:44 nexus-2.12.0-01-bundle.tar.gz
drwxr-xr-x 3 server server      4096 Dec 17  2015 sonatype-work/

2.2 创建nexus文件夹并把解压好的  nexus-2.12.0-01和sonatype-work文件移动到合适的位置。

root@server:/home/install# mkdir -p /home/nexus
root@server:/home/install# mv nexus-2.12.0-01 /home/nexus/
root@server:/home/install# mv sonatype-work/ /home/nexus/

2.3 进入到 /home/nexus文件夹下,并查看文件夹下的内容

root@server:/home/install# cd /home/nexus/
root@server:/home/nexus# ll
total 16
drwxr-xr-x 4 server server 4096 Jun 21 15:47 ./
drwxr-xr-x 7 root   root   4096 Jun 21 15:46 ../
drwxr-xr-x 8 server server 4096 Dec 17  2015 nexus-2.12.0-01/
drwxr-xr-x 3 server server 4096 Dec 17  2015 sonatype-work/
2.4 修改配置文件  /home/nexus/nexus-2.12.0-01/conf/nexus.properties

root@server:/home/nexus# vim nexus-2.12.0-01/conf/nexus.properties

 内容修改如下:

# Sonatype Nexus
# ==============
# This is the most basic configuration of Nexus.


# Jetty section 端口默认为8081,可根据实际需要改为其他的。nexus-webapp-context-path=/nexus 可改为 nexus-webapp-context-path=/ ## 访问时直接ip:port(如 127.0.0.1:8081)即可访问。不改动情况下 ip:port/nexus(127.0.0.1:8081/nexus)访问。其他无须改动。 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
2.5修改配置文件  /home/nexus/nexus-2.12.0-01/bin/nexus

root@server:/home/nexus# vim nexus-2.12.0-01/bin/nexus
修改内容如下:

#-----------------------------------------------------------------------------
# These settings can be modified to fit the needs of your application


# Set this to the root of the Nexus installation  
NEXUS_HOME="/home/nexus/nexus-2.12.0-01"


# If specified, the Wrapper will be run as the specified user.


# IMPORTANT - Make sure that the user has the required privileges to write into the Nexus installation directory.


# NOTE - This will set the user which is used to run the Wrapper as well as
#  the JVM and is not useful in situations where a privileged resource or
#  port needs to be allocated prior to the user being changed.
RUN_AS_USER=root

2.6 修改配置文件  /home/nexus/nexus-2.12.0-01/bin/jsw/conf/wrapper.conf

root@server:/home/nexus# vim nexus-2.12.0-01/bin/jsw/conf/wrapper.conf 
修改内容如下:

#把下面 wrapper.java.command=java 改为 wrapper.java.command=/usr/local/jdk1.8.0/bin/java 即可
#/usr/local/jdk1.8.0/bin/java为java的实际路径
# Set the JVM executable
# (modify this to absolute path if you need a Java that is not on the OS path)
wrapper.java.command=/usr/local/jdk1.8.0/bin/java
2.7 添加用户和组

root@server:/home/nexus# groupadd nexus
root@server:/home/nexus# useradd nexus -g nexus -d /home/nexus -s /bin/sh
root@server:/home/nexus# chown -R nexus: /home/nexus/
3.启动 nexus

root@server:/home/nexus# ./nexus-2.12.0-01/bin/nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT 
**************************************** 
Starting Nexus OSS..
Started Nexus OSS.
trip:警告为不推荐使用root运行

3.1 启动日志   /home/nexus/nexus-2.12.0-01/logs/wrapper.log

root@server:/home/nexus# tail -f nexus-2.12.0-01/logs/wrapper.log 
jvm 1|INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.bootstrap.jetty.InstrumentedSelectChannelConnector - Metrics enabled
jvm 1[jetty-main-1] *SYSTEM org.eclipse.jetty.server.AbstractConnector - Started InstrumentedSelectChannelConnector@0.0.0.0:8081
jvm 1 INFO  [WrapperListener_start_runner] *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Started
jvm 1 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Running
出现 *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - Started 即为成功

root@iZm5ecfgptbi0ae94cbrz8Z:/home/nexus# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 0.0.0.0:8081            0.0.0.0:*               LISTEN      1412/java       
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      963/sshd        
tcp        0      0 127.0.0.1:32000         0.0.0.0:*               LISTEN      1412/java       
udp        0      0 115.28.89.229:123       0.0.0.0:*                           1097/ntpd       
udp        0      0 10.163.182.143:123      0.0.0.0:*                           1097/ntpd       
udp        0      0 127.0.0.1:123           0.0.0.0:*                           1097/ntpd       
udp        0      0 0.0.0.0:123             0.0.0.0:*                           1097/ntpd       
udp6       0      0 :::123                  :::*                                1097/ntpd  
可以看到8081端口已经运行。

在浏览器输入  http://192.168.1.175:8081/nexus/  即可访问















  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值