环境

  • JDK 1.8已经安装
  • 将会安装Sonatype Nexus OSS 3.3

安装

下载安装包:

1wget https://sonatype-download.global.ssl.fastly.net/nexus/3/nexus-3.3.1-01-unix.tar.gz

创建运行用户:

1group add nexus
2useradd -g nexus -d /home/nexus nexus

解压缩安装包:

1tar -zxvf nexus-3.3.1-01-unix.tar.gz -C /home/neuxs
2ls /home/nexus
3nexus-3.3.1-01  sonatype-work

修改数据目录中的配置文件:

1cd /home/nexus/sonatype-work/nexus3/
2vi nexus.properties
3
4# 定制http端口号
5application-port=8082

修改运行用户:

1cd /home/nexus/nexus-3.3.1-01/bin
2vi nexus.rc
3
4run_as_user='nexus'
5
6chown -R nexus:nexus /home/nexus

拷贝启动脚本:

1cd /home/nexus/nexus-3.3.1-01/bin
2
3cp nexus /etc/init.d

systemd unit文件/usr/lib/systemd/system/nexus.service:

 1[Unit]
 2Description=nexus service
 3After=network.target
 4
 5[Service]
 6Type=forking
 7ExecStart=/home/nexus/nexus-3.3.1-01/bin/nexus start
 8ExecStop=/home/nexus/nexus-3.3.1-01/bin/nexus stop
 9User=nexus
10Restart=on-abort
11
12[Install]
13WantedBy=multi-user.target

启动服务:

1systemctl daemon-reload
2systemctl enable nexus
3systemctl start nexus
4systemctl status nexus

浏览器打开http://server:8082,使用admin / admin123登录,修改admin的密码。

集成OpenLDAP

nexus集成LDAP比较简单,根据官方文档LDAP Integration在Web界面中一步步操作即可。

首先在设置–>Security–>Realms中添加LDAP Realm:

nexus-ldap-realm.png

接下来在设置–>Security–>LDAP中创建Connecttion:

nexus-ldap-connection.png

接下来设置用户和用户组信息:

nexus-ldap-user-and-group.png

参考