【maven私库nexus开机自启动】

linux设置nexus开机自启动_linux centos maven私服nexus安装搭建并设置开机启动

linux centos maven私服nexus安装搭建并设置开机启动,这里是用添加服务的方式开机启动nexus。

1.先要下载jdk并安装,配置java环境变量,直接去oracle下载把,这里不多说

2.下载nexus

https://www.sonatype.com/download-oss-sonatype

3.上传到linux

我上传到了/home/software/nexus-3.37.3-02

4.启动试一试# cd /home/software/nexus-3.37.3-02/bin

./nexus start &

起不来就添加权限一下

chmod 777 * //全部添加一下

能起来就访问一下# curl 127.0.0.1:8081

下面设置开机启动

5.修改nexus

设置这里是为了开机用root启动# cd /home/software/nexus-3.37.3-02/bin

vi nexus

找到run_as_user

设置为:run_as_user=root

6.添加服务启动脚本# cd /etc/init.d/

touch nexus

启动脚本就是要放在init.d这个目录

然后在nexus脚本中添加内容

复制代码
#!/bin/bash
#chkconfig:2345 20 90
#description:nexus
#processname:nexus
export JAVA_HOME=/home/software/jdk1.8.0_311
case $1 in
start)
su root /home/software/nexus-3.37.3-02/bin/nexus start;;
stop)
su root /home/software/nexus-3.37.3-02/bin/nexus stop;;
restart)
su root /home/software/nexus-3.37.3-02/bin/nexus restart;;
*)
echo "start|stop|restart";;
esac

7.给脚本设置运行权限# chmod a+x nexus

9.添加服务到系统# chkconfig --add nexus

试一下可不可以运行服务脚本service nexus stop能执行就可以

10.重启试一下是能否开机自动启动成功#reboot

重启centos后再用命令访问一下,看是不是开机启动了:curl 127.0.0.1:8081

相关推荐
jiangxia_102434 分钟前
面试系列:什么是JAVA并发编程中的JUC并发工具类
java·后端
草莓爱芒果43 分钟前
Spring Boot中使用Bouncy Castle实现SM2国密算法(与前端JS加密交互)
java·spring boot·算法
慕y2741 小时前
Java学习第九十三部分——RestTemplate
java·开发语言·学习
旋风菠萝1 小时前
设计模式---单例
android·java·开发语言
AI视觉网奇1 小时前
音频获取长度
java·前端·python
FC_nian2 小时前
IDEA配置(Maven)
java·maven·intellij-idea
汤姆yu2 小时前
基于springboot的快递分拣管理系统
java·spring boot·后端
衍生星球2 小时前
JSP 程序设计之 JSP 基础知识
java·web·jsp
m0_749317522 小时前
力扣-字母异位词
java·算法·leetcode·职场和发展
黑暗也有阳光3 小时前
java中为什么hashmap的大小必须是2倍数
java·后端