linux安装nexus(支持jdk1.7)并设置开机启动

版本:nexus-2.6.4-02-bundle
这个版本jdk需要1.7或以上
注:nexus 2.6版本之后不再支持jdk1.6
nexus 2.5.x nexus最后一个支持jdk1.6版本的

1创建安装目录

[root@xiniu maven]# mkdir -p /usr/java/nexus

2上传文件
这里写图片描述

3解压缩

[root@xiniu nexus]# ls
nexus-2.6.4-02-bundle.zip
[root@xiniu nexus]# unzip nexus-2.6.4-02-bundle.zip

4为了方便更新和切换版本,创建链接,更新或者切换版本只需更新链接即可:

[root@xiniu nexus]# ln -s nexus-2.6.4-02  nexus

5 修改配置文件

[root@xiniu bin]# cd /usr/java/nexus/nexus/conf 
[root@xiniu conf]# ls
examples  jetty.xml  logback.xml  nexus.properties
[root@xiniu conf]# vi  nexus.properties


修改内容

 #Jetty section
 application-port=8081      ##修改Jetty端口号
 # nexus section
 nexus-work=${bundleBasedir}/../sonatype-work/nexus  

6 配置用户

[root@xiniu conf]# vi /usr/java/nexus/nexus/bin/nexus

使用/查询字符串 ,使用n查询下一个

修改内容
#RUN_AS_USER=

RUN_AS_USER=root

这里写图片描述
7若有设置防火墙,需前往修改防火墙配置并重启防火墙
centos7.3关闭防火墙
关闭firewall:

systemctl stop firewalld.service #停止firewall
systemctl disable firewalld.service #禁止firewall开机启动
firewall-cmd --state #查看默认防火墙状态(关闭后显示notrunning,开启后显示running)



[root@xiniu ~]# systemctl stop firewalld.service
[root@xiniu ~]# systemctl disable firewalld.service
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
Removed symlink /etc/systemd/system/basic.target.wants/firewalld.service.
[root@xiniu ~]# firewall-cmd --state
not running

8 启动nexus

[root@xiniu /]# cd /usr/java/nexus/nexus/bin
[root@xiniu bin]# ./nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
Starting Nexus OSS...
Started Nexus OSS.

9在浏览器打开:http://ip:8081/nexus,登录:用户名admin 默认密码:admin123
这里写图片描述

10
这里写图片描述
11
这里写图片描述
12这里写图片描述

设置开机启动
1、
进入到/etc/init.d目录下,新建一个nexus脚本
cd /etc/init.d

vi nexus
内容

#!/bin/bash 
#chkconfig:2345 20 90     
#description:nexus    
#processname:nexus    
export JAVA_HOME=/usr/java/jdk1.7.0_79
case $1 in    
        start) su root /usr/java/nexus/nexus/bin/nexus start;;    
        stop) su root /usr/java/nexus/nexus/bin/nexus stop;;    
        status) su root /usr/java/nexus/nexus/bin/nexus status;;    
        restart) su root /usr/java/nexus/nexus/bin/nexus restart;;    
        dump ) su root /usr/java/nexus/nexus/bin/nexus dump ;; 
        console ) su root /usr/java/nexus/nexus/bin/nexus console ;;        
        *) echo "require console | start | stop | restart | status | dump " ;;    
esac

2
给脚本添加执行权限

chmod +x nexus

3 添加系统服务

#chkconfig --add nexus
#chkconfig --levels 345 nexus on

4.查看开机自启的服务中是否已经有我们的nexus

[root@localhost init.d]# chkconfig --list nexus 

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

      If you want to list systemd services use 'systemctl list-unit-files'.
      To see services enabled on particular target use
      'systemctl list-dependencies [target]'.

nexus           0:off   1:off   2:on    3:on    4:on    5:on    6:off
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值