私仓库Nexus搭建

没有命令提示符tab键无效

#安装Linux命令补全工具
yum -y install bash-completion
#执行bash或者reboot重启系统
bash

#如果上述的命令执行了有问题可以执行功能下面的命令
yum install epel-release -y
yum install bash-completion bash-completion-extras -y

安装Linux命令补全工具

命令执行过程
[root@ebs-139265 ~]# yum -y install bash-completion
Loaded plugins: fastestmirror
Determining fastest mirrors
epel/x86_64/metalink                                                                                                                                                                                       | 6.8 kB  00:00:00     
 * base: mirrors.ustc.edu.cn
 * epel: mirror.nyist.edu.cn
 * extras: mirrors.aliyun.com
 * updates: mirrors.aliyun.com
base                                                                                                                                                                                                       | 3.6 kB  00:00:00     
epel                                                                                                                                                                                                       | 4.7 kB  00:00:00     
extras                                                                                                                                                                                                     | 2.9 kB  00:00:00     
updates                                                                                                                                                                                                    | 2.9 kB  00:00:00     
(1/5): extras/7/x86_64/primary_db                                                                                                                                                                          | 250 kB  00:00:00     
epel/x86_64/primary_db         FAILED                                          
https://mirror.01link.hk/epel/7/x86_64/repodata/6e8389beb8414d34d10dfe9ff045c741679ce310facb8c8e7fae7481bb1e527d-primary.sqlite.bz2: [Errno 14] curl#60 - "Peer's Certificate has expired."     ]  0.0 B/s |    0 B  --:--:-- ETA 
Trying other mirror.
It was impossible to connect to the CentOS servers.
This could mean a connectivity issue in your environment, such as the requirement to configure a proxy,
or a transparent proxy that tampers with TLS security, or an incorrect system clock.
You can try to solve this issue by using the instructions on https://wiki.centos.org/yum-errors
If above article doesn't help to resolve this issue please use https://bugs.centos.org/.

(2/5): epel/x86_64/updateinfo                                                                                                                                                                              | 1.0 MB  00:00:00     
(3/5): epel/x86_64/group_gz                                                                                                                                                                                |  99 kB  00:00:00     
(4/5): epel/x86_64/primary_db                                                                                                                                                                              | 7.0 MB  00:00:02     
(5/5): updates/7/x86_64/primary_db                                                                                                                                                                         |  23 MB  00:00:05     
Resolving Dependencies
--> Running transaction check
---> Package bash-completion.noarch 1:2.1-8.el7 will be installed
--> Finished Dependency Resolution

Dependencies Resolved

==================================================================================================================================================================================================================================
 Package                                                     Arch                                               Version                                                    Repository                                        Size
==================================================================================================================================================================================================================================
Installing:
 bash-completion                                             noarch                                             1:2.1-8.el7                                                base                                              87 k

Transaction Summary
==================================================================================================================================================================================================================================
Install  1 Package

Total download size: 87 k
Installed size: 263 k
Downloading packages:
bash-completion-2.1-8.el7.noarch.rpm                                                                                                                                                                       |  87 kB  00:00:00     
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
  Installing : 1:bash-completion-2.1-8.el7.noarch                                                                                                                                                                             1/1 
  Verifying  : 1:bash-completion-2.1-8.el7.noarch                                                                                                                                                                             1/1 

Installed:
  bash-completion.noarch 1:2.1-8.el7                                                                                                                                                                                              

Complete!
[root@ebs-139265 ~]# bash ##配置生效
验证

输入命令 systemctl status ip 再按Tab键进行测试 如果出现提示 则代表正常

关闭防火墙

[root@ebs-139265 ~]# systemctl status iptables.service 
Display all 271 possibilities? (y or n)
[root@ebs-139265 ~]# systemctl status iptables.service  ## 查看防火墙状态
● iptables.service - IPv4 firewall with iptables
   Loaded: loaded (/usr/lib/systemd/system/iptables.service; enabled; vendor preset: disabled)
   Active: active (exited) since Sun 2023-10-15 10:42:05 CST; 32min ago
  Process: 517 ExecStart=/usr/libexec/iptables/iptables.init start (code=exited, status=0/SUCCESS)
 Main PID: 517 (code=exited, status=0/SUCCESS)
   CGroup: /system.slice/iptables.service

Oct 15 10:42:05 ebs-139265 systemd[1]: Starting IPv4 firewall with iptables...
Oct 15 10:42:05 ebs-139265 iptables.init[517]: iptables: Applying firewall rules: [  OK  ]
Oct 15 10:42:05 ebs-139265 systemd[1]: Started IPv4 firewall with iptables.
[root@ebs-139265 ~]# systemctl stop iptables.service   ## 关闭防火墙
[root@ebs-139265 ~]#

安装JDK

[root@ebs-139265 opt]# tar -zxvf jdk-8u202-linux-x64.tar.gz  ##解压文件
配置环境
[root@ebs-139265 opt]# vim /etc/profile
增加以下配置
export JAVA_HOME=/opt/jdk1.8.0_202
export JRE_HOME=${JAVA_HOME}/jre
export CLASSPATH=.:${JAVA_HOME}/lib:${JRE_HOME}/lib
export PATH=${JAVA_HOME}/bin:$PATH
生效配置
[root@ebs-139265 opt]# source /etc/profile
[root@ebs-139265 opt]# java -version
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)
[root@ebs-139265 opt]#

下载地址

历史版本下载地址
https://help.sonatype.com/repomanager3/product-information/download/download-archives---repository-manager-3
Unix archive	https://download.sonatype.com/nexus/3/nexus-3.60.0-02-unix.tar.gz 
Windows archive	https://download.sonatype.com/nexus/3/nexus-3.60.0-02-win64.zip
Mac OS archive	https://download.sonatype.com/nexus/3/nexus-3.60.0-02-mac.tgz
官方安装文档地址
https://help.sonatype.com/repomanager3/installation-and-upgrades/installation-methods

安装

[root@ebs-139265 opt]# ls
jdk1.8.0_202  jdk-8u202-linux-x64.tar.gz  nexus-3.55.0-01-unix.tar.gz
[root@ebs-139265 opt]# mkdir nexus
[root@ebs-139265 opt]# cd nexus/
[root@ebs-139265 nexus]# cp ./../nexus-3.55.0-01-unix.tar.gz ./
[root@ebs-139265 nexus]# ls
nexus-3.55.0-01-unix.tar.gz
[root@ebs-139265 nexus]# 
[root@ebs-139265 nexus]# tar -zxvf nexus-3.55.0-01-unix.tar.gz  ## 解压文件
服务对应目录
[root@ebs-139265 nexus]# ls
nexus-3.55.0-01  nexus-3.55.0-01-unix.tar.gz  sonatype-work
[root@ebs-139265 nexus]# cd nexus-3.55.0-01/
[root@ebs-139265 nexus-3.55.0-01]# ls
bin  deploy  etc  lib  NOTICE.txt  OSS-LICENSE.txt  PRO-LICENSE.txt  public  replicator  system
[root@ebs-139265 nexus-3.55.0-01]# cd bin/
[root@ebs-139265 bin]# ls
contrib  nexus  nexus.rc  nexus.vmoptions
[root@ebs-139265 bin]# pwd
/opt/nexus/nexus-3.55.0-01/bin
[root@ebs-139265 bin]#
启动命令
## start, stop, restart, force-reload ,status
[root@ebs-139265 bin]# ./nexus start
WARNING: ************************************************************
WARNING: Detected execution as "root" user.  This is NOT recommended!
WARNING: ************************************************************
Starting nexus
[root@ebs-139265 bin]#
日志目录
[root@ebs-139265 log]# pwd
/opt/nexus/sonatype-work/nexus3/log
[root@ebs-139265 log]# tail -f nexus.log
账户信息

默认密码为服务启动后生成的 admin.password 登录后修改密码

[root@ebs-139265 nexus3]# ls
admin.password  blobs  cache  db  elasticsearch  etc  generated-bundles  instances  karaf.pid  keystores  lock  log  orient  port  restore-from-backup  tmp
[root@ebs-139265 nexus3]# pwd
/opt/nexus/sonatype-work/nexus3
[root@ebs-139265 nexus3]# 
[root@ebs-139265 nexus3]# cat admin.password 
3d68bd6a-8725-4749-96c2-119dd3a2ce86
[root@ebs-139265 nexus3]#
访问地址
http://192.168.10.111:8081  ## 自己服务器的地址

私仓库Nexus_nexus

此处演示 修改账户与密码相同 为 admin

配置

自定义文件上传仓库

登录上去后 点击菜单 upload 找到 maven-releases

私仓库Nexus_nexus_02

此处以上传自定义 json 为例

私仓库Nexus_nexus_03

点击 browse 选择本地包

私仓库Nexus_nexus_04

完成后点击 browse菜单 就可以看到对应的 jar

私仓库Nexus_下载地址_05

配置第三方依赖下载地址

此处以配置aliyun下载地址为例子

私仓库Nexus_unix_06

点击create repository

私仓库Nexus_nexus_07

私仓库Nexus_nexus_08

完了之后保存

在自定义仓库配置下载源 完成后保存

私仓库Nexus_nexus_09