最近嘗試了一下本身安裝nexus服務,給本身搭一下開發環境,主要參考官網的安裝手冊:java
須要先安裝 java jdk。shell
1.下載 nexus vim
去官網下載一個最新的tar包app
http://www.sonatype.org/nexus/go/this
2.解壓包spa
$ tar xvzf nexus-2.12.0-01-bundle.tar.gz $ mv nexus-2.12.0-01-bundle /usr/local/ $ ls -s nexus-2.12.0-01 nexus $ groupadd nexus $ adduser -g nexus nexus $ chmod 755 -R nexus $ chown -R nexus nexus $ chgrp -R nexus neuxs # 設置 NEXUS_HOME $ vim /usr/profile # add NEXUS_HOME=/usr/local/nexus $ resource profile $ cp /usr/local/nexus/bin/nexus /ect/init.d/ $ chmod 755 nexus $ chown root nexus # 修改 nexus NEXUS_HOME=/usr/local/nexus RUN_AS_USER=nexus $ vim nexus # 修改nexus.properties 自定義端口之類的 $ vim /usr/local/nexus/conf/nexus.properties # 增長nexus-work=${bundleBasedir}/../sonatype-work/nexus中的目錄 $ cd /usr/local $ mkdir -p sonatype-work/nexus $ chown -R nexus sonatype-work $ chmod 755 sonatype-work
此時若是用 root 用戶會提示如下信息:code
# **************************************** # WARNING - NOT RECOMMENDED TO RUN AS ROOT # **************************************** # If you insist running as root, then set the environment variable RUN_AS_USER=root before running # this script.
配置服務:orm
$ cd /etc/init.d $ chkconfig --add nexus $ chkconfig --levels 345 nexus on # 切換至 nexus用戶執行 $ su nexus $ service nexus start Starting Nexus Repository Manager... $ tail -f /usr/local/nexus/logs/wrapper.log
此時會報如下錯誤:ip
wrapper | Unable to start JVM: No such file or directory (2) wrapper | JVM exited while loading the application.
這個時候要修改wrap.properties中的 wrapper.java.command參數爲java命令的絕對路徑:開發
$ vim /usr/local/nexus/bin/jsw/conf/wrapper.conf # 設置 wrapper.java.command=/usr/local/jdk1.8.0_60/bin/java
而後啓動nexus