Install dependencies

# pkg install cvs build-essential

Bootstrapping pkgsrc

Set Specify your preferred location, preferable /opt/PKGSRC You can specify a different path

# mkdir /usr/pkg && PKGSRC='/usr/pkg'; export PATH=$PKGSRC/bin:$PKGSRC/sbin:$PATH
# cd $PKGSRC; export CVS_RSH=ssh; cvs -d anoncvs@anoncvs.NetBSD.org:/cvsroot co pkgsrc

The authenticity of host 'anoncvs.netbsd.org (199.233.217.198)' can't be established.
RSA key fingerprint isSHA256:oeLj1lbu1HBb/Mc2ERoP11g8JDFnrHWvSvPTXOu9bXw.

# cd $PKGSRC/pkgsrc/bootstrap
# ./bootstrap && ./cleanup
# export PATH=$PKGSRC/bin:$PKGSRC/sbin:$PATH
 
Example install nano
# cd $PKGSRC/pkgsrc/*/nano
# bmake install clean

OR

# echo 'PKGSRC="/usr/pkg"; export PATH=$PKGSRC/bin:$PKGSRC/sbin:$PATH' >> $HOME/.profile
 
Example install nano
# cd $PKGSRC/pkgsrc/*/nano
# bmake install clean