一創(chuàng)建用戶
一在root用戶創(chuàng)建nexus組和nexus用戶
[root@wc /]# groupadd nexus
[root@wc /]# useradd -s /bin/bash -d /app/nexus -g nexus nexus
[root@wc /]# passwd nexus
二修改文件的用戶和所有者
chown -R nexus:nexus /app/nexus/nexus-2.5.1-01
三修改nexus-2.5.1-01/bin/jsw/conf/wrapper.conf目錄下的文件
wrapper.java.command=/usr/local/jdk/jdk1.7.0_80/bin/java

image.png
四配置環(huán)境變量
在/etc/profile文件中配置
export RUN_AS_USER=root #如果這里不配置,nexus啟動時會出現(xiàn) If you insist running as root ,than set the environment variable RUN_AS_USER=root before running this script 報錯
export PATH=$JAVA_HOME/bin:$PATH:$RUN_AS_USER
source /etc/profile刷新
五運行nexus-2.5.1-01/bin/nexus start,網(wǎng)頁訪問ip地址+8081/nexus
一在root用戶創(chuàng)建nexus組和nexus用戶
[root@wc /]# groupadd nexus
[root@wc /]# useradd -s /bin/bash -d /app/nexus -g nexus nexus
[root@wc /]# passwd nexus
[root@wc /]# useradd -s /bin/ksh -d /app/nexus -g nexus nexus
正在創(chuàng)建信箱文件: 文件已存在
解決:刪除/var/spool/mail/nexus
[root@wc nexus]# su - nexus
上一次登錄:一 9月 14 16:01:39 CST 2020pts/0 上
su: failed to execute /bin/ksh: 權限不夠
解決:將/bin/ksh換成/bin/bash,usr/bin賦予777權限 chmod 777 /usr/bin
二修改文件的用戶和所有者
chown -R nexus:nexus /app/nexus/nexus-2.5.1-01
二配置環(huán)境變量
在/etc/profile文件中配置
export RUN_AS_USER=root #如果這里不配置,nexus啟動時會出現(xiàn) If you insist running as root ,than set the environment variable RUN_AS_USER=root before running this script 報錯
export PATH=$JAVA_HOME/bin:$PATH:$RUN_AS_USER
source /etc/profile刷新
三jdk1.8環(huán)境變量在root用戶下的/etc/profile文件中配置,jdk1.7環(huán)境變量可以在root用戶下的.bash_profile文件中配置,也可以在nexus用戶下的.bash_profile文件中配置(啟動nexus需要輸入root用戶密碼),


需要更新.bash_profile和/etc/profile,$PATH
需要放在最后面
source .bash_profile刷新
vim /app/nexus/nexus-2.5.1-01/bin/jsw/conf/wrapper.confnexus的配置文件
三啟動nexus
[root@wc bin]# ./nexus start
****************************************
WARNING - NOT RECOMMENDED TO RUN AS ROOT
****************************************
Starting Nexus OSS...
Started Nexus OSS.

image.png
錯誤:訪問不了nexus頁面
查看日志文件nexus-2.5.1-01/logs/wrapper.log
Error in WrapperListener.start callback. java.lang.StackOverflowError
jvm 1 | java.lang.StackOverflowError
jvm 1 | at org.sonatype.appcontext.internal.HierarchicalMap.get(HierarchicalMap.java:113)
解決:jdk環(huán)境不兼容,將jdk1.8換成jdk1.7
四配置maven
export MAVEN_HOME=/app/nexus/apache-maven-3.5.2
export PATH=$PATH:$MAVEN_HOME/bin