1.下载nexus-2.4.0-09-bundle.tar.gz
http://nexus.sonatype.org/downloads/点击打开链接
2.放入/usr/local目录下
执行
root@ubuntu:/usr/local# sudo tar xvzf nexus-2.4.0-09-bundle.tar.gz
建立一个软链接
root@ubuntu:/usr/local# ln -s nexus-2.4.0-09 nexus
3.设置环境变量
设置NEXUS_HOME的环境变量
root@ubuntu:/usr/local# export NEXUS_HOME=/usr/local/nexus
设置RUN_AS_USER的环境变量(也可以设置其他用户名,测试环境直接用了root)
root@ubuntu:/usr/local/nexus# export RUN_AS_USER=root
4.更改nexus下bin文件夹权限
root@ubuntu:/usr/local/# cd nexus
root@ubuntu:/usr/local/nexus# chmod -R a+x bin
5.运行
root@ubuntu:/usr/local/nexus# ./bin/jsw/linux-x86-64/nexus start
6.日志查看
root@ubuntu:~# tail -f /usr/local/nexus/logs/wrapper.log
然后,打开浏览器输入 http://127.0.0.1:8081/nexus/index.html 或者 http://localhost:8081/nexus/index.html
用户名admin,密码admin123就可以管理maven代理仓库了。
7.设置启动脚本
复制nexus到/etc/init.d/
cp /usr/local/nexus/bin/jsw/linux-x86-64/nexus /etc/init.d/
更改文件权限
chmod 755 /etc/init.d/nexus
vi /etc/init.d/nexus
添加一个变量NEXUS_HOME指向nexus安装目录
添加一个变量PLATFORM值为linux-x86-64
更改WRAPPER_CMD为${NEXUS_HOME}/bin/jsw/${PLATFORM}/wrapper
更改WRAPPER_CMD为${NEXUS_HOME}/bin/jsw/${PLATFORM}/wrapper
更改WRAPPER_CONF为${NEXUS_HOME}/bin/jsw/conf/wrapper.conf
设置PIDDIR为/var/run
设置PIDDIR为/var/run
(可选)RUN_AS_USER 为 root
执行
chkconfig --add nexus
service nexus start