Maven

centos下nexus私服搭建

2018-08-21  本文已影响1027人  放生_06af

1、下载最新版的nexus,下载地址 https://www.sonatype.com/download-oss-sonatype

      下载安装JDK,nexus3.X版本需要JDK1.8以上的版本。

2、解压缩到/usr/local

[root@localhost src]# tar zxvf nexus-3.5.2-01-unix.tar.gz -C /usr/local/

尝试到bin目录下运行

[root@localhost bin]# pwd

/usr/local/nexus-3.5.2-01/bin

[root@localhost bin]# ls

contrib  nexus  nexus.rc  nexus.vmoptions

[root@localhost bin]# ./nexus

WARNING:************************************************************

WARNING:Detected execution as"root"user.  This is NOT recommended!

WARNING:************************************************************

Usage:./nexus {start|stop|run|run-redirect|status|restart|force-reload}

从提示中可以看出,运行应该是./nexus start 或./nexus run,并且不推荐用root运行,那我创建一个nexus用户好了

创建nexus用户

[root@localhost bin]# useradd nexus

将文件夹所属改为nexus

[root@localhost local]# chown nexus:nexus -R nexus-3.5.2-01/

切换身份运行[root@localhost local]# su - nexus

[nexus@localhost ~]$ cd /usr/local/nexus-3.5.2-01/bin/

尝试用./nexus start启动,后台启动,启动成功后可以访问

尝试用./nexus run启动,前台启动,显示日志,启动后可以访问

[nexus@localhost bin]$ ./nexus run

Java HotSpot(TM) 64-Bit Server VM warning: Cannot open file ../sonatype-work/nexus3/log/jvm.log due to Permission deniedWarning:  Cannot openlogfile: ../sonatype-work/nexus3/log/jvm.logWarning:  Forcing option -XX:LogFile=/tmp/jvm.logUnable to update instance pid: Unable to create directory /usr/local/sonatype-work/nexus3/instances/usr/local/sonatype-work/nexus3/log/karaf.log (Permission denied)Unable to update instance pid: Unable to create directory /usr/local/sonatype-work/nexus3/instances

提示权限不够,切换成root对nexus用户进行授权,并且可以得出,nexus会自动创建该文件夹,并且要把数据写到里面

[root@localhost local]# chown nexus:nexus -R sonatype-work/

[root@localhost local]# su - nexus

[nexus@localhost ~]$ cd /usr/local/nexus-3.5.2-01/bin/

[nexus@localhost bin]$ ./nexus run

...

-------------------------------------------------

Started Sonatype Nexus OSS3.5.2-01

-------------------------------------------------

通过浏览器进行访问http://serveraddress:port,如:http://172.16.1.3:8081/

结果发现找不到页面,这个时候要检查服务器的防火墙是否关闭,如果开启状态,则关闭

访问失败

[root@localhost ~]# systemctl status firewalld

● firewalld.service - firewalld - dynamic firewall daemon  Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)  Active: active (running) since Mon2017-09-2510:10:57EDT;5s ago    Docs: man:firewalld(1) Main PID:3552(firewalld)CGroup: /system.slice/firewalld.service          └─3552/usr/bin/python -Es /usr/sbin/firewalld --nofork --nopidSep2510:10:56localhost.localdomain systemd[1]: Starting firewalld - dynami...Sep2510:10:57localhost.localdomain systemd[1]: Started firewalld - dynamic...Hint: Some lines were ellipsized, use -l to showinfull.

[root@localhost ~]# systemctl stop firewalld

再次访问http://172.16.1.3:8081/

nexus主页

忙了好一会儿终于算是把nexus服务搭建好了,默认管理员账号密码是admin/admin12

上一篇下一篇

猜你喜欢

热点阅读