1.Nexus下载
Nexus官网下载地址 www.sonatype.com/products/re…
我下载下来的是nexus-3.30.1-01-mac.tgz
包
2.Nexus安装
2.1 解压安装包
MAC OS环境
把nexus-3.30.1-01-mac.tgz
包解压到nexus
文件夹(我解压到/Users/slatte/Library/nexus)
$ tar -zxvf nexus-3.30.1-01-mac.tgz /Users/szewec/Library/nexus
复制代码
解压出来有nexus-3.30.1-01
和sonatype-work
两个文件夹
2.2 创建软链接
创建nexus-latest
软链接,为以后升级版本方便使用,只要改变nexus-latest
的指向即可
$ ln -s /Users/slatte/Library/nexus/nexus-3.30.1-01 /Users/slatte/Library/nexus/nexus-latest
复制代码
2.3 添加系统环境变量
$ vi ~/.profile
复制代码
添加NEXUS_HOME
变量
export NEXUS_HOME=/Users/slatte/Library/nexus/nexus-latest
PATH=$PATH:$NEXUS_HOME/bin
复制代码
使配置文件更改生效
$ source ~/.profile
复制代码
3.Nexus启动
启动nexus服务
$ nexus start
复制代码
打开http://localhost:8081/ 访问nexus主页
4.发布npm包到Nexus
4.1 创建Hosted 仓库
4.2 创建Proxy 仓库
4.3 创建Group仓库
4.4 添加Realm
添加npm Bearer Token Realm
4.4 登录npm私有仓库
npm login --registry=http://localhost:8081/repository/npm-private/
复制代码
4.5 执行npm publish命令
npm publish
复制代码
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END