部署 nexus
https://help.sonatype.com/repomanager3/installation/system-requirements#SystemRequirements-SupportedVersions
安装jdk
[root@mq-node3 ~]# apt install openjdk-8-jdk -y
解压nexus
[root@mq-node3 ~]# cd /usr/local/src/
[root@mq-node3 src]# ll
total 8
drwxr-xr-x 2 root root 4096 Feb 4 2020 ./
drwxr-xr-x 10 root root 4096 Feb 4 2020 ../
[root@mq-node3 src]# cp /root/nexus-3.30.1-01-unix.tar.gz .
[root@mq-node3 src]# tar xf nexus-3.30.1-01-unix.tar.gz
创建目录
[root@mq-node3 src]# mkdir /apps
制作软链接
[root@mq-node3 ~]# ln -sv /usr/local/src/nexus-3.30.1-01 /apps/nexus
制作启动system文件
[root@mq-node3 ~]# vim /lib/systemd/system/nexus.service
[Unit]
Description=nexus service
After=network.target
[Service]
Type=forking
LimitNOFILE=65536
ExecStart=/apps/nexus/bin/nexus start
ExecStop=/apps/nexus/bin/nexus stop
User=root
Restart=on-abort
TimeoutSec=600
[Install]
WantedBy=multi-user.target
重新加载
[root@mq-node3 ~]# systemctl daemon-reload
启动
[root@mq-node3 ~]# systemctl restart nexus
查看端口
[root@mq-node3 ~]# ss -tnl
8081
查看日志看到,说明启动成功
[root@mq-node3 ~]# vim /var/log/syslog
Aug 18 21:31:06 mq-node3 systemd-udevd[541]: Network interface NamePolicy= disabled on kernel command line, ignoring.
Aug 18 21:31:06 mq-node3 nexus[18936]: WARNING: ************************************************************
Aug 18 21:31:06 mq-node3 nexus[18936]: WARNING: Detected execution as "root" user. This is NOT recommended!
Aug 18 21:31:06 mq-node3 nexus[18936]: WARNING: ************************************************************
Aug 18 21:31:06 mq-node3 nexus[18936]: Starting nexus
Aug 18 21:31:06 mq-node3 systemd[1]: Started nexus service.
网页输入
http://ip:8081
登录的密码
[root@mq-node3 ~]# cat /usr/local/src/sonatype-work/nexus3/admin.password
25739fee-e514-4acc-9618-dcda6a6c3e29
验证默认仓库:
Hosted:
Hosted:本地仓库,通常我们会部署自己的构件到这一类型的仓库,比如公司的第三方库
Proxy
Proxy:代理仓库,它们被用来代理远程的公共仓库,如 maven *仓库(官方仓
库)。
Group:
Group:仓库组,用来合并多个 hosted/proxy 仓库,当你的项目希望在多个
repository 使用资源时就不需要多次引用了,只需要引用一个 group 即可。
创建目录
[root@mq-node3 ~]# mkdir /data/nexus/epel -p
用到再把路径复制出来
范例;配置CentOS7-epel源
[root@localhost yum.repos.d]# vim nexus-epel.repo
[epel-nexus]
name=nexus-epel
baseurl=http://172.31.2.46:8081/repository/epel-nexus/
gpgcheck=0
enabled=1
查看
[root@localhost yum.repos.d]# yum repolist
范例:Ubuntu1804源
创建目录
[root@mq-node3 ~]# mkdir /data/nexus/ubuntu1804 -p
修改apt源配置
[root@Bj-Ubuntu ~]# vim /etc/apt/sources.list
deb http://172.31.2.46:8081/repository/ubuntu1804-nexus/ bionic main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic main restricted universe multiverse
deb http://172.31.2.46:8081/repository/ubuntu1804-nexus/ bionic-updates main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-updates main restricted universe multiverse
deb http://172.31.2.46:8081/repository/ubuntu1804-nexus/ bionic-backports main restricted universe multiverse
# deb-src https://mirrors.tuna.tsinghua.edu.cn/ubuntu/ bionic-backports main restricted universe multiverse
deb http://172.31.2.46:8081/repository/ubuntu1804-nexus/ bionic-security main restricted universe multiverse
可以更新
[root@Bj-Ubuntu ~]# apt update
测试安装jdk
[root@Bj-Ubuntu ~]# apt install openjdk-8-jdk -y
验证
[root@Bj-Ubuntu ~]# java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (build 1.8.0_292-8u292-b10-0ubuntu1~18.04-b10)
OpenJDK 64-Bit Server VM (build 25.292-b10, mixed mode)