nexus 代理 pypi

 


环境说明

服务 ip 端口 备注
nexus 192.168.80.129 (内网) 8081 内网地址无法访问外网
nginx

192.168.80.128 (内网)

192.168.174.126 (外网)

 88

19000

192.168.174.126 地址可以访问外网

创建 Blob Stores

创建 Repositories

设置 proxy

repo 测试

# pip install xlrd -i http://192.168.80.129:8081/repository/pypi-aliyun-repo/simple/ --trusted-host 192.168.80.129
Collecting xlrd
  Downloading http://192.168.80.129:8081/repository/pypi-aliyun-repo/packages/xlrd/2.0.1/xlrd-2.0.1-py2.py3-none-any.whl (96kB)
    100% |████████████████████████████████| 102kB 102.9MB/s 
Installing collected packages: xlrd
Successfully installed xlrd-2.0.1
# pip install pandas -i http://192.168.80.129:8081/repository/pypi-aliyun-repo/simple/ --trusted-host 192.168.80.129
Looking in indexes: http://192.168.80.129:8081/repository/pypi-aliyun-repo/simple/
Collecting pandas
  Downloading http://192.168.80.129:8081/repository/pypi-aliyun-repo/packages/pandas/2.2.1/pandas-2.2.1-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (13.0 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 13.0/13.0 MB 81.4 MB/s eta 0:00:00
Collecting numpy<2,>=1.23.2 (from pandas)
  Downloading http://192.168.80.129:8081/repository/pypi-aliyun-repo/packages/numpy/1.26.4/numpy-1.26.4-cp311-cp311-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (18.3 MB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 18.3/18.3 MB 72.9 MB/s eta 0:00:00
Collecting python-dateutil>=2.8.2 (from pandas)
  Downloading http://192.168.80.129:8081/repository/pypi-aliyun-repo/packages/python-dateutil/2.9.0.post0/python_dateutil-2.9.0.post0-py2.py3-none-any.whl (229 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 229.9/229.9 kB 64.2 MB/s eta 0:00:00
Requirement already satisfied: pytz>=2020.1 in /usr/lib/python3/dist-packages (from pandas) (2023.3)
Collecting tzdata>=2022.7 (from pandas)
  Downloading http://192.168.80.129:8081/repository/pypi-aliyun-repo/packages/tzdata/2024.1/tzdata-2024.1-py2.py3-none-any.whl (345 kB)
     ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 345.4/345.4 kB 79.0 MB/s eta 0:00:00
Requirement already satisfied: six>=1.5 in /usr/lib/python3/dist-packages (from python-dateutil>=2.8.2->pandas) (1.16.0)
Installing collected packages: tzdata, python-dateutil, numpy, pandas
Successfully installed numpy-1.26.4 pandas-2.2.1 python-dateutil-2.9.0.post0 tzdata-2024.1

查看

不启用 http proxy 的方法

Repositories 设置

nginx 配置

server {
    listen       19000;
    server_name  localhost;
    #resolver 202.106.0.20 ipv6=off;
    # 设置代理访问日志
    access_log  logs/proxy.access.log ;
    error_log  logs/proxy.error.log ;

    location /pypi {
    	proxy_pass https://mirrors.aliyun.com;
  
    }
}

测试 repo

# pip install xlrd -i http://192.168.80.129:8081/repository/pypi-aliyun-1-repo/simple --trusted-host 192.168.80.129
Collecting xlrd
  Downloading http://192.168.80.129:8081/repository/pypi-aliyun-1-repo/packages/xlrd/2.0.1/xlrd-2.0.1-py2.py3-none-any.whl (96kB)
    100% |████████████████████████████████| 102kB 72.5MB/s 
Installing collected packages: xlrd
Successfully installed xlrd-2.0.1
# pip install tzdata -i http://192.168.80.129:8081/repository/pypi-aliyun-1-repo/simple --trusted-host 192.168.80.129
Collecting tzdata
  Downloading http://192.168.80.129:8081/repository/pypi-aliyun-1-repo/packages/tzdata/2024.1/tzdata-2024.1-py2.py3-none-any.whl (345kB)
    100% |████████████████████████████████| 348kB 123.7MB/s 
Installing collected packages: tzdata
Successfully installed tzdata-2024.1

查看

参考文档

https://help.sonatype.com/en/pypi-repositories.html

posted @   小吉猫  阅读(202)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· 阿里巴巴 QwQ-32B真的超越了 DeepSeek R-1吗?
· 【译】Visual Studio 中新的强大生产力特性
· 2025年我用 Compose 写了一个 Todo App
· 张高兴的大模型开发实战:(一)使用 Selenium 进行网页爬虫
历史上的今天:
2023-03-31 ansible 部署 nginx
2023-03-31 ansible 常用模块 systemd
2023-03-31 ansible 常用模块 service
2023-03-31 ansible 常用模块 file
2023-03-31 ansible 常用模块 archive
2023-03-31 ansible 常用模块 user
2023-03-31 ansible 常用模块 group
点击右上角即可分享
微信分享提示

目录导航