pkgin, a NetBSD package manager

pkgin is aimed at being an apt / yum like tool for managing pkgsrc binary packages. It relies on pkg_summary(5) for installation, removal and upgrade of packages and associated dependencies, using a remote repository.

Install

Execute the following commands a root in order to install pkgin, for more information check install binary packages (NetBSD)

# PKG_PATH="http://cdn.NetBSD.org/pub/pkgsrc/packages/NetBSD/$(uname -p)/$(uname -r|cut -f '1 2' -d.)/All/"
# export PKG_PATH
# pkg_add pkgin

Initialize/Update repo definition

The following command allows you to initialize or update the database that contains the definition and information of the available packages.

# pkgin update

It is recommended to run the above command regularly to keep the operating system up to date.

Examples

List availables packages

# pkgin avail
0verkill-0.16nb1     0verkill is bloody 2D action deathmatch-like game in ASCII-ART
2048-cli-0.9.1       The game 2048 for your Unix terminal
2bwm-0.3             Fast floating WM written over the XCB library and derived from mcwm
2fa-1.1.0nb18        Command-line client for two-factor authentication
2vcard-0.6nb1        Convert an addressbook to the popular VCARD file format
3ddesktop-0.2.9nb13  3D Virtual Desktop Switcher
3proxy-0.8.11        Multi-protocol proxy
4stAttack-2.1.4nb20  Game in which you have to try to out-smart your opponent
6tunnel-0.13         Tunnelling for applications that don't speak IPv6
7kaa-2.15.4p1nb1     Seven Kingdoms: Ancient Adversaries
...

List installed packages

# pkgin list
pkgin list 
pkg_install-20210308 Package management and administration tools for pkgsrc
pkgin-20.12.1        Apt / yum like tool for managing pkgsrc binary packages
vim-8.2.2557         Vim editor (vi clone) without GUI
vim-share-8.2.2557   Data files for the vim editor (vi clone)

Search

With this command with search for all packages that contains the word nginx

# pkgin search nginx
nginx-1.19.6         Lightweight HTTP server and mail proxy server
nginx-1.18.0nb8      Lightweight HTTP server and mail proxy server
....

Search using regular expression

With this command with search for all packages that starts with apache word followed by – and 1 digit.

# pkgin search '^apache\-[[:digit:]]' 
apache-2.4.46nb2     Apache HTTP (Web) server, version 2.4

Install/update a package and its dependencies

The install subcommand allows to install/update packages.

# pkgin install nginx
calculating dependencies...done.

2 packages to install:
  nginx-1.19.6 pcre-8.44

0 to refresh, 0 to upgrade, 2 to install
944K to download, 4698K to install

proceed ? [Y/n]

It is also possible to install several packages at the same time by separating the packages by a blank space.

Uninstall a package.

Remove a package and its dependencies.

# pkgin remove curl   
5 packages to delete: 
  cmake-3.19.2 git-2.29.2 git-base-2.29.2 git-contrib-2.29.2 curl-7.74.0

Remove orphan dependencies

# pkgin autoremove

Show information about a package.

# pkgin pkg-descr nginx 
Information for https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/x86_64/9.0/All/nginx-1.19.6.tgz:
Description:
Nginx (pronounced engine-x) is a free, open-source, high-performance HTTP
server and reverse proxy, as well as an IMAP/POP3 proxy server. Igor Sysoev
started development of Nginx in 2002, with the first public release in 2004.
Nginx now hosts nearly 12.18% (22.2M) of active sites across all domains.
Nginx is known for its high performance, stability, rich feature set, simple
configuration, and low resource consumption.
Nginx is one of a handful of servers written to address the C10K problem.
Unlike traditional servers, Nginx doesn't rely on threads to handle requests.
Instead it uses a much more scalable event-driven (asynchronous) architecture.
This architecture uses small, but more importantly, predictable amounts of
memory under load.
Even if you don't expect to handle thousands of simultaneous requests, you can
still benefit from Nginx's high-performance and small memory footprint.
Nginx scales in all directions: from the smallest VPS all the way up to
clusters of servers.
Nginx powers several high-visibility sites, such as Netflix, Hulu, Pinterest,
CloudFlare, Airbnb, WordPress.com, GitHub, SoundCloud, Zynga, Eventbrite,
Zappos, Media Temple, Heroku, RightScale, Engine Yard and NetDNA.
Homepage:
https://nginx.org/

Update all packages

# pkgin full-upgrade

Clean the cache

# pkgin clean

Find package dependencies

Run the following commands to get all the dependencies of a package.

Direct dependencies

# pkgin show-deps curl     
direct dependencies for curl-7.74.0
        nghttp2>=1.40.0nb4
        libidn2>=2.0.0

Reverse dependencies

# pkgin show-rev-deps curl
local reverse dependency tree for curl
        git-2.29.2
        git-contrib-2.29.2
        git-base-2.29.2
        cmake-3.19.2

All dependencies

# pkgin show-full-deps curl
full dependency tree for curl-7.74.0
        xmlcatmgr>=2.0beta1
        libuuid>=2.18
        libffi>=3.3nb1
        libunistring>=0.9.4
        python38>=3.8.0
        libxml2>=2.9.10nb3
        nghttp2>=1.40.0nb4
        libidn2>=2.0.0

Find package requirements

With the following command we find all module/libraries which a package depends on.

# pkgin requires curl       
Shared libraries required by curl-7.74.0:
        /usr/pkg/lib/libunistring.so.2
        /usr/pkg/lib/libnghttp2.so.14
        /usr/pkg/lib/libidn2.so.0
        /usr/lib/libz.so.1
        /usr/lib/libwind.so.1
        /usr/lib/libutil.so.7
        /usr/lib/libssl.so.14
        /usr/lib/libsqlite3.so.1
        /usr/lib/libroken.so.20
        /usr/lib/libpthread.so.1
        /usr/lib/libkrb5.so.27
        /usr/lib/libintl.so.1
        /usr/lib/libhx509.so.6
        /usr/lib/libheimntlm.so.5
        /usr/lib/libheimbase.so.2
        /usr/lib/libgssapi.so.11
        /usr/lib/libcrypto.so.14
        /usr/lib/libcom_err.so.8
        /usr/lib/libc.so.12
        /usr/lib/libasn1.so.10
        /lib/libcrypt.so.1

Show shared libraries.

With the following command we find all libraries that a package shares with other packages.

# pkgin provides curl
Shared libraries provided by curl-7.74.0:
        /usr/pkg/lib/libcurl.so.4.7.0
        /usr/pkg/lib/libcurl.so.4
        /usr/pkg/lib/libcurl.so

Show all files contained in a package

# pkgin pkg-content nginx 
Information for https://cdn.netbsd.org/pub/pkgsrc/packages/NetBSD/x86_64/9.0/All/nginx-1.19.6.tgz:
Files:
/usr/pkg/man/man8/nginx.8
/usr/pkg/sbin/nginx
/usr/pkg/share/examples/nginx/conf/fastcgi.conf
/usr/pkg/share/examples/nginx/conf/fastcgi_params
/usr/pkg/share/examples/nginx/conf/koi-utf
/usr/pkg/share/examples/nginx/conf/koi-win
/usr/pkg/share/examples/nginx/conf/mime.types
/usr/pkg/share/examples/nginx/conf/nginx.conf
/usr/pkg/share/examples/nginx/conf/win-utf
/usr/pkg/share/examples/nginx/html/50x.html
/usr/pkg/share/examples/nginx/html/index.html
/usr/pkg/share/examples/rc.d/nginx

Show the category to which a package belongs

# pkgin spc nginx
www          - nginx-1.19.6
www          - nginx-1.18.0nb8

Help

  • man pkgin
  • pkgin -h

Related links

YouTube video

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.