【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

相关推荐
苦瓜小生12 分钟前
【前端】|【js手撕】经典高频面试题:手写实现function.call、apply、bind
java·前端·javascript
NGC_66111 小时前
Java 线程池:execute () 和 submit () 到底有什么区别?
java
cngm1101 小时前
解决麒麟v10下tomcat无法自动启动的问题
java·tomcat
色空大师1 小时前
【网站搭建实操(一)环境部署】
java·linux·数据库·mysql·网站搭建
客卿1231 小时前
牛客刷题--找数字-- 字符串检测-字符串 双指针
java·开发语言
烛之武1 小时前
SpringBoot基础
java·spring boot·后端
Amour恋空2 小时前
Java多线程
java·开发语言·python
小胖java2 小时前
高校培养方案制定系统
java·spring
常利兵2 小时前
Spring项目新姿势:Lambda封装Service调用,告别繁琐注入!
java·数据库·spring
sjmaysee3 小时前
Java框架SpringBoot(一)
java·开发语言·spring boot