1.去nexus网站找下载包
google找到这个页面https://help.sonatype.com/repomanager3/download
[root@localhost nexus]# wget https://download.sonatype.com/nexus/3/latest-unix.tar.gz
--2021-09-06 09:01:55-- https://download.sonatype.com/nexus/3/latest-unix.tar.gz
正在解析主机 download.sonatype.com (download.sonatype.com)... 204.236.160.20, 52.52.3.27
正在连接 download.sonatype.com (download.sonatype.com)|204.236.160.20|:443... 已连接。
已发出 HTTP 请求,正在等待回应... 302 Moved Temporarily
位置:https://sonatype-download.global.ssl.fastly.net/repository/downloads-prod-group/3/nexus-3.34.0-01-unix.tar.gz [跟随至新的 URL]
--2021-09-06 09:01:57-- https://sonatype-download.global.ssl.fastly.net/repository/downloads-prod-group/3/nexus-3.34.0-01-unix.tar.gz
正在解析主机 sonatype-download.global.ssl.fastly.net (sonatype-download.global.ssl.fastly.net)... 192.133.77.191, 2001::c760:3f35
正在连接 sonatype-download.global.ssl.fastly.net (sonatype-download.global.ssl.fastly.net)|192.133.77.191|:443... 失败:连接超时。
正在连接 sonatype-download.global.ssl.fastly.net (sonatype-download.global.ssl.fastly.net)|2001::c760:3f35|:443... 失败:网络不可达。
看来是下载不下来,估计是国内的墙的问题。
找到以下中转的网站https://offcloud.com/#/instant
image.png
输入下载地址,先下载到本地,然后再upload到服务器上
[root@localhost nexus]# tar -xvf nexus-3.34.0-01-unix.tar.gz #解压包
[root@localhost nexus]# ls
nexus-3.34.0-01 nexus-3.34.0-01-unix.tar.gz sonatype-work
2.为nexus增加默认运行的用户
[root@localhost nexus]# sudo adduser nexus
[root@localhost nexus]# chown -R nexus:nexus /servers/nexus
3.修改端口和开启防火墙
[root@localhost etc]# firewall-cmd --zone=public --add-port=8081/tcp --permanent
success
[root@localhost etc]# firewall-cmd --reload
success
[root@localhost etc]# firewall-cmd --list-all
public (active)
target: default
icmp-block-inversion: no
interfaces: ens192
sources:
services: ssh dhcpv6-client
ports: 3000/tcp 7300/tcp 8081/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
4.启动
[root@localhost nexus-3.34.0-01]# bin/nexus start
Starting nexus
5.配置阿里的代码库代理
启动之后,就可以用浏览器访问了http://10.1.1.66:8081/
,进去根据提示找到admin密码,然后修改密码。
新建仓库
选择maven2(proxy)
输入名字和阿里的地址