centos7安装nexus3私服

CentOs7安装nexus3私服

获取解压nexus-3.9.0-01-unix.tar.gz
[root@localhost www]# wget https://sonatype-download.global.ssl.fastly.net/nexus/3/nexus-3.9.0-01-unix.tar.gz
[root@localhost www]# tar -xvf nexus-3.9.0-01-unix.tar.gz
[root@localhost www]# mv nexus-3.9.0-01 /opt/soft/
[root@localhost www]# ln -s /opt/soft/nexus-3.9.0-01 /opt/shortcut/nexus
创建nexu用户
[root@localhost www]# useradd -d "/home/nexus" -m -s "/sbin/nologin" nexus
[root@localhost www]# chown -R nexus:nexus /opt/shortcut/nexus
[root@localhost www]# chown -R nexus:nexus /opt/soft/sonatype-work (nexus的日志记录文件,不然启动不了)

//如果没有chown -R nexus:nexus /opt/soft/sonatype-work给sonatype-work目录授权,
//这个目录在`/opt/shortcut/nexus/bin/nexus.vmoptions`文件中指定,其中`/opt/shortcut/nexus/`是nexus的安装目录
Last login: Fri Mar  2 21:31:24 EST 2018 on pts/0
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to Permission denied
Warning:  Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
Warning:  Forcing option -XX:LogFile=/tmp/jvm.log
Unable to delete file: /opt/soft/sonatype-work/nexus3/cache/bundle262/version0.0/revision.location
Unable to update instance pid: /opt/soft/sonatype-work/nexus3/instances/instance.properties (Permission denied)
修改配置

进入/opt/shortcut/nexus/bin目录,查看文件

[root@localhost bin]# ll
total 32
drwxr-xr-x. 2 nexus nexus  4096 Mar  2 20:42 contrib
-rwxr-xr-x. 1 nexus nexus 17269 Feb 21 17:24 nexus
-rw-r--r--. 1 nexus nexus    36 Mar  2 21:12 nexus.rc
-rw-r--r--. 1 nexus nexus   465 Feb 21 17:24 nexus.vmoptions

修改nexus.rc中的run_as_usernexus

# run_as_user=""
run_as_user="nexus"

查看nexus.vmoptions文件

[root@localhost bin]# vi nexus.vmoptions
-Xms1200M
-Xmx1200M
-XX:MaxDirectMemorySize=2G
-XX:+UnlockDiagnosticVMOptions
-XX:+UnsyncloadClass
-XX:+LogVMOutput
-XX:LogFile=../sonatype-work/nexus3/log/jvm.log (日志目录)
-XX:-OmitStackTraceInFastThrow
-Djava.net.preferIPv4Stack=true
-Dkaraf.home=.
-Dkaraf.base=.
-Dkaraf.etc=etc/karaf
-Djava.util.logging.config.file=etc/karaf/java.util.logging.properties
-Dkaraf.data=../sonatype-work/nexus3
-Djava.io.tmpdir=../sonatype-work/nexus3/tmp
-Dkaraf.startLocalConsole=false

进入/opt/shortcut/nexus/etc目录

[root@localhost etc]# ll
total 8
drwxr-xr-x. 2 nexus nexus  171 Mar  2 20:42 fabric
drwxr-xr-x. 2 nexus nexus  157 Mar  2 20:42 jetty
drwxr-xr-x. 2 nexus nexus 4096 Mar  2 20:42 karaf
drwxr-xr-x. 2 nexus nexus   51 Mar  2 20:42 logback
-rw-r--r--. 1 nexus nexus  349 Mar  2 21:36 nexus-default.properties
drwxr-xr-x. 2 nexus nexus   26 Mar  2 20:42 ssl

修改nexus-default.properties中的port和host属性,其中host属性不能写127.0.0.1localhost[这个我访问不了],最后写的是DHCP(动态获取ip地址)时的ip地址

## DO NOT EDIT - CUSTOMIZATIONS BELONG IN $data-dir/etc/nexus.properties
##
# Jetty section
application-port=8081
application-host=192.168.1*9.1*0
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
nexus-context-path=/

# Nexus section
nexus-edition=nexus-pro-edition
nexus-features=\
 nexus-pro-feature
开放防火墙端口
[root@localhost etc]# firewall-cmd --zone=public --add-port=8081/tcp --permanent
[root@localhost etc]# firewall-cmd --reload
启动和访问

启动命令

[root@localhost bin]# ./nexus start //后台启动,不显示日志
[root@localhost bin]# ./nexus run & //后台启动,显示日志

//启动成功
-------------------------------------------------

Started Sonatype Nexus OSS 3.9.0-01

-------------------------------------------------

访问http://192.168.1*9.1*0:8081
这里写图片描述

  • 0
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值