快速安装 | 安装 | 部署 | 测试 | wiht Binary on Linux for Testing
System Requirements
Download Archives – Repository Manager 3
Accessing the User Interface
环境概述
- 操作系统:CentOS Linux release 7.5.1804 (Core)
- 软件版本:nexus-3.16.2-01-unix.tar.gz
系统要求
- 强烈建议阅读官方的 System Requirements 文档。
- 重点关注:专有账户;文件句柄数;内存;磁盘文件系统;
安装方法
下载并解压安装包
### 安装 Java 运行环境 yum install -y java-1.8.0-openjdk.x86_64 cd /opt/ wget http://download.sonatype.com/nexus/3/nexus-3.16.2-01-unix.tar.gz tar -xf nexus-3.16.2-01-unix.tar.gz # 解压后会生成两个目录:应用目录;数据目录; # 有关各个目录的作用,参考:https://help.sonatype.com/repomanager3/installation/directories
启动并访问服务
# 添加用户 useradd nexus # 通常是名为 nexus 的用户,并且必须可以创建一个可用的 shell # 启动服务 bin/nexus run # 当显示「Started Sonatype Nexus OSS」时,表示启动成功 # 如果要停止服务,可以 Ctrl+C 停止 # 也可通过 start, stop, restart, force-reload, status 等命令来管理 # 访问服务 firefox http://localhost:8081/ # 默认账户:amdin / admin123
常用配置
针对 systemd 管理,详细内容参考官方「Run as a Service」文档。下面是 systemd 的示例:
#!/bin/sh cat > /etc/systemd/system/nexus.service <<EOF [Unit] Description=nexus service After=network.target [Service] Type=forking LimitNOFILE=65536 ExecStart=/opt/nexus/nexus/bin/nexus start ExecStop=/opt/nexus/nexus/bin/nexus stop User=nexus Restart=on-abort [Install] WantedBy=multi-user.target EOF systemctl daemon-reload systemctl enable nexus.service systemctl start nexus.service
配置 Nginx 代理,详细参考官方「Run Behind a Reverse Proxy」文档。下面是 Nginx 反向代理的示例:
http {
proxy_send_timeout 120;
proxy_read_timeout 300;
proxy_buffering off;
keepalive_timeout 5 5;
tcp_nodelay on;
server {
listen *:80;
server_name www.example.com;
# allow large uploads of files
client_max_body_size 1G;
# optimize downloading files larger than 1G
#proxy_max_temp_file_size 2G;
location / {
# Use IPv4 upstream address instead of DNS name to avoid attempts by nginx to use IPv6 DNS lookup
proxy_pass http://127.0.0.1:8081/;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
}
}
}
安装后的检查清单