1:下载 nexus-3.13.0-01-unix.tar.gz 包(下载地址)
2:上传 nexus-3.13.0-01-unix.tar.gz包到 服务器;
3: 创建nexus 安装目录
mkdir /usr/local/nexus
4: 解压 nexus-3.13.0-01-unix.tar.gz
tar -zxfv /usr/local/soft/nexus-3.13.0-01-unix.tar.gz -C /usr/local/nexus
5: 启动 nexus
cd /usr/local/nexus/nexus-3.13.0-01/bin/
./nexus run &
看见 Started Sonatype Nexus OSS 3.13.0-01 说明启动成功
7:把 nexus 端口加入防火墙
firewall-cmd --zone=public --add-port=8081/tcp --permanent
8:重启防火墙使配置生效
firewall-cmd --reload
9:设置 nexus 开机启动(参考:https://help.sonatype.com/repomanager3/system-requirements#SystemRequirements-Linux)
vi /usr/lib/systemd/system/nexus.service
加入下面代码:
[Unit]
Description = nexus service
After = network.target
[Service]
Type = forking
LimitNOFILE = 65536
ExecStart = /usr/local/nexus/nexus-3.13.0-01/bin/nexus start
ExecReload= /usr/local/nexus/nexus-3.13.0-01/bin/nexus restart
ExecStop = /usr/local/nexus/nexus-3.13.0-01/bin/nexus stop
Restart = on- abort
[Install]
WantedBy = multi-user.target
10:服务加入开机启动:
systemctl enable nexus.service
11:加载配置文件
systemctl daemon-reload
12:修改nexus用户root
vi /usr/local/nexus/nexus-3.13.0-01/bin/nexus.rc
run_as_user=root
13: 修改nexus jdk
vi /usr/local/nexus/nexus-3.13.0-01/bin/nexus
14:更新 nexus 索引
在http://repo.maven.apache.org/maven2/.index/下载
nexus-maven-repository-index.gz
nexus-maven-repository-index.properties
以上两个文件后,在下载
indexer-cli-6.0.0.jar 包
15:上传刚才下载的三个文件到服务器的同一个目录下,然后执行
java -jar indexer-cli-6.0.0.jar -u nexus-maven-repository-index.gz -d indexer
等待程序运行完成之后可以发现indexer文件夹下出现了很多文件,将这些文件放置到{nexus-home}/sonatype-work/nexus3/indexer/central-ctx目录下
16:重新启动nexus
systemctl restart nexus.service