centos7利用nexus离线搭建局域网pypi源

1、官网下载nexus oss版本

https://sonatype-download.global.ssl.fastly.net/repository/downloads-prod-group/3/nexus-3.29.2-02-unix.tar.gz

[root@localhost bin]# wget https://sonatype-download.global.ssl.fastly.net/repository/downloads-prod-group/3/nexus-3.29.2-02-unix.tar.gz

2、解压nexus至本地目录

[root@localhost bin]# tar -zxvf nexus-3.29.2-02-unix.tar.gz

3、启动nexus服务 ,如果提示JAVA_HOME没有设置,请安装java的JDK环境

[root@localhost bin]# cd /opt/nexus-3.29.2-02/bin/
[root@localhost bin]# ./nexus start
WARNING: ************************************************************
WARNING: Detected execution as "root" user.  This is NOT recommended!
WARNING: ************************************************************
Starting nexus

4、创建pypi仓库


hosted – 宿主仓库,用户可以 deploy 到 hosted 中,也可以手工上传构件到 hosted 里,在 central repository 是获取不到的,就需要手工上传到hosted里


group – 仓库组,将上述多个仓库聚合,对用户暴露统一的地址

5、上传pypi包

1)通过web页面上传(适合包比较少时)

2)命令行上传,需要先安装twine(适合批量上传)
pip3 install twine
twine upload   --repository-url
twine upload   --repository-url  http://10.4.7.23:8081/repository/pypi-hosted/  -u admin -p admin123 /opt/pypi/*   //要上传的路径为http://10.4.7.23:8081/repository/pypi-hosted/ 登录用户名为admin 密码为admin123pypi包所在的路径为/opt/pypi/
3)twine 各参数含义
$ twine upload -h
usage: twine upload [-h] [-r REPOSITORY] [--repository-url REPOSITORY_URL][-s] [--sign-with SIGN_WITH] [-i IDENTITY] [-u USERNAME][-p PASSWORD] [-c COMMENT] [--config-file CONFIG_FILE][--skip-existing] [--cert path] [--client-cert path][--verbose] [--disable-progress-bar]dist [dist ...]positional arguments:dist                  The distribution files to upload to the repository(package index). Usually dist/* . May additionallycontain a .asc file to include an existing signaturewith the file upload.optional arguments:-h, --help            show this help message and exit-r REPOSITORY, --repository REPOSITORYThe repository (package index) to upload the packageto. Should be a section in the config file (default:pypi). (Can also be set via TWINE_REPOSITORYenvironment variable.)--repository-url REPOSITORY_URLThe repository (package index) URL to upload thepackage to. This overrides --repository. (Can also beset via TWINE_REPOSITORY_URL environment variable.)-s, --sign            Sign files to upload using GPG.--sign-with SIGN_WITHGPG program used to sign uploads (default: gpg).-i IDENTITY, --identity IDENTITYGPG identity used to sign files.-u USERNAME, --username USERNAMEThe username to authenticate to the repository(package index) as. (Can also be set viaTWINE_USERNAME environment variable.)-p PASSWORD, --password PASSWORDThe password to authenticate to the repository(package index) with. (Can also be set viaTWINE_PASSWORD environment variable.)--non-interactive     Do not interactively prompt for username/passwordif the required credentials are missing. (Can alsobe set via TWINE_NON_INTERACTIVE environmentvariable.)-c COMMENT, --comment COMMENTThe comment to include with the distribution file.--config-file CONFIG_FILEThe .pypirc config file to use.--skip-existing       Continue uploading files if one already exists. (Onlyvalid when uploading to PyPI. Other implementationsmay not support this.)--cert path           Path to alternate CA bundle (can also be set viaTWINE_CERT environment variable).--client-cert path    Path to SSL client certificate, a single filecontaining the private key and the certificate in PEMformat.--verbose             Show verbose output.--disable-progress-barDisable the progress bar.

6、上传后结果

7、pip使用本地源进行安装

[root@localhost bin]# pip install requests -i http://10.4.7.23:8081/repository/pypi-group/simple --trusted-host 10.4.7.23  //-i 指定pypi源
Collecting requestsDownloading http://10.4.7.23:8081/repository/pypi-group/packages/requests/2.25.1/requests-2.25.1-py2.py3-none-any.whl (61kB)100% |████████████████████████████████| 61kB 6.3MB/s
Collecting certifi>=2017.4.17 (from requests)Downloading http://10.4.7.23:8081/repository/pypi-group/packages/certifi/2020.12.5/certifi-2020.12.5-py2.py3-none-any.whl (147kB)

centos7利用nexus离线搭建局域网pypi源相关推荐

  1. [Pipy]利用pip2pi搭建本地pypi源

    当我们一个团队开发一个项目的时候,需要的Python第三方包基本是固定的,每次搭建新环境的时候总是因为各种内外网,https问题花费大量的时间来安装运行环境. 所以搭建一个本地的,小巧的,只包含需要的 ...

  2. centos 7 局域网丢包排查_Nginx搭建局域网yum源问题补充及解决思路与方法转发收藏...

    上一篇文章描述了利用Nginx搭建局域网yum源,安装完成后可以使用,但是有的老铁反馈说出现如下错误,可以查询到包,但是安装的时候,提示找不到路径,我这里做了测试,总结到这篇文章中. 这里是用安装te ...

  3. Python搭建私有pypi源发包——pypi-server

    文章目录 简介 1. 搭建私有 pypi 源 2. 开发要上传的包 3. 生成 dist 目录用于上传 4. 上传包到私有 pypi 源 5. 安装 Linux 安装 参考文献 简介 本地搭建 pyp ...

  4. nginx+createrepo搭建局域网yum源

    上传Centos镜像 CentOS-7-x86_64-DVD-2207-02.iso 挂载iso镜像 mkdir -p /mnt/cdrom   #创建挂载目录 mount -o loop CentO ...

  5. 基于Bandersnatch搭建本地pypi源

    1.安装python3 yum -y install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline- ...

  6. 在centos7中如何搭建局域网yum源仓库

    1.#输入命令rmp -q -vsftpd,查看是否安装了该包. 2.#创建挂载点,把光盘挂载到该点 3.#使用命令用rpm-ivh 安装vsftpd安装包 4.#启动vsftpd服务,设为下次开机启 ...

  7. centos7利用docker 快速搭建苹果CMS站点

    阿里云centos7服务器,利用docker,快速搭建苹果cms.效果如下: 1.centos7 系统安装docker. 可查看这篇博文: https://www.cnblogs.com/yufeng ...

  8. 利用移动硬盘+路由器搭建局域网云存储

    之前由于宿舍内部一直是使用无线网络连接,打dota的时候就会卡的半死,这两天在宿舍终于用3台路由器把7人的电脑终于全部连起来了,现在打dota毫无压力.然后局域网内部的互访也打通了.突然想到能不能在路 ...

  9. 局域网搭建Linux镜像源

    前言 一般情况在企业的局域网内,是不连接外网的,所以像阿里云这样的在线的镜像源就用不了,我相信大家个人在虚拟机里面连的就是阿里云镜像源了,而且局域网内服务器较多的话,本地挂载镜像源再来更新其实就不太方 ...

最新文章

  1. HarmonyOS 实现跑马灯效果
  2. IIS+PHP+MySQL+Zend Optimizer+GD库+phpMyAdmin安装配置[完整修正实用版]
  3. python设计选择题代码_《Python程序设计》试题库
  4. 表格存储技术方案实践及客户案例分享
  5. 【渝粤教育】国家开放大学2018年秋季 0149-21T现代汉语 参考试题
  6. ResNet、Faster RCNN、Mask RCNN 是专利算法吗?盘点何恺明参与发明的专利!
  7. java加密 c解密_java+加密解密
  8. springboot定时删除log4j_SpringBoot整合log4j2进行日志配置及防坑指南
  9. android中Stub Proxy答疑
  10. 为什么新一代的Rust、Go等编程语言都如此讨厌if-else、Switch结构
  11. 【luogu4145】 上帝造题的七分钟2 / 花神游历各国 [线段树]
  12. 利用kd树实现最近邻搜索
  13. Elasticsearch 安装详细步骤(保姆级安装)
  14. Mysql 查询数据库数据量
  15. mysql alter index rebuild_Oracle alter index rebuild 说明
  16. 电脑白屏,电脑白屏怎么办
  17. 北京大学2016年数学分析考研试题
  18. 测试工具之SecureCRT
  19. javascript的基本知识点
  20. 将回调地狱按在地上摩擦的Promise

热门文章

  1. 更新SQL Server实例所有数据库表统计信息
  2. Ural 1627 Join(生成树计数)
  3. python和java后期发展_Python与java的发展前景谁最大
  4. 数据结构与算法——二叉树、堆、优先队列
  5. scala-wordcount
  6. 修改yum的镜像服务器为阿里云
  7. Spring tx:advice/
  8. gradle java ide_使用Gradle构建Java项目
  9. java日历类add方法_Java日历computeTime()方法及示例
  10. java反射 动态调用_java反射拼接方法名动态执行方法