一,安裝Nexus
安裝java, nexus要求特定的JAVA版本
下載JAVA RPM包
https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html
rpm -ivh jdk-8u271-linux-x64.rpm
vim /etc/profile
export JAVA_HOME=/usr/java/jdk1.8.0_271-amd64
export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
export PATH=$PATH:$JAVA_HOME/bin
source /etc/profile
java -version
javac -version
安裝nexus
tar -zxvf nexus-3.28.1-01-unix.tar.gz -C /home/nexus
vim /home/nexus/nexus-3.28.1-01/bin/nexus
INSTALL4J_JAVA_HOME_OVERRIDE=/usr/java/jdk1.8.0_271-amd64
./nexus start
如果JAVA版本不對(duì),會(huì)出現(xiàn)如下提示:
No suitable Java Virtual Machine could be found on your system.
The version of the JVM must be at least 1.8 and at most 1.8.
Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.
檢查NEXUS是否運(yùn)行
ps -ef |grep nexus
netstat -natp |grep 8081
二,Nexus加入服務(wù)并自啟動(dòng)
CentOS7配置nexus開機(jī)自啟動(dòng)
新建nexus啟動(dòng)腳本
進(jìn)入/etc/init.d目錄,新建腳本文件nexus
進(jìn)入/etc/init.d
[root@linux_maven etc]# cd /etc/init.d/
新建腳本文件nexus
[root@linux_maven init.d]# vim nexus
腳本內(nèi)容:
#!/bin/bash
#chkconfig:2345 20 90
#description:nexus
#processname:nexus
export JAVA_HOME=/usr/java/jdk1.8.0_271-amd64
case $1 in
start) su root /usr/local/nexus3.21/bin/nexus start;;
stop) su root /usr/local/nexus3.21/bin/nexus stop;;
status) su root /usr/local/nexus3.21/bin/nexus status;;
restart) su root /usr/local/nexus3.21/bin/nexus restart;;
dump) su root /usr/local/nexus3.21/bin/nexus dump;;
console) su root /usr/local/nexus3.21/bin/nexus console;;
*) echo "Usage: nexus {start|stop|run|run-redirect|status|restart|force-reload}"
esac
設(shè)置腳本權(quán)限
chmod +x /etc/init.d/nexus
使用service命令使用nexus
service nexus status
WARNING: ************************************************************
WARNING: Detected execution as "root" user. This is NOT recommended!
WARNING: ************************************************************
nexus is running.
添加到開機(jī)啟動(dòng)
chkconfig nexus on
查看nexus開機(jī)啟動(dòng)
[root@linux_maven ~]# chkconfig --list nexus
Note: This output shows SysV services only and does not include native
systemd services. SysV configuration data might be overridden by native
systemd configuration.
If you want to list systemd services use 'systemctl list-unit-files'.
To see services enabled on particular target use
'systemctl list-dependencies [target]'.
nexus 0:off 1:off 2:on 3:on 4:on 5:on 6:off
啟動(dòng)nexus
ps -ef |grep nexus |xargs kill -9
service start nexus
三,配置LDAP(AD)認(rèn)證

image.png

image.png
LDAP server address
used AD server
search base DN:
dc=fj,dc=com
username or DN:
AD管理員權(quán)限帳號(hào)

image.png

image.png

image.png
至此完成安裝,并配置使用LDAP認(rèn)證。