BSD Software management (Installing/Removing/Finding Packages and Ports)
How to find packages and package information:
whereis gdm = finds where an exe is located in the file system
simple echo(1) statement to find where a port exists in the ports tree. For example:
# echo /usr/ports/*/*lsof*
/usr/ports/sysutils/lsof
Ports Collection’s built-in search mechanism. (need to be in the /usr/ports directory)
# cd /usr/ports
# make search name=lsof
pkg_info = utility that lists and describes the various packages installed
pkg_info -L foopackage-1.0.0 | less
pkg_info | grep -i foopackage
pkg_version -v = utility that summarizes the versions of all installed packages
pkg_add -r firefox = adds binary firefox from remote source
pkg_delete xchat/* = remove all packages whoses names start with xchat
How to use ports:
/user/ports/ = for sourcecode installs
make install clean
# cd /usr/ports/devel/subversion
# make install clean
Download a compressed snapshot of the Ports Collection into /var/db/portsnap.
# portsnap fetch
When running Portsnap for the first time, extract the snapshot into /usr/ports:
# portsnap extract
After the first use of Portsnap has been completed as shown above, /usr/ports can be updated with:
# portsnap update
portsnap fetch extract
portsnap fetch update
Now the installed applications can be compared to the versions in the ports collection.
# portmaster -L –index-only| egrep ‘(ew|ort) version|total install’
/usr/ports/UPDATING
get an updated copy of /usr/ports/updating:
pkg_updating -f ftp://ftp.freebsd.org/pub/FreeBSD/ports/packages/UPDATING
a utility for displaying UPDATING entries of software packages:
/usr/sbin/pkg_updating -d `/bin/date -v-1w +%Y%m%d`
Updating Ports or Packages
pkg_version -v (First, list outdated ports that have a newer version available in the Ports Collection with the pkg_version(1) command:)
check “/usr/ports/UPDATING”
pkgdb -F (Scan the list of installed ports, and fix all the inconsistencies it reports. It is a good idea to do this regularly, before every upgrade.)
portupgrade –use-packages -av
portmaster -a (designed make use of the tools found in the “base” system (it does not depend upon other ports) and uses the information in /var/db/pkg/)
portmaster -Pa
To use packages instead of ports for installation, provide -P or –use-packages flag.
With this option portupgrade searches the local directories listed in PKG_PATH, or fetches packages from remote site if it is not found locally. If packages can not be found locally or fetched remotely, portupgrade will use ports. To avoid using ports, specify -PP.
replace the installed port with a port from a different origin
portmaster -o new_port_dir old_port_dir
portmaster -o /usr/ports/graphics/freeglut /usr/ports/graphics/libglut
rebuild the port, and all ports that depend on it
portmaster -r freeglut
portupgrade -a = upgrade all installed ports to the latest version
pkgdb -F = Scan installed ports and fix all the inconsistencies it reports. It is a good idea to do this regularly, before every upgrade
make install clean
cd /usr/ports/ports-mgmt/portupgrade
# make install clean
Portmaster = is another utility for upgrading installed ports. Portmaster was designed make use of the tools found in the “base” system (it does not depend upon other ports
portmaster -L = list all the installed ports by category, and search for updates
portmaster -a = All the installed ports can be upgraded using this simple command
make install clean
# cd /usr/ports/ports-mgmt/portmaster
# make install clean
Clean up after compiling and installing software
portsclean -C
portsclean -D
portsclean -DD
Delete ports or packages
Ports are being removed exactly the same as the packages (discussed in the Packages section), using the pkg_delete(1) command:
# pkg_delete lsof-4.57
pkg_delete package_name
pkg_deinstall -f package_name
install, upgrade and act on all those packages required by the given packages as well
portupgrade -R package_name
Extra info:
pkg_version: corrupted record (pkgdep line without argument), ignoring
portmaster –check-depends
portmaster -Da
textproc/p5-XML-SAX-Expat
textproc/p5-XML-SAX-Writer
—
contains system-wide settings that will apply to every build using make
/etc/make.conf
—
i think all installed packages, or maybe all packages, i need to check this
/var/db/pkg
Sources:
http://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/index.html
http://www.wonkity.com/~wblock/docs/html/portupgrade.html