• centos7.9部署nexus内网源服务器(yum,apt)


    1、通过官网或其他方式下载安装包

    2、安装Java,自行下载

    1. [root@localhost ~]# ll
    2. total 189992
    3. -rw-------. 1 root root 1663 Oct 8 09:06 anaconda-ks.cfg
    4. -rw-r--r--. 1 root root 194545143 Oct 8 17:43 jdk-8u241-linux-x64.tar.gz
    5. [root@localhost ~]# tar xf jdk-8u241-linux-x64.tar.gz -C /usr/local/
    6. [root@localhost ~]# tail -5 /etc/profile
    7. export JAVA_HOME=/usr/local/jdk1.8.0_241/
    8. export PATH=$JAVA_HOME/bin:$PATH
    9. export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar
    10. [root@localhost ~]# source /etc/profile
    11. [root@localhost ~]# java -version
    12. java version "1.8.0_241"
    13. Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
    14. Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)

    3、解压nexus

    1. [root@localhost ~]# tar xf nexus-3.42.0-01-unix.tar.gz -C /opt/
    2. [root@localhost ~]# ll /opt/
    3. total 0
    4. drwxr-xr-x. 10 root root 181 Oct 8 18:40 nexus-3.42.0-01
    5. drwxr-xr-x. 3 root root 20 Oct 8 18:40 sonatype-work

    nexus-3.42.0-01:用于实现 nexus 功能
    sonatype-work:用于存储数据

    4、启动nexus

    1. [root@localhost ~]# cd /opt/nexus-3.42.0-01/etc/
    2. [root@localhost etc]# cat nexus-default.properties
    3. ## DO NOT EDIT - CUSTOMIZATIONS BELONG IN $data-dir/etc/nexus.properties
    4. ##
    5. # Jetty section
    6. application-port=8081
    7. application-host=0.0.0.0
    8. nexus-args=${jetty.etc}/jetty.xml,${jetty.etc}/jetty-http.xml,${jetty.etc}/jetty-requestlog.xml
    9. nexus-context-path=/
    10. # Nexus section
    11. nexus-edition=nexus-pro-edition
    12. nexus-features=\
    13. nexus-pro-feature
    14. nexus.hazelcast.discovery.isEnabled=true
    15. 配置文件无其他要求则保持默认即可
    16. 启动nexus
    17. [root@localhost etc]# cd /opt/nexus-3.42.0-01/bin/
    18. [root@localhost bin]# ll
    19. total 32
    20. drwxr-xr-x. 2 root root 4096 Oct 8 18:40 contrib
    21. -rwxr-xr-x. 1 root root 18620 Sep 24 2022 nexus
    22. -rw-r--r--. 1 root root 15 Sep 24 2022 nexus.rc
    23. -rw-r--r--. 1 root root 1635 Sep 24 2022 nexus.vmoptions
    24. [root@localhost bin]# ./nexus start
    25. WARNING: ************************************************************
    26. WARNING: Detected execution as "root" user. This is NOT recommended!
    27. WARNING: ************************************************************
    28. Starting nexus
    29. [root@localhost bin]# netstat -lntup
    30. Active Internet connections (only servers)
    31. Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
    32. tcp 0 0 127.0.0.1:42403 0.0.0.0:* LISTEN 12630/java
    33. tcp 0 0 0.0.0.0:8081 0.0.0.0:* LISTEN 12630/java
    34. tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1160/sshd
    35. tcp 0 0 127.0.0.1:25 0.0.0.0:* LISTEN 1404/master
    36. tcp6 0 0 :::22 :::* LISTEN 1160/sshd
    37. tcp6 0 0 ::1:25 :::* LISTEN 1404/master
    38. 可以看到默认8081端口已启动

    5、其他相关命令

    1. #停止
    2. ./nexus stop
    3. #重启
    4. ./nexus restart
    5. #强制重新加载
    6. ./nexus force-reload
    7. #查看状态
    8. ./nexus status

    6、网页登陆

    浏览器访问Nexus的web首页,进行登陆输入账号和密码
    默认用户名为admin,密码在 sonatype-work/nexus3 目录下 的 admin.password 文件中查看初始化密码。

    1. [root@localhost ~]# cd /opt/sonatype-work/nexus3/
    2. [root@localhost nexus3]# ls
    3. admin.password cache elasticsearch generated-bundles karaf.pid lock orient restore-from-backup
    4. blobs db etc instances keystores log port tmp
    5. [root@localhost nexus3]# cat admin.password
    6. 167f1619-f8e5-4ab9-83e7-d040c2f9c8ae

    将账号密码输入

    按照提示修改密码

    修改完成后查看

    7、创建blob

    8、创建repositories

    点击创建。

    9、服务器后台搭建私有仓库(使用阿里云和epel源,通过reposync下载)

    参照我之前文章:centos6&7&8搭建私有仓库

    搭建成功后,可导入目录(所有rpm包所在的统一目录)到yumHosted里。

    下载完成:

    导入目录:

    find . -type f -exec curl -v --user 'admin:密码' --upload-file {} http://10.10.200.20:8081/repository/yumHosted/{} \;
    全部导入后,可对比大小确认一下:

    10、客户端配置yum源地址

    直接使用上图所示url,repo文件内容如下:

    [nexus]
    name=Nexus Yum Repository
    baseurl=http://10.10.200.20:8081/repository/yumHosted/
    enabled=1
    gpgcheck=0

  • 相关阅读:
    (附源码)springboot投稿和稿件处理系统 毕业设计 201458
    铝阳极氧化废水除铝
    Kafka知识点总结
    C#学习系列相关之多线程(五)----线程池ThreadPool用法
    算法竞赛进阶指南 基本算法 0x01 位运算
    一文带你读懂:TCP连接的三次握手和四次挥手(下篇)
    nginx浏览器缓存和上流缓存expires指令_nginx配置HTTPS
    Spire.Office for .NET 7.12.0 2022年最后版本?
    8、MySQL——数据的完整性
    毫米波雷达2-雷达的工作模式
  • 原文地址:https://blog.csdn.net/weixin_44147924/article/details/133672466