Linux(Centos)安装Nexus3.x

  1. 到sonatype网站下载nexus安装包 unix版
    https://www.sonatype.com/download-oss-sonatype
  2. 将安装包放到/usr/loca/src下
[root@localhost ~]# cd /usr/local/src/
[root@localhost src]# ls
jdk-8u144-linux-x64.tar.gz  nexus-3.5.2-01-unix.tar.gz
  1. 解压缩到/usr/local
[root@localhost src]# tar zxvf nexus-3.5.2-01-unix.tar.gz -C /usr/local/
  1. 尝试到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}
  1. 从提示中可以看出,运行应该是./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/
  1. 尝试用./nexus start启动,后台启动,启动成功后可以访问
  2. 尝试用./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 denied

Warning:  Cannot open log file: ../sonatype-work/nexus3/log/jvm.log
Warning:  Forcing option -XX:LogFile=/tmp/jvm.log
Unable 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
  1. 提示权限不够,切换成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 OSS 3.5.2-01

-------------------------------------------------
  1. 通过浏览器进行访问http://serveraddress:port,如:http://172.16.1.3:8081/
    结果发现找不到页面,这个时候要检查服务器的防火墙是否关闭,如果开启状态,则关闭
Linux(Centos)安装Nexus3.x_第1张图片
访问失败
[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 Mon 2017-09-25 10:10:57 EDT; 5s ago
     Docs: man:firewalld(1)
 Main PID: 3552 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─3552 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

Sep 25 10:10:56 localhost.localdomain systemd[1]: Starting firewalld - dynami...
Sep 25 10:10:57 localhost.localdomain systemd[1]: Started firewalld - dynamic...
Hint: Some lines were ellipsized, use -l to show in full.
[root@localhost ~]# systemctl stop firewalld
  1. 再次访问http://172.16.1.3:8081/
Linux(Centos)安装Nexus3.x_第2张图片
nexus主页

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

你可能感兴趣的:(Linux(Centos)安装Nexus3.x)