在CentOS7上安装Nexus OSS 3
文章目录
- 在CentOS7上安装Nexus OSS 3
- 参考文档
- 前置条件
- 安装过程
- 下载和解压
- 以nexus账号运行Nexus
- 修改端口和开启防火墙
- 以服务方式运行Nexus
- 访问Nexus
- Trouble shooting
在CentOS7上安装Nexus OSS 3
参考文档
官方文档:
- https://help.sonatype.com/repomanager3
- https://help.sonatype.com/repomanager3/installation/configuring-the-runtime-environment#ConfiguringtheRuntimeEnvironment-ConfiguringtheDataDirectory
参考文档:
- https://devopscube.com/how-to-install-latest-sonatype-nexus-3-on-linux/
前置条件
检查是否已经安装OpenJDK8,并设置好JAVA_HOME
:
java -version
javac -version
echo $JAVA_HOME
参考文档:
- CentOS7上安装OpenJDK8
安装过程
下载和解压
cd /opt
wget https://sonatype-download.global.ssl.fastly.net/repository/repositoryManager/3/nexus-3.16.1-02-unix.tar.gz
# Extract installaiton package, you can delete the package afer installed if necessary
tar -xvf nexus-3.16.1-02-unix.tar.gz
mv /opt/nexus-3.16.1-02 /opt/nexus
Nexus目录:
- 安装目录:比如
/opt/nexus
- 数据目录或工作目录:比如
/opt/sonatype-work
以nexus账号运行Nexus
sudo adduser nexus
sudo chown -R nexus:nexus /opt/nexus
sudo chown -R nexus:nexus /opt/sonatype-work
修改/opt/nexus/bin/nexus.rc
,编辑内容为run_as_user="nexus"
编辑/opt/nexus/bin/nexus.vmoptions
,可以修改JVM参数和Nexus数据目录。
修改端口和开启防火墙
Nexus缺省运行在8081端口,可以修改/opt/nexus/etc/nexus-default.properties
文件来修改端口。
开启防火墙:
firewall-cmd --zone=public --add-port=8081/tcp
firewall-cmd --zone=public --add-port=8081/tcp --permanent
firewall-cmd --reload
firewall-cmd --list-all
以服务方式运行Nexus
创建/etc/systemd/system/nexus.service
:
cat > /etc/systemd/system/nexus.service <<EOF [Unit] Description=nexus service After=network.target [Service] Type=forking LimitNOFILE=65536 ExecStart=/opt/nexus/bin/nexus start ExecStop=/opt/nexus/bin/nexus stop User=nexus Restart=on-abort [Install] WantedBy=multi-user.target EOF
以systemd
服务运行Nexus:
systemctl daemon-reload
systemctl enable nexus
systemctl start nexus
运行systemctl status nexus -l
查看Nexus服务状态。
访问Nexus
在浏览器中访问http://<nexus_host>:8081
缺省的管理员用户名和密码:admin / admin123
首次登陆后需要修改密码。
Trouble shooting
如果以非root
账号运行Nexus,确保该账号有权限访问Nexus安装目录和工作目录。
运行journalctl -xefu nexus
来查看Nexus服务日志。
运行tail -f /opt/sonatype-work/nexus3/log/nexus.log
查看Neuxs日志。
还没有评论,来说两句吧...