【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

相关推荐
lUie INGA4 小时前
在2023idea中如何创建SpringBoot
java·spring boot·后端
geBR OTTE4 小时前
SpringBoot中整合ONLYOFFICE在线编辑
java·spring boot·后端
Porunarufu4 小时前
博客系统UI自动化测试报告
java
Aurorar0rua5 小时前
CS50 x 2024 Notes C - 05
java·c语言·数据结构
Cosmoshhhyyy6 小时前
《Effective Java》解读第49条:检查参数的有效性
java·开发语言
布谷歌6 小时前
常见的OOM错误 ( OutOfMemoryError全类型详解)
java·开发语言
eLIN TECE7 小时前
springboot和springframework版本依赖关系
java·spring boot·后端
老神在在0017 小时前
Spring Bean 的六种作用域详解
java·后端·spring
仙草不加料7 小时前
互联网大厂Java面试故事实录:三轮场景化技术提问与详细答案解析
java·spring boot·微服务·面试·aigc·电商·内容社区
程序员老邢7 小时前
【技术底稿 19】Redis7 集群密码配置 + 权限锁死 + 磁盘占满连锁故障真实排查全记录
java·服务器·经验分享·redis·程序人生·微服务