【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

相关推荐
xieliyu.8 小时前
Java算法精讲:双指针(三)
java·开发语言·算法
明夜之约8 小时前
Spring Boot 自动装配源码
java·spring boot·后端
Leaton Lee8 小时前
Spring Boot分层架构详解:从Controller到Service再到Mapper的完整流程
java·spring boot·后端·架构
Jinkxs8 小时前
Resilience4j- 与 Spring Boot 快速集成:自动配置与基础注解使用
java·spring boot·后端
辣机小司8 小时前
【踩坑记录:Spring Boot 配置文件读取值不一致?警惕 YAML 的“八进制陷阱”与 SnakeYAML 版本之谜】
java·spring boot·后端·yaml·踩坑记录
fangdengfu1239 小时前
ES分析系统各个服务日志占用量
java·前端·elasticsearch
云烟成雨TD9 小时前
Spring AI 1.x 系列【51】可观测性技术选型
java·人工智能·spring
星越华夏9 小时前
ESP32-CAM图像传输项目说明文档
java·后端·struts·esp32
Jinkxs10 小时前
Java 跨域14-Java 与区块链(Hyperledger)集成
java·开发语言·区块链
晨曦中的暮雨11 小时前
Golang速通(Javaer版)
java·开发语言·后端·golang