https://www.sonatype.com/products/nexus-community-edition-download

image.png

1
2
3
4
5
6
7
8
9
10
11
12
13
# 在服务器上解压
tar xf nexus-3.90.1-01-linux-x86_64.tar.gz

# 修改默认的jvm参数
vim bin/nexus.vmoptions

# 启动
./bin/nexus start

# 停止
./bin/nexus stop

打开 ip:8081 端口

image.png

配置域名与 SSL 证书, 我用的是 Kubernetes 的 ingress 做的反代(为了统一维护 ssl 证书),也可以使用 nginx 来做反代。

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
kind: Endpoints
apiVersion: v1
metadata:
name: npm-ai
namespace: ops
subsets:
- addresses:
- ip: 10.219.20.113
ports:
- name: npm-ai
port: 8081
protocol: TCP

---

kind: Service
apiVersion: v1
metadata:
name: npm-ai
namespace: ops
spec:
ports:
- name: npm-ai
protocol: TCP
port: 80
targetPort: 8081
type: ClusterIP
sessionAffinity: None
ipFamilies:
- IPv4
ipFamilyPolicy: SingleStack
internalTrafficPolicy: Cluster

---

kind: Ingress
apiVersion: networking.k8s.io/v1
metadata:
name: npm-ai
namespace: ops
spec:
ingressClassName: private-nginx
tls:
- hosts:
- npm-ai.a.com
secretName: a-com
rules:
- host: npm-ai.a.com
http:
paths:
- path: /
pathType: ImplementationSpecific
backend:
service:
name: npm-ai
port:
number: 80


Default Secret Encryption Key 警告问题:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Nexus was not configured with an encryption key and is using the Default key

/sonatype-work/nexus3/etc/nexus-default.properties

增加一个配置

nexus.secrets.file=/full/path/to/your/secrets/content.json
content.json内容为:

{
"active": "my-key",
"keys": [
{
"id": "my-key",
"key": "任意的字符串"
}
]
}