In this short tutorial, let us see how to add pkg management tool and install packages on FreeBSD 10.
Check and Download pkg management tool
root@Freebsd10:~ # pkg -vv The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]: y Bootstrapping pkg from pkg+http://pkg.FreeBSD.org/freebsd:10:x86:32/latest, please wait... Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done Installing pkg-1.2.3... done If you are upgrading from the old package format, first run: # pkg2ng Version : 1.2.3 PACKAGESITE : PKG_DBDIR : /var/db/pkg PKG_CACHEDIR : /var/cache/pkg PORTSDIR : /usr/ports PUBKEY : HANDLE_RC_SCRIPTS : no ASSUME_ALWAYS_YES : no REPOS_DIR : [ /etc/pkg/, /usr/local/etc/pkg/repos/, ] PLIST_KEYWORDS_DIR : SYSLOG : yes AUTODEPS : yes ABI : freebsd:10:x86:32 DEVELOPER_MODE : no PORTAUDIT_SITE : http://portaudit.FreeBSD.org/auditfile.tbz VULNXML_SITE : http://www.vuxml.org/freebsd/vuln.xml.bz2 MIRROR_TYPE : SRV FETCH_RETRY : 3 PKG_PLUGINS_DIR : /usr/local/lib/pkg/ PKG_ENABLE_PLUGINS : yes PLUGINS : [ ] DEBUG_SCRIPTS : no PLUGINS_CONF_DIR : /usr/local/etc/pkg/ PERMISSIVE : no REPO_AUTOUPDATE : yes NAMESERVER : EVENT_PIPE : FETCH_TIMEOUT : 30 UNSET_TIMESTAMP : no SSH_RESTRICT_DIR : PKG_SSH_ARGS : PKG_ENV : { } DISABLE_MTREE : no DEBUG_LEVEL : 0 ALIAS : { } Repositories: FreeBSD: { url : "pkg+http://pkg.FreeBSD.org/freebsd:10:x86:32/latest", enabled : yes, mirror_type : "SRV", signature_type : "FINGERPRINTS", fingerprints : "/usr/share/keys/pkg" } root@Freebsd10:~ #
How to use it ?
root@Freebsd10:~ # pkg Usage: pkg [-v] [-d] [-l] [-N] [-j <jail name or id>|-c <chroot path>] [-C <configuration file>] [-R <repo config dir>] <command> [<args>] Global options supported: -d Increment debug level -j Execute pkg(8) inside a jail(8) -c Execute pkg(8) inside a chroot(8) -C Use the specified configuration file -R Directory to search for individual repository configurations -l List available commands and exit -v Display pkg(8) version -N Test if pkg(8) is activated and avoid auto-activation Commands supported: add Registers a package and installs it on the system annotate Add, modify or delete tag-value style annotations on packages audit Reports vulnerable packages autoremove Removes orphan packages backup Backs-up and restores the local package database check Checks for missing dependencies and database consistency clean Cleans old packages from the cache config Display the value of the configuration options convert Convert database from/to pkgng create Creates software package distributions delete Deletes packages from the database and the system fetch Fetches packages from a remote repository help Displays help information info Displays information about installed packages install Installs packages from remote package repositories lock Locks package against modifications or deletion plugins Manages plugins and displays information about plugins query Queries information about installed packages register Registers a package into the local database remove Deletes packages from the database and the system repo Creates a package repository catalogue rquery Queries information in repository catalogues search Performs a search of package repository catalogues set Modifies information about packages in the local database ssh ssh packages to be used via ssh shell Opens a debug shell shlib Displays which packages link against a specific shared library stats Displays package database statistics unlock Unlocks a package, allowing modification or deletion update Updates package repository catalogues updating Displays UPDATING information for a package upgrade Performs upgrades of packaged software distributions version Displays the versions of installed packages which Displays which package installed a specific file Commands provided by plugins: For more information on the different commands see 'pkg help <command>'. root@Freebsd10:~ #
Test the package nu to install bash
root@Freebsd10:~ # pkg install bash Updating repository catalogue The following 2 packages will be installed: Installing gettext: 0.18.3.1 Installing bash: 4.2.45 The installation will require 13 MB more space 3 MB to be downloaded Proceed with installing packages [y/N]: y gettext-0.18.3.1.txz 100% 2046KB 682.1KB/s 1.1MB/s 00:03 bash-4.2.45.txz 100% 848KB 848.2KB/s 848.2KB/s 00:01 Checking integrity... done [1/2] Installing gettext-0.18.3.1... done [2/2] Installing bash-4.2.45... done