nexus "root" user. This is NOT recommended

來源:本站原創 IT必備工具 超過6,084 views圍觀 0條評論

[[email protected]]# /opt/nexus/bin/nexus start
WARNING: ************************************************************
WARNING: Detected execution as "root" user.  This is NOT recommended!
WARNING: ************************************************************
Starting nexus
[[email protected]]#
[[email protected]]#
[[email protected]]# /opt/nexus/bin/nexus status
WARNING: ************************************************************
WARNING: Detected execution as "root" user.  This is NOT recommended!
WARNING: ************************************************************
Error: Could not find or load main class com.install4j.runtime.launcher.UnixLauncher

 

Aug 07 10:29:03 ip-172-31-47-229.ap-northeast-1.compute.internal nexus[10018]: Error: Could not find or load main class com.install4j.runtime.launcher.UnixLauncher

解決

setp1:移動文件到正常位置
[[email protected] nexus]# find / -name *install4j*   ——–查找
/root/.install4j
/tmp/nexus-3.12.1-01/.install4j
/tmp/nexus-3.12.1-01/.install4j/user/install4j-common-1.1.1.jar
/tmp/nexus-3.12.1-01/.install4j/user/install4j-slf4j-1.1.1.jar
[[email protected] nexus]# cp /tmp/nexus-3.12.1-01/.install4j .
cp: omitting directory ‘/tmp/nexus-3.12.1-01/.install4j’
[[email protected] nexus]# cp -a /tmp/nexus-3.12.1-01/.install4j .   —–放到nexus目錄

setp2:然后用run進行測試
[[email protected] nexus]# /opt/nexus/bin/nexus run
Last login: Tue Aug  7 11:33:53 UTC 2018 on pts/1
OpenJDK 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to Permission denied–無權限

Warning:  Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
Warning:  Forcing option -XX:LogFile=/tmp/jvm.log
Unable to update instance pid: Unable to create directory /opt/sonatype-work/nexus3/instances
/opt/sonatype-work/nexus3/log/karaf.log (Permission denied)
Unable to update instance pid: Unable to create directory /opt/sonatype-work/nexus3/instances
[[email protected] nexus]# id nexus
id: nexus: no such user
[[email protected] nexus]# ll ../sonatype-work/nexus3/log/jvm.log
-rw-r–r–. 1 root root 3833 Aug  7 10:49 ../sonatype-work/nexus3/log/jvm.log
[[email protected] nexus]#

setp3:修改用戶
vim ./bin/nexus.rc
run_as_user="ec2-user"
vim nexus
run_as_user="ec2-user"

setp4:修改權限為ec2-user
chown ec2-user:ec2-user -R nexus
cd /opt/
chown ec2-user:ec2-user -R *

setp5:繼續測試
/opt/nexus/bin/nexus run 

測試正常
[[email protected]_jenkins001 ~]# !net
netstat -ntlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name   
tcp        0      0 127.0.0.1:41025         0.0.0.0:*               LISTEN      18390/java         
tcp        0      0 0.0.0.0:8081            0.0.0.0:*               LISTEN      18390/java

setp6:使用命令起動服務
systemctl status nexus

[[email protected] ~]# systemctl status nexus
● nexus.service – nexus service
   Loaded: loaded (/usr/lib/systemd/system/nexus.service; enabled; vendor preset: disabled)
   Active: active (running) since Tue 2018-08-07 11:46:32 UTC; 16s ago
  Process: 16737 ExecStop=/opt/nexus/bin/nexus stop (code=exited, status=0/SUCCESS)
  Process: 18959 ExecStart=/opt/nexus/bin/nexus start (code=exited, status=0/SUCCESS)
Main PID: 19094 (java)
   CGroup: /system.slice/nexus.service
           └─19094 /usr/lib/jvm/java-1.8.0-openjdk-1.8.0.181-3.b13.el7_5.x86_64/jre/bin/java -se…

Aug 07 11:46:32 aws_jenkins001 systemd[1]: Starting nexus service…
Aug 07 11:46:32 aws_jenkins001 nexus[18959]: Starting nexus
Aug 07 11:46:32 aws_jenkins001 systemd[1]: Started nexus service.
[[email protected] ~]#

文章出自:CCIE那點事 http://www.qdxgqk.live/ 版權所有。本站文章除注明出處外,皆為作者原創文章,可自由引用,但請注明來源。 禁止全文轉載。
本文鏈接:http://www.qdxgqk.live/?p=3909轉載請注明轉自CCIE那點事
如果喜歡:點此訂閱本站
?
?
萌宠夺宝游戏