首页 » 系统运维 » 正文

CentOS 8.2.2004 安装 Nexus OSS 3.26.1

下载Nexus

https://sonatype-download.global.ssl.fastly.net/repository/downloads-prod-group/3/nexus-3.26.1-02-unix.tar.gz

执行安装

将下载的包解压到指定目录,如 /opt/nexus,进入 /opt/nexus/nexus-3.26.1-02/bin 目录,执行启动命令:

tar -xzvf nexus-3.26.1-02-unix.tar.gz -C nexus
cd nexus/nexus-3.26.1-02/bin
./nexus start

若在启动过程中提示找不到 JDK,则需要安装 JDK。

设置开机自启动(安装服务)

在 /usr/lib/systemd/system 目录下创建 nexus.service 文件,内容如下:

[Unit]
Description=nexus
After=network.target

[Service]
Type=forking
Environment="JAVA_HOME=/opt/jdk1.8.0_172"
ExecStart=/opt/nexus/nexus-3.26.1-02/bin/nexus start
ExecReload=/opt/nexus/nexus-3.26.1-02/bin/nexus restart
ExecStop=/opt/nexus/nexus-3.26.1-02/bin/nexus stop
PrivateTmp=true

[Install]
WantedBy=multi-user.target

然后启动服务

systemctl start nexus
systemctl enable nexus

访问服务

端口是8081,http://ip-address:8081