linux安裝過程和window主機(jī)還是差別挺大的。
1.下載nexus集成版
到這個(gè)地方http://www.sonatype.org/nexus/go 下載壓縮包,我這邊下載的是nexus-2.0.3-bundle.tar.gz這個(gè)版本。
2. 解壓到相應(yīng)的目錄
tar -xzvf nexus-2.0.3-bundle.tar.gz , 我這邊放在/home/linjx/opendev/nexus-2.0.3目錄下。
3. 設(shè)置為系統(tǒng)服務(wù)
這里需要使用root權(quán)限,具體請(qǐng)看http://books.sonatype.com/nexus-book/reference/install-sect-service.html
簡(jiǎn)單如下:
# cd /etc/init.d
# cp /home/linjx/opendev/nexus-2.0.3/bin/jsw/linux-x86-64/nexus ./nexus
# chmod 755 nexus
# chkconfig --add nexus
# chkconfig --levels 345 nexus on
4. 編輯/etc/init.d/nexus的文本
4.1. 添加以下變量
RUN_AS_USER=linjx ## 這個(gè)主要為了后面使用,不需要使用root用戶啟動(dòng)服務(wù)
NEXUS_HOME=/home/linjx/opendev/nexus-2.0.3/
PLATFORM=linux-x86-64
PLATFORM_DIR="${NEXUS_HOME}/bin/jsw/${PLATFORM}"
4.2. 修改以下變量
WRAPPER_CMD="${PLATFORM_DIR}/wrapper"
WRAPPER_CONF="${PLATFORM_DIR}/../conf/wrapper.conf"
PIDDIR="${NEXUS_HOME}"
5. 啟動(dòng)服務(wù)
切換會(huì)自己的用戶,不需要使用root用戶;
# service nexus start
這個(gè)大家出現(xiàn)什么情況,是不是失敗了!界面上出現(xiàn) :Could not write pid file /etc/rc.d/init.d/./nexus.pid: Permission denied通過查看日志文件:
fzdev#[/home/linjx/opendev/nexus-2.0.3/logs] cat w*
wrapper | ERROR: Could not write pid file /etc/rc.d/init.d/./nexus.pid: Permission denied
怎么辦呢,根據(jù)信息提示,nexus.pid無法寫入,應(yīng)該還是權(quán)限問題,這個(gè)應(yīng)該跟啟動(dòng)當(dāng)前服務(wù)有關(guān)。
查文檔http://books.sonatype.com/nexus-book/reference/install-sect-service.html后發(fā)現(xiàn),一有段信息沒有配置,
Change PIDDIR to a directory where this user has read/write permissions. In most Linux distributions, /var/run is only writable by root. The properties you need to add to customize the PID file location is "wrapper.pid". For more information about this property and how it would be configured in wrapper.conf, see: http://wrapper.tanukisoftware.com/doc/english/properties.html
大概意思就是服務(wù)啟動(dòng)時(shí)無法寫入pid,就是說init.d這個(gè)目錄當(dāng)前用戶是沒有權(quán)限寫的,怎么辦呢??梢宰远xpid寫入目錄,那么在哪里配置呢,是不是又想起了wrapper.conf了,其他文檔中也說明了。
好吧,那就再加個(gè)配置吧,這樣:PIDDIR="/home/linjx/piddir"
然后再啟動(dòng)服務(wù),果然成功了!具體可以看看附件中的詳細(xì)的日志!

6. 啟動(dòng)之后,可以登錄首頁查看nexus的界面
http://192.168.1.26:8081/nexus/index.html
默認(rèn)管理員用戶名/密碼: admin/admin123
