版本: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
posted on 2017-08-01 17:40  2637282556  阅读(439)  评论(0编辑  收藏  举报