在linux上搭建nexus私服(CentOS7)

1.下载nexus安装包,下载地址

https://www.sonatype.com/download-oss-sonatype?hsCtaTracking=920dd7b5-7ef3-47fe-9600-10fecad8aa32%7Cf59d5f10-099f-4c66-a622-0254373f4a92

 

 

2.上传/usr/local后解压文件,目录结构如下:

 

偷懒,直接把解压后的sonatype-work文件移动nexus目录下

3.添加nexus组和用户

groupadd nexus

useradd -g nexus -m nexus

passwd nexus

密码设置为nexus123

4.修改nexus目录归属权限

chown -R nexus:nexus nexus

5.开放防火墙,默认是8081端口

firewall-cmd --zone=public --permanent --add-port=8081/tcp

service firewalld restart

6.修改nexus配置(/usr/local/nexus/conf/nexus.properties),修改nexus的host和工作目录

 

 

7.启动nexus

切换到nexus用户,进入目录/usr/local/nexus/bin,执行如下命令启动service:

./nexus start

8.查看启动日志

tail -f ../logs/wrapper.log

 

9.设置为系统启动服务(参考官方文档:https://help.sonatype.com/display/NXRM2/Configuring+Nexus+Repository+Manager+as+a+Service

a.拷贝文件

$NEXUS_HOME/bin/nexus to /etc/init.d/nexus

b给文件赋执行权限,并分配给root用户

chmod 755 /etc/init.d/nexus

chown root /etc/init.d/nexus

c修改nexus文件(/etc/init.d/nexus)

修改NEXUS_HOME为绝对路径:NEXUS_HOME="/usr/local/nexus"

修改RUN_AS_USER运行用户为nexus

d.添加nexus为启动服务

 

 cd /etc/init.d

$ chkconfig --add nexus

$ chkconfig --levels 345 nexus on

$ service nexus start

Starting Nexus Repository Manager Pro...

$ tail -f /usr/local/nexus/logs/wrapper.log

 

10.在浏览器中访问私服管理界面:

http://192.168.1.169:8081/nexus/

用户名和密码:admin/admin123

 

 

posted @ 2017-12-10 16:58  junge8618  阅读(646)  评论(0编辑  收藏  举报