Ubuntu 11.10 Server下搭建Maven私服

 

 

安装Nexus服务的文档可以参考官方站点:http://www.sonatype.com/books/nexus-book/reference/install-sect-install.html

相关阅读:

Ubuntu Maven安装与配置 http://www.codesky.net/Linux/2011-07/38964.htm

1.下载并安装Nexus
在Ubuntu 11.10 server上,下载Nexus最新版本。和官方文档不一样的地方是,我将nexus放在了/usr而不是/usr/local目录下。
wget http://nexus.sonatype.org/downloads/nexus-oss-webapp-1.9.2.4-bundle.tar.gz
mv nexus-oss-webapp-1.9.2.4-bundle.tar.gz /usr/
cd /usr
tar zxvf nexus-oss-webapp-1.9.2.4-bundle.tar.gz
ln -s nexus-oss-webapp-1.9.2.4 nexus


为了日后方便,按照官方文档的方式设置一个环境变量,将下面的脚本添加到~/.bashrc文件最后
export NEXUS_HOME=/usr/nexus


2.运行

进入/usr/nexus-oss-webapp-1.9.2.4/bin/jsw/linux-x86-64目录,运行下面的命令:

./nexus start
Starting Nexus OSS...
Started Nexus OSS.

默认nexus采用内置jetty作为web服务器,监听本地端口8081.通过打开网页http://yourserver:8081/nexus进行测试,用户名和密码默认是:admin/admin123

3.创建系统服务

复制Nexus自带的脚本到/etc/init.d目录

root@Ubuntu1110:/etc/init.d# cp $NEXUS_HOME/bin/jsw/linux-x86-64/nexus ./
添加几个变量到nexus脚本中NEXUS_HOME=/usr/nexusPLATFORM=linux-x86-64JAVA_HOME=/usr/jdk1.6.0_30PATH="$JAVA_HOME/bin:$PATH修改几个变量的值:APP_NAME=nexusAPP_LONG_NAME=Sonatype Nexus# WrapperWRAPPER_CMD=$NEXUS_HOME/bin/jsw/$PLATFORM/wrapperWRAPPER_CONF=$NEXUS_HOME/bin/jsw/conf/wrapper.conf
# Location of the pid file.                                                                                                                   
PIDDIR=/var/run

这个修改后的脚本要好好保存,这种事情再干一次很无聊。
之后,运行命令:
root@Ubuntu1110:/etc/init.d# update-rc.d nexus defaults
update-rc.d: warning: /etc/init.d/nexus missing LSB information
update-rc.d: see <http://wiki.debian.org/LSBInitScripts>
 Adding system startup for /etc/init.d/nexus ...
   /etc/rc0.d/K20nexus -> ../init.d/nexus
   /etc/rc1.d/K20nexus -> ../init.d/nexus
   /etc/rc6.d/K20nexus -> ../init.d/nexus
   /etc/rc2.d/S20nexus -> ../init.d/nexus
   /etc/rc3.d/S20nexus -> ../init.d/nexus
   /etc/rc4.d/S20nexus -> ../init.d/nexus
   /etc/rc5.d/S20nexus -> ../init.d/nexus

Ok.现在可以通过service nexus start启动,

然后通过tail -f /usr/nexus/logs/wrapper.log 来检查启动状态。

posted @ 2016-12-13 09:37  托马斯的半亩地  阅读(221)  评论(0编辑  收藏  举报