Nexus Repository Manager 3 安装

本文介绍 Nexus Repository Manager 3 在 CentOS 7.x 上的安装。


安装环境

  • CentOS Linux release 7.4.1708 (Core)
  • Oracle JRE 1.8.0_201
  • nexus-3.15.2-01

安装步骤

  1. 下载 Nexus,本示例使用 nexus-3.15.2-01-unix.tar.gz
  2. 安装正确的 Java 运行环境,参考:CentOS 7.x 重装 JDK。
  3. 输入命令 tar xvzfnexus-3.15.2-01-unix.tar.gz 解压到特定目录下,如 /opt,解压成功后会在此目录下生成两个文件夹:nexus-3.15.2-01sonatype-work
  4. 进入 Nexus 安装目录下 bin 文件夹,执行命令 ./nexus run,前台启动运行 Nexus 会打印出启动日志,看到 Started Sonatype Nexus OSS 3.15.2-01 输出时表明启动成功。
WARNING: ************************************************************
WARNING: Detected execution as "root" user.  This is NOT recommended!
WARNING: ************************************************************
2019-03-11 08:52:14,013+0800 INFO  [FelixStartLevel] *SYSTEM org.sonatype.nexus.pax.logging.NexusLogActivator - start
2019-03-11 08:52:15,406+0800 WARN  [FelixStartLevel] *SYSTEM uk.org.lidalia.sysoutslf4j.context.SysOutOverSLF4JInitialiser - Your logging framework class org.ops4j.pax.logging.slf4j.Slf4jLogger is not known - if it needs access to the standard println methods on the console you will need to register it by calling registerLoggingSystemPackage
......
2019-03-11 08:52:15,422+0800 INFO  [FelixStartLevel] *SYSTEM org.sonatype.nexus.bootstrap.ConfigurationBuilder -   application-host='0.0.0.0'
2019-03-11 08:52:15,423+0800 INFO  [FelixStartLevel] *SYSTEM org.sonatype.nexus.bootstrap.ConfigurationBuilder -   application-port='8081'
......
2019-03-11 08:52:15,423+0800 INFO  [FelixStartLevel] *SYSTEM org.sonatype.nexus.bootstrap.ConfigurationBuilder -   jetty.etc='/opt/nexus-3.15.2-01/etc/jetty'
2019-03-11 08:52:15,423+0800 INFO  [FelixStartLevel] *SYSTEM org.sonatype.nexus.bootstrap.ConfigurationBuilder -   karaf.base='/opt/nexus-3.15.2-01'
......
2019-03-11 08:52:15,424+0800 INFO  [FelixStartLevel] *SYSTEM org.sonatype.nexus.bootstrap.ConfigurationBuilder -   nexus-context-path='/'
......
2019-03-11 08:52:15,425+0800 INFO  [FelixStartLevel] *SYSTEM org.sonatype.nexus.bootstrap.Launcher - Java: 1.8.0_201, Java HotSpot(TM) 64-Bit Server VM, Oracle Corporation, 25.201-b09
2019-03-11 08:52:15,425+0800 INFO  [FelixStartLevel] *SYSTEM org.sonatype.nexus.bootstrap.Launcher - OS: Linux, 3.10.0-693.el7.x86_64, amd64
2019-03-11 08:52:15,425+0800 INFO  [FelixStartLevel] *SYSTEM org.sonatype.nexus.bootstrap.Launcher - User: root, en, /root
2019-03-11 08:52:15,425+0800 INFO  [FelixStartLevel] *SYSTEM org.sonatype.nexus.bootstrap.Launcher - CWD: /opt/nexus-3.15.2-01
......
2019-03-11 08:52:18,782+0800 INFO  [jetty-main-1] *SYSTEM org.apache.shiro.nexus.NexusWebSessionManager - Global session timeout: 1800000 ms
2019-03-11 08:52:18,783+0800 INFO  [jetty-main-1] *SYSTEM org.apache.shiro.nexus.NexusWebSessionManager - Session-cookie prototype: name=NXSESSIONID
......
2019-03-11 08:52:18,951+0800 INFO  [jetty-main-1] *SYSTEM org.hibernate.validator.internal.util.Version - HV000001: Hibernate Validator 5.1.2.Final
......
2019-03-11 08:52:30,445+0800 WARN  [FelixStartLevel] *SYSTEM org.sonatype.nexus.internal.system.FileDescriptorServiceImpl - WARNING: ****************************************************************************
2019-03-11 08:52:30,446+0800 WARN  [FelixStartLevel] *SYSTEM org.sonatype.nexus.internal.system.FileDescriptorServiceImpl - WARNING: The open file descriptor limit is 4096 which is below the minimum recommended value of 65536.
2019-03-11 08:52:30,446+0800 WARN  [FelixStartLevel] *SYSTEM org.sonatype.nexus.internal.system.FileDescriptorServiceImpl - WARNING: Please see: http://links.sonatype.com/products/nexus/system-reqs#filehandles
2019-03-11 08:52:30,446+0800 WARN  [FelixStartLevel] *SYSTEM org.sonatype.nexus.internal.system.FileDescriptorServiceImpl - WARNING: ****************************************************************************
......
2019-03-11 08:53:33,324+0800 INFO  [jetty-main-1] *SYSTEM org.eclipse.jetty.server.handler.ContextHandler - Started o.e.j.w.WebAppContext@67b4cc63{Sonatype Nexus,/,file:///opt/nexus-3.15.2-01/public/,AVAILABLE}
2019-03-11 08:53:33,378+0800 INFO  [jetty-main-1] *SYSTEM org.eclipse.jetty.server.AbstractConnector - Started ServerConnector@1d24312a{HTTP/1.1,[http/1.1]}{0.0.0.0:8081}
2019-03-11 08:53:33,380+0800 INFO  [jetty-main-1] *SYSTEM org.eclipse.jetty.server.Server - Started @81368ms
2019-03-11 08:53:33,380+0800 INFO  [jetty-main-1] *SYSTEM org.sonatype.nexus.bootstrap.jetty.JettyServer - 
-------------------------------------------------

Started Sonatype Nexus OSS 3.15.2-01

-------------------------------------------------
  1. 以上操作在前台启动运行 Nexus,日志会被打印在当前 Shell 中,按住 CTRL-C 按键会停止运行。
2019-03-11 09:02:19,934+0800 WARN  [SIGINT handler] *SYSTEM com.orientechnologies.orient.core.OSignalHandler - Received signal: SIGINT
2019-03-11 09:02:19,943+0800 INFO  [Thread-5] *SYSTEM org.eclipse.jetty.server.AbstractConnector - Stopped ServerConnector@4ddd4a7d{HTTP/1.1,[http/1.1]}{0.0.0.0:8081}
2019-03-11 09:02:19,943+0800 INFO  [Thread-5] *SYSTEM org.eclipse.jetty.server.session - node0 Stopped scavenging
2019-03-11 09:02:19,945+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.repository.httpbridge.internal.ViewServlet - Destroyed
2019-03-11 09:02:19,946+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.siesta.SiestaServlet - Destroyed
2019-03-11 09:02:19,947+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.bootstrap.osgi.BootstrapListener - Destroying
2019-03-11 09:02:19,956+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.extender.NexusContextListener - Uptime: 36 seconds and 478 milliseconds (nexus-oss-edition/3.15.2.01)
2019-03-11 09:02:19,957+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.extender.NexusLifecycleManager - Stop TASKS
2019-03-11 09:02:19,959+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.quartz.internal.QuartzSchedulerSPI - Scheduler put into stand-by mode
2019-03-11 09:02:19,995+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.extender.NexusLifecycleManager - Stop CAPABILITIES
2019-03-11 09:02:19,999+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.extender.NexusLifecycleManager - Stop SERVICES
2019-03-11 09:02:20,294+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.extender.NexusLifecycleManager - Stop SECURITY
2019-03-11 09:02:20,296+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.extender.NexusLifecycleManager - Stop EVENTS
2019-03-11 09:02:20,296+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.extender.NexusLifecycleManager - Stop SCHEMAS
2019-03-11 09:02:20,304+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.extender.NexusLifecycleManager - Stop UPGRADE
2019-03-11 09:02:20,304+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.extender.NexusLifecycleManager - Stop RESTORE
2019-03-11 09:02:20,304+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.extender.NexusLifecycleManager - Stop STORAGE
2019-03-11 09:02:20,306+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.internal.orient.DatabaseManagerImpl - Stopping 5 pools
2019-03-11 09:02:20,306+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.internal.orient.DatabaseManagerImpl - Stopping pool: component
2019-03-11 09:02:20,306+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.internal.orient.DatabaseManagerImpl - Stopping pool: security
2019-03-11 09:02:20,306+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.internal.orient.DatabaseManagerImpl - Stopping pool: audit
2019-03-11 09:02:20,306+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.internal.orient.DatabaseManagerImpl - Stopping pool: config
2019-03-11 09:02:20,306+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.internal.orient.DatabaseManagerImpl - Stopping pool: accesslog
2019-03-11 09:02:20,307+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.internal.orient.DatabaseManagerImpl - Stopping 5 instances
2019-03-11 09:02:20,307+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.internal.orient.DatabaseManagerImpl - Stopping instance: component
2019-03-11 09:02:20,307+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.internal.orient.DatabaseManagerImpl - Stopping instance: security
2019-03-11 09:02:20,307+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.internal.orient.DatabaseManagerImpl - Stopping instance: audit
2019-03-11 09:02:20,307+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.internal.orient.DatabaseManagerImpl - Stopping instance: config
2019-03-11 09:02:20,307+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.internal.orient.DatabaseManagerImpl - Stopping instance: accesslog
2019-03-11 09:02:21,663+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.internal.orient.DatabaseServerImpl - Shutdown
2019-03-11 09:02:21,668+0800 INFO  [Thread-5] *SYSTEM org.elasticsearch.node - [AC305A77-F86CD048-F1E383B6-28596A23-7674C840] stopping ...
2019-03-11 09:02:21,698+0800 INFO  [Thread-5] *SYSTEM org.elasticsearch.node - [AC305A77-F86CD048-F1E383B6-28596A23-7674C840] stopped
2019-03-11 09:02:21,698+0800 INFO  [Thread-5] *SYSTEM org.elasticsearch.node - [AC305A77-F86CD048-F1E383B6-28596A23-7674C840] closing ...
2019-03-11 09:02:21,706+0800 INFO  [Thread-5] *SYSTEM org.elasticsearch.node - [AC305A77-F86CD048-F1E383B6-28596A23-7674C840] closed
2019-03-11 09:02:21,708+0800 INFO  [Thread-5] *SYSTEM org.ehcache.core.EhcacheManager - Cache 'assetDownloadCountStoreCache' removed from EhcacheManager.
2019-03-11 09:02:21,710+0800 INFO  [Thread-5] *SYSTEM org.ehcache.core.EhcacheManager - Cache 'nuget-group#odata-query-cache' removed from EhcacheManager.
2019-03-11 09:02:21,711+0800 INFO  [Thread-5] *SYSTEM org.ehcache.core.EhcacheManager - Cache 'NexusAuthenticatingRealm.authenticationCache' removed from EhcacheManager.
2019-03-11 09:02:21,713+0800 INFO  [Thread-5] *SYSTEM org.ehcache.core.EhcacheManager - Cache 'NexusAuthorizingRealm.authorizationCache' removed from EhcacheManager.
2019-03-11 09:02:21,714+0800 INFO  [Thread-5] *SYSTEM org.ehcache.core.EhcacheManager - Cache 'maven-central#negative-cache' removed from EhcacheManager.
2019-03-11 09:02:21,715+0800 INFO  [Thread-5] *SYSTEM org.ehcache.core.EhcacheManager - Cache 'nuget.org-proxy#odata-query-cache' removed from EhcacheManager.
2019-03-11 09:02:21,716+0800 INFO  [Thread-5] *SYSTEM org.ehcache.core.EhcacheManager - Cache 'nuget.org-proxy#negative-cache' removed from EhcacheManager.
2019-03-11 09:02:21,718+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.cache.internal.ehcache.EhCacheManagerProvider - Cache-manager closed
2019-03-11 09:02:21,719+0800 INFO  [Thread-5] *SYSTEM org.sonatype.nexus.extender.NexusLifecycleManager - Stop KERNEL

配置

  1. 自定义 JDK
    进入 nexus 安装目录下 bin 文件夹,编辑 nexus 文件。
vi nexus

定位 INSTALL4J_JAVA_HOME_OVERRIDE 并修改为自定义 JDK 目录。

INSTALL4J_JAVA_HOME_OVERRIDE=/opt/jre1.8.0_201

设置开机自启动

  1. 建立符号链接(symlink )
ln -s /opt/nexus-3.15.2-01/bin/nexus /etc/init.d/nexus

注意:如需删除符号链接可执行以下命令

rm -rf /etc/init.d/nexus
  1. 添加服务并启动
[root@ init.d]# chkconfig --add nexus
[root@ init.d]# chkconfig --levels 345 nexus on
[root@ bin]# service nexus start

注意:启动前需要配置 JDK,否则会报以下错误。

No suitable Java Virtual Machine could be found on your system.
The version of the JVM must be at least 1.8 and at most 1.8.
Please define INSTALL4J_JAVA_HOME to point to a suitable JVM.

打开浏览器,输入 IP:8081(Nexus 默认占用 8081 端口)可以进入 Sonatype Nexus Repository Manager 首页,预置的用户名/密码:admin / admin123

  1. 停止运行命令
sudo service nexus stop

你可能感兴趣的:(Nexus Repository Manager 3 安装)