`
daiyuok
  • 浏览: 25344 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Maven——搭建Maven私服(一)

阅读更多

首先确保JDK1.6已经安装

 

1.下载并安装Nexus

 

http://www.sonatype.org/nexus/

 

解压缩,生成ln -s 到/usr/local/nexus下

 

为了日后方便,按照官方文档的方式设置一个环境变量,将下面的脚本添加到/etc/environment文件最后

NEXUS_HOME=/usr/nexus

RUN_AS_USER=root

 

注意:

a. /etc/environment文件里面export不是必须的,可以没有

b./etc/environment设置的环境变量整个系统有效,Ubuntu推荐使用,不推荐用/etc/profile,我试过/etc/profile,没有效果

c.使用了/etc/environment,如果root用户没有激活,当从其他用户通过sudo -s切换到root权限的时候,/etc/environment设置的环境变量会消失。因此要启用root

 

2.创建系统服务

复制Nexus自带的脚本到/etc/init.d目录
root@ThinkVage-PC:/u/app/nexus-2.1.2/bin/jsw/linux-x86-64# sudo cp nexus /etc/init.d/

添加几个变量到nexus脚本中

NEXUS_HOME=/usr/local/nexus

RUN_AS_USER=root

PLATFORM=linux-x86-64

如果你用的不是系统自带的JRE,要加上。

#JAVA_HOME=/usr/local/jdk 

#PATH="$JAVA_HOME/bin:$PATH

修改几个变量的值:

# Wrapper
WRAPPER_CMD=$NEXUS_HOME/bin/jsw/$PLATFORM/wrapper
WRAPPER_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

 

3. 安装完毕

 

Ok.现在可以通过service nexus start启动,
然后通过tail -f /usr/nexus/logs/wrapper.log 来检查启动状态。

 

 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics