Setup a private NuGet repository

Setup a private NuGet repository have multi-way. In this post we see BaGet and how can start it.

What is BaGet?

According to

BaGet (pronounced "baguette") is a lightweight NuGet and symbol server. It is open source, cross-platform, and cloud ready!

Setup BaGet

Step one: Getting VPS and Installing Docker

We need a VPS for installing and using BaGet. After getting VPS it's time to install docker. I recommend you for installing to check docker documentation. Now we can start Installing BaGet

Step two: Installing BaGet on docker

We Create a file named baget.env to store BaGet's configurations:


Database__ConnectionString=Data Source=/var/baget/baget.db

Important: You must change ApiKey. Now it's time to download BaGet form docker hub :

docker pull loicsharma/baget

with this command get the latest version of BaGet.

To start BaGet docker container :

docker run --rm --name nuget-server -p 8080:80 --env-file baget.env -v "$(pwd)/baget-data:/var/baget" loicsharma/baget

now NuGet server run and we can open it 'IP or domain pointed to vps:8080` to see BaGet home page.

Config nginx (Optional)

You can make a domain for it every time enter the domain.

Install Nginx this link to help you.

After installing add file to /etc/nginx/conf.d/ like

server {
    server_name; # your domain name you must change it

    #charset koi8-r;
    #access_log  /var/log/nginx/host.access.log  main;

    client_max_body_size 50M;

    location / {
        proxy_set_header Host $http_host;
        proxy_set_header X-Forwarded-Host $http_host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;

    #error_page  404              /404.html;

    # redirect server error pages to the static page /50x.html
    error_page   500 502 503 504  /50x.html;
    location = /50x.html {
        root   /usr/share/nginx/html;


Publishing package

Publish your first package with:

dotnet nuget push -s -k NUGET-SERVER-API-KEY package.1.0.0.nupkg