当前位置: 首页 > news >正文

【原创】Ubuntu 22安装nexus私服

Nexus Repository Manager 是由 Sonatype 公司开发的一款非常流行的 Maven 私服解决方案。Nexus 提供了多种类型的仓库管理,包括代理远程仓库、托管内部构件的仓库以及用于快照版本和发布版本的仓库。

下载

官网地址:https://www.sonatype.com/
下载地址:https://www.sonatype.com/thanks/repo-community-edition

安装

建议安装Linux系统,CPU四核以上。

解压程序包

tar zxvf nexus-3.77.1-01-unix.tar.gz

启动

cd nexus-3.77.1-01
cd bin/
./nexus start

如果启动不起来,则因该检查JAVA的问题,要求JAVA17

apt-cache search java
apt-get install openjdk-17-jre-zero -y

然后再启动nexus,应该能正常

测试nexus

查看本机IP

ip a

打开URL http://192.168.1.111:8081
记得端口8081,使用http协议

打开后登录,按照提示重设管理员密码

启用https

在IDE中往往要用https协议下载,如果有域名,可以申请一个SSL证书,如果没有域名那么创建一个自签名证书,步骤如下

切换目录

cd nexus-3.77.1-01/etc/ssl

创建证书

在创建证书的时候,需要设置密码,记得密码哦

openssl genrsa -des3 -out server.key 1024
openssl req -new -key server.key -out server.csr
openssl req -x509 -days 3650 -key server.key -in server.csr > server.crt
openssl rsa -in server.key -out server.key.unsecure
openssl pkcs12 -export -out keystore.pkcs12 -inkey server.key -in server.crt
keytool -v -importkeystore -srckeystore keystore.pkcs12 -srcstoretype PKCS12 -destkeystore keystore.jks -deststoretype JKS
root@ubuntu22:~/nexus-3.77.1-01/etc/ssl# ll
total 32
drwxr-xr-x 2 root root 4096 Feb 19 05:50 ./
drwxr-xr-x 7 root root 4096 Feb 19 06:02 ../
-rw-r--r-- 1 root root    0 Feb  6 23:24 .placeholder
-rw-r--r-- 1 root root 1382 Feb 19 05:39 keystore.jks
-rw------- 1 root root 1779 Feb 19 05:38 keystore.pkcs12
-rw-r--r-- 1 root root  891 Feb 19 05:38 server.crt
-rw-r--r-- 1 root root  635 Feb 19 05:37 server.csr
-rw------- 1 root root 1062 Feb 19 05:37 server.key
-rw------- 1 root root  916 Feb 19 05:38 server.key.unsecure

修改配置

切换目录

vi nexus-3.77.1-01/etc/jetty/jetty-https.xml

三个地方填写你的密码

  <New id="sslContextFactory" class="org.eclipse.jetty.util.ssl.SslContextFactory$Server">
    <Set name="KeyStorePath"><Property name="ssl.etc"/>/keystore.jks</Set>
    <Set name="KeyStorePassword">**密码**</Set>
    <Set name="KeyManagerPassword">**密码**</Set>
    <Set name="TrustStorePath"><Property name="ssl.etc"/>/keystore.jks</Set>
    <Set name="TrustStorePassword">**密码**</Set>
    <Set name="EndpointIdentificationAlgorithm"></Set>
    <Set name="NeedClientAuth"><Property name="jetty.ssl.needClientAuth" default="false"/></Set>
    <Set name="WantClientAuth"><Property name="jetty.ssl.wantClientAuth" default="false"/></Set>
    <Set name="IncludeProtocols">
      <Array type="java.lang.String">
        <Item>TLSv1.2</Item>
      </Array>
    </Set>
  </New>

修改属性文件

vi nexus-3.77.1-01/etc/nexus-default.properties

添加application-port-ssl参数
修改application-port 参数
nexus-args参数末尾添加,${jetty.etc}/jetty-https.xml,启用https

## DO NOT EDIT - CUSTOMIZATIONS BELONG IN $data-dir/etc/nexus.properties
##
# Jetty section
application-port-ssl=443
application-port=80
application-host=0.0.0.0
nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml,${jetty.etc}/jetty-https.xml
nexus-context-path=/

# Nexus section
nexus-edition=nexus-pro-edition
nexus-features=\
 nexus-pro-feature

重启 nexus

cd nexus-3.77.1-01/bin
./nexus restart

测试

http://192.168.1.111
https://192.168.1.111

相关文章:

  • LeetCode刷题---哈希表---451
  • Kubernetes Pod健康检查全解析:从Liveness到滚动更新,掌握容器健康管理的核心技巧
  • DeepSeek是什么?两种模型的对比?
  • 系统设计之分布式
  • C++编程语言:抽象机制:模板和层级结构(Bjarne Stroustrup)
  • 宏块划分的原理
  • LeetCode1299
  • 自动创建spring boot应用(eclipse版本)
  • DeepSeek 入门指南
  • 【解决方法】vite-plugin-svg-icons使用中出现问题[vite] Cannot find package ‘fast-glob‘
  • 网络爬虫学习:借助DeepSeek完善爬虫软件,实现模拟鼠标右键点击,将链接另存为本地文件
  • BiRefNet C++ TensorRT (二分类图像分割)
  • MySQL数据库入门到大蛇尚硅谷宋红康老师笔记 高级篇 part 1
  • [原创](Modern C++)现代C++的关键性概念: 妙用std::reference_wrapper, 让std::list容器具有随机访问功能.
  • Zookeeper(54)如何使用Zookeeper的命令行工具?
  • 寒假学习总结
  • 如何解决服务器端口被攻击:全面防护与快速响应
  • 侯捷 C++ 课程学习笔记:设计模式在面向对象开发中的应用
  • Soft Actor-Critic (SAC)算法
  • 嵌入式人工智能应用-第四章 逻辑回归 8
  • 摩根士丹利:对冲基金已加码,八成投资者有意近期增配中国
  • 湖北石首市委副书记、市长付勇接受审查调查
  • 水豚出逃40天至今未归,江苏扬州一动物园发悬赏公告
  • 多地再发网约车从业及投资风险提示:避免盲目花费大笔资金“购车”入行
  • 纪念|古文字学泰斗裘锡圭:“还有很多事情要做”
  • 警惕“全网最低价”等宣传,市监总局和中消协发布直播消费提示