安装
Nexus号称是世界上最流行的私服管理软件(The world's most popular repository),可以搭建几乎目前所有常见的仓库如npm,maven,yum等,Nexus3更是增加了对docker仓库的支持 ,应该是搭建私服的唯一选择.
Nexus有两个版本 Nexus Repository OSS和Nexus Repository Pro,其中OSS版本是免费,Pro专业版需要收费.OSS对于日常的仓库管理已经足够用.
Nexus OSS支持二进制文件安装和docker安装,这里选择docker安装,简单方便.
运行以下命令即可完成安装
$ docker run -d -p 8081:8081 sonatype/nexus3
#可以挂载本地目录做数据持久化
$ mkdir /some/dir/nexus-data && chown -R 757 /some/dir/nexus-data
$ docker run -d -p 8081:8081 -v /some/dir/nexus-data:/nexus-data sonatype/nexus3
在nexus3官方docker仓库说明文档里挂载目录设置的权限为200但实际安装的时候无法启动,权限不够,错误如下:
mkdir: cannot create directory '../sonatype-work/nexus3': Permission denied
mkdir: cannot create directory '../sonatype-work/nexus3': Permission denied
Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to Permission denied
Warning: Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
Warning: Forcing option -XX:LogFile=/tmp/jvm.log
Unable to update instance pid: Unable to create directory /nexus-data/instances
/nexus-data/log/karaf.log (Permission denied)
Unable to update instance pid: Unable to create directory /nexus-data/instances
Exception in thread "Thread-2" java.lang.SecurityException: Could not lock User prefs.