码迷,mamicode.com
首页 > 其他好文 > 详细

CentOS7配置nexus开机自启动

时间:2020-04-08 09:40:28      阅读:398      评论:0      收藏:0      [点我收藏+]

标签:配置文件   img   lin   端口   ant   load   this   his   image   

CentOS7配置nexus开机自启动

新建nexus启动脚本

进入/etc/init.d目录,新建脚本文件nexus

// 进入/etc/init.d
[root@linux_maven etc]# cd /etc/init.d/

// 新建脚本文件nexus
[root@linux_maven init.d]# vim nexus

脚本内容:

#!/bin/bash
#chkconfig:2345 20 90
#description:nexus
#processname:nexus

export JAVA_HOME=/root/apps/jdk1.8/

case $1 in
        start) su root /usr/local/nexus3.21/bin/nexus start;;
        stop) su root /usr/local/nexus3.21/bin/nexus stop;;
        status) su root /usr/local/nexus3.21/bin/nexus status;;
        restart) su root /usr/local/nexus3.21/bin/nexus restart;;
        dump) su root /usr/local/nexus3.21/bin/nexus dump;;
        console) su root /usr/local/nexus3.21/bin/nexus console;;
        *) echo "Usage: nexus {start|stop|run|run-redirect|status|restart|force-reload}"
esac

设置脚本权限

[root@linux_maven init.d]# chmod +x /etc/init.d/nexus 

使用service命令使用nexus

[root@linux_maven init.d]# service nexus status
WARNING: ************************************************************
WARNING: Detected execution as "root" user.  This is NOT recommended!
WARNING: ************************************************************
nexus is running.

添加到开机启动

[root@linux_maven init.d]# chkconfig nexus on

查看nexus开机启动

[root@linux_maven ~]# 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

设置防火墙

// 进入防火墙设置文件目录
[root@linux_maven init.d]# cd /etc/firewalld/zones/
// 使用vim, 修改防火墙配置文件
[root@linux_maven zones]# vim public.xml

添加以下放开端口内容, 其它不变

  <rule family="ipv4">
  <!-- 开放8081端口给任意ip  -->
  <port protocol="tcp" port="8081"/>
  <accept/>
  </rule>

技术图片


参考来源

【Nexus】--设置开机自启动
Centos7 firewall防火墙常用配置

CentOS7配置nexus开机自启动

标签:配置文件   img   lin   端口   ant   load   this   his   image   

原文地址:https://www.cnblogs.com/vitoboy/p/12657581.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!