使用BaGet搭建私有nuget源

BaGet

搭建过程

官方包 v0.4.0-preview2

修改配置

运行
dotnet BaGet.dll

运行效果如下

上传

dotnet nuget push -s http://localhost/v3/index.json package.nupkg

如果设置了秘钥以后可通过setapikey命令配置

nuget setapikey <key> -Source <url> [options]

例如

nuget setapikey 4003d786-cc37-4004-bfdf-c4f3e8ef9b3a -source https://example.com/nugetfeed

setapikey

导入原有nuget

for /f "delims=" %%f in ('dir /b /a-d-h-s') do (
rem echo %%f
dotnet nuget push -s http://localhost:8080/v3/index.json %%f
)

删除包

dotnet nuget delete  -s http://127.0.0.1/v3/index.json   test 1.0.0

centos部署

  1. 导入微软源
sudo rpm -Uvh https://packages.microsoft.com/config/centos/7/packages-microsoft-prod.rpm
  1. 安装对应版本
sudo yum install aspnetcore-runtime-3.1
  1. 部署成服务
    创建start.sh
#!/bin/bash

cd /server/baget # 需要注意此处的路径切换
dotnet Baget.dll &

系统服务目录中新增baget.service 路径为: /usr/lib/systemd/system

[Unit]
Description=baget services
After=network.target
[Service]
Type=forking
ExecStart=//opt/baget/BaGet/start.sh
PrivateTmp=true
[Install]
WantedBy=multi-user.target                         

设置开机启动
systemctl enable baget

启动服务
systemctl start baget

参考

posted @ 2021-12-17 15:47  Hey,Coder!  阅读(93)  评论(0编辑  收藏  举报