nexus 安装 配置 启动
安装 JDK
运行 Nexus 需要 Java 8 的运行时环境支持,可以使用 YUM 方式安装安装 open JDK1.8版本,也可以使用 rpm 安装,
我们课程使用 RPM 方式安装
[root@ci-node3 src]# rpm -ivh jdk-8u121-linux-x64.rpm
java安装好了
[root@ci-node3 src]# java -version java version "1.8.0_121" Java(TM) SE Runtime Environment (build 1.8.0_121-b13) Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)
获取 Nexus 安装包
下载地址:https://www.sonatype.com/download-oss-sonatype
安装 Nexus
[root@ci-node3 src]# mv nexus-3.13.0-01-unix.tar.gz /usr/local/
解压
[root@ci-node3 src]# cd /usr/local/ [root@ci-node3 local]# tar -xf nexus-3.13.0-01-unix.tar.gz
解压出两个文件夹
[root@ci-node3 local]# ll total 120028 drwxr-xr-x. 2 root root 6 Apr 11 2018 bin drwxr-xr-x. 2 root root 6 Apr 11 2018 etc drwxr-xr-x. 2 root root 6 Apr 11 2018 games drwxr-xr-x. 2 root root 6 Apr 11 2018 include drwxr-xr-x. 2 root root 6 Apr 11 2018 lib drwxr-xr-x. 2 root root 6 Apr 11 2018 lib64 drwxr-xr-x. 2 root root 6 Apr 11 2018 libexec drwxr-xr-x 9 root root 163 Apr 23 00:39 nexus-3.13.0-01 // nexus 程序 -rw-r--r-- 1 root root 122904706 Dec 17 2018 nexus-3.13.0-01-unix.tar.gz drwxr-xr-x. 2 root root 6 Apr 11 2018 sbin drwxr-xr-x. 5 root root 49 Aug 24 2019 share drwxr-xr-x 3 root root 20 Apr 23 00:39 sonatype-work // 仓库的工作文件夹 drwxr-xr-x. 2 root root 37 Apr 23 00:38 src
改个名字
[root@ci-node3 local]# mv nexus-3.13.0-01 nexus [root@ci-node3 local]# ll total 120028 drwxr-xr-x. 2 root root 6 Apr 11 2018 bin drwxr-xr-x. 2 root root 6 Apr 11 2018 etc drwxr-xr-x. 2 root root 6 Apr 11 2018 games drwxr-xr-x. 2 root root 6 Apr 11 2018 include drwxr-xr-x. 2 root root 6 Apr 11 2018 lib drwxr-xr-x. 2 root root 6 Apr 11 2018 lib64 drwxr-xr-x. 2 root root 6 Apr 11 2018 libexec drwxr-xr-x 9 root root 163 Apr 23 00:39 nexus -rw-r--r-- 1 root root 122904706 Dec 17 2018 nexus-3.13.0-01-unix.tar.gz drwxr-xr-x. 2 root root 6 Apr 11 2018 sbin drwxr-xr-x. 5 root root 49 Aug 24 2019 share drwxr-xr-x 3 root root 20 Apr 23 00:39 sonatype-work drwxr-xr-x. 2 root root 37 Apr 23 00:38 src
启动nexus
上面启动成功后会警告不要使用 root 用户启动,这里可以新建一个用户,也可以指定
root 用户启动,使他不出现警告,
下面配置指定 root 用户启动,编辑 bin 目录下的 nexus.rc 启动配置文件
[root@ci-node3 bin]# cat nexus.rc #run_as_user=""
[root@ci-node3 bin]# pwd /usr/local/nexus/bin [root@ci-node3 bin]# vim nexus.rc
修改内容为:
run_as_user="root
然后wq保存
可以这样使用
[root@ci-node3 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 启动了
[root@ci-node3 bin]# /usr/local/nexus/bin/nexus start WARNING: ************************************************************ WARNING: Detected execution as "root" user. This is NOT recommended! WARNING: ************************************************************ Starting nexus [root@ci-node3 bin]# /usr/local/nexus/bin/nexus status WARNING: ************************************************************ WARNING: Detected execution as "root" user. This is NOT recommended! WARNING: ************************************************************ nexus is running.
在浏览器访问 192.168.31.13:8081 显示出来了 仓库安装好了
登录下
默认用户名admin
密码默认是admin123