【maven】帰ってきたnexusのインストール
すごく昔に、nexusを構築したんだけど、最近また構築しなきゃいけなくなったー
ReleaseNote
Sonatype Nexus Release Notes Index : Sonatype Support
2.11.1にしよう。
何気に、最終更新日が2014/12/19だし。
Sonatype Nexus 2.11.1 Release Notes : Sonatype Support
ダウンロード
Pro版もあるけど、OSS版を入れます
Download and Install Nexus OSS | TheNEXUS
ブラウザ上でダウンロードして、scpした。
今回は/data/nexus配下にnexusを入れる
$ cd /data $ mkdir nexus
ローカルに落としてきたnexusを移動して展開
$mv nexus-2.11.1-01-bundle.tar.gz /usr/local/src/ $cd /usr/local/src/ $tar -xzvf nexus-2.11.1-01-bundle.tar.gz -C /data/nexus/ #確認 $cd /data/nexus/ $ls nexus-2.11.1-01 sonatype-work
2つディレクトリができた
nexusディレクトリは,nexus自体のアプリケーション,sonatype-workディレクトリは,リポジトリに関連する情報が入っている.
nexusのバージョンをあげる場合はnexusディレクトリのみ更新すれば問題なく動作する(たぶん).
バージョンまた変わったときに便利なように、シンボリックリンク貼っておく
$ln -s nexus-2.11.1-01 nexus $ll | grep nexus lrwxrwxrwx 1 root root 15 1月 6 17:51 2015 nexus -> nexus-2.11.1-01 drwxr-xr-x 8 root root 4096 12月 17 10:23 2014 nexus-2.11.1-01
nexus用のユーザ作成
えいっ
$groupadd cy_nexus $ useradd cy_nexus -g cy_nexus #確認 $id cy_nexus uid=10001(cy_nexus) gid=10001(cy_nexus) 所属グループ=10001(cy_nexus)
やあっ
$ll /data | grep nexus drwxr-xr-x 4 root root 4096 1月 6 17:51 2015 nexus $chown -R cy_nexus. nexus $ll /data | grep nexus drwxr-xr-x 4 cy_nexus cy_nexus 4096 1月 6 17:51 2015 nexus
起動
さてはて。
Sonatype Nexus 2.0 through 2.8.1 Release Notes : Sonatype Support
なんか2.7のところで、2.0からOS毎のスクリプトはdeprecatedしてたけど削除したよって書いてる
(あるけど)
Legacy Startup Scripts Removed
The old startup scripts (located under $NEXUS_HOME/bin/jsw/$ARCH in the installation directory) have finally been removed. These have been deprecated since Nexus 2.0. Users should use the new startup scripts introduced in Nexus 2.0, located in $NEXUS_HOME/bin (NEXUS-5781). The 'clickable' Windows batch files (*-nexus.bat) have remained, but the only use case for these are to be 'clicked' to perform a specific named action.
nexusさんオススメのやり方でやろう。
ちょっと実行してみる
$/data/nexus/nexus/bin/nexus Usage: /data/nexus/nexus/bin/nexus { console | start | stop | restart | status | dump }
ほほ。
起動スクリプト
以前作ったやつの引用(冒頭)
$vi /etc/init.d/nexus
中身はこんな感じ
#!/bin/sh # description: nexus start/stop Script # 実行ユーザの指定 export RUN_AS_USER=cy_nexus # user check if [ `/usr/bin/whoami` != "root" ]; then echo "This script is only for root." exit 1 fi NEXUS_HOME=/data/nexus/nexus #nexusの起動 ${NEXUS_HOME}/bin/nexus $@ exit 0
実行権限付与
$ chmod +x /etc/init.d/nexus $ ll /etc/init.d/nexus -rwxr-xr-x 1 root root 295 1月 6 19:09 2015 /etc/init.d/nexus
よし。実行
$/etc/init.d/nexus start
Starting Nexus OSS...
Started Nexus OSS.
http://xxx.xxx.xxx.xxx:8081/nexus/#welcome
立ち上がった
admin/admin123
でログインできる