cheat sheets Freebsd/ports update/upgrade

As i m I'm preparing to switch from Debian to freebsd FreeBSD I make a cheat sheet for freebsd FreeBSD management. Keep in mind that I'm a newcomer so maybe there are mistakes or misunderstoodandings.

Code:
FREEBSD-UPDATE
# freebsd-update fetch
FreeBSD security/errata patches are downloaded.
Some users may wish to tweak the default configuration in /etc/freebsd-update.conf, allowing better control of the process.
# Components of the base system which should be kept updated. Components are the same as those available during installation. The default is src world (non-kernel binaries) kernel.
Components
# Paths which start with anything matching an entry in an IgnorePaths statement will be ignored.
IgnorePaths
# Paths which start with anything matching an entry in an UpdateIfUnmodified statement will only be updated if the contents of the file have not been modified by the user.
UpdateIfUnmodified
# When upgrading to a new FreeBSD release, files which match MergeChanges will have any local changes merged into the version from the new release.
MergeChanges
# (yes/no) When this option is set to yes, freebsd-update will attempt to update EVERY file which belongs to the Components list.
StrictComponents
# freebsd-update install
Binary security/errata updates applied/installed to the FreeBSD. The default is to update the source code, the entire base system, and the kernel.
# freebsd-update rollback
If anything goes wrong, freebsd-update has the ability to roll back the last set of changes.
# freebsd-update -r 9.1-RELEASE upgraded
Major and minor version upgrades.
# shutdown -r now
The kernel and kernel modules will be patched first. At this point, the machine must be rebooted.
# freebsd-update install
Restart freebsd-update, freebsd-update will NOT start from the beginning, but will remove all old shared libraries and object files.
# portmaster -fa
Upgrades from FreeBSD 9.0 to 9.1 (eg), are called minor version upgrades. Generally, installed applications will continue to work without problems after minor version upgrades.
Major version upgrades (eg from FreeBSD 8.X to 9.X) upgrades remove old object files and libraries which will break most third party applications.
It is recommended that all installed ports either be removed and reinstalled (preferred) or upgraded after a major version upgrade.
# freebsd-update install
Finish the ports upgrade process with a final call to freebsd-update in order to tie up all the loose ends in the upgrade process.
# freebsd-update IDS >> outfile.ids
The system will now be inspected along with the sha256 hash values for both the known value in the release and the current installation. Some files have natural modifications.

PORTSNAP/SVN
# portsnap fetch
Download a compressed snapshot of the Ports Collection into /var/db/portsnap.
# portsnap extract
When running Portsnap for the first time, extract the snapshot into /usr/ports.
# portsnap update
After the first use of Portsnap has been completed, /usr/ports is updated.
# pkg install subversion
If more control over the ports tree is needed (for example, for maintaining local changes), Subversion can be used to obtain the Ports Collection. Install subversion using pkgng.
# cd /usr/ports/devel/subversion
# make
# make install
# make clean
Install subversion using ports.
# svn checkout svn+ssh://svn.FreeBSD.org/ports/head /usr/ports
Initial Subversion checkout.
# svn update /usr/ports
To update /usr/ports after the initial Subversion checkout.

PORTS
# whereis packagename
To find out which category a port is in.
# echo /usr/ports/*/*packagename*
To find out which category a port is in (will return any matched files downloaded into the /usr/ports/distfiles directory).
# cd /usr/ports
# make search name=packagename
To find out a port.
# cd /usr/ports
# make quicksearch name=packagename
To find out a port (receive less information).
# cd /usr/ports/ports-mgmt/pkg
# make
# make config-recursive
# make install/deinstall/reinstall
# make clean
To install/deinstall/reinstall the pkgng port (deinstall do not remove dependencies).
# make build-depends-list && make run-depends-list && make all-depends-list
# make missing
Build and show the dependencies.

PORTMASTER
# cd /usr/ports/ports-mgmt/portmaster
# make
# make install
# make clean
Use portmaster to manage ports. You can also use pkgng.
# portmaster -l
List all installed ports by category.
# portmaster -L
List all installed ports by category, and search for updates.
# portmaster packagename
By default portmaster updates the port you specify whether there is a new version for it or not.
You will be presented with an OPTIONS dialog if you have never built the port before, or if the OPTIONS have changed.
You can force dialogs for all ports by using the --force-config option.
# portmaster -a
All the installed ports are rebuilt/reinstalled.
# portmaster -a -x packagename1 -x packagename2
All the installed ports are rebuilt/reinstalled (packagename1 and packagename2 are excluded).
# portmaster -a --update-if-newer
Do not rebuild/reinstall if the installed version is up to date (only for multiple ports listed on the command line).
# portmaster -P|--packages packagename
Use packages, but build port if not available.
# portmaster -PP|--packages-only packagename
Use packages ONLY.
# portmaster --packages-if-newer
Use package if newer than installed even if the package is not the latest according to the ports tree.
# portmaster -e packagename
Deinstall a port.
# portmaster -es packagename
Deinstall a port and its dependencies.
# portmaster -D
No cleaning of distfiles.
# portmaster -d
Always cleaning distfiles.
# portmaster -F
Fetch distfiles only.
# portmaster -f
Always rebuild ports (rebuild all dependencies).
# portmaster --check-depends
Cross-check and update	dependency information for all ports. Correct dependencies information in database.
# portmaster -s
Clean out stale ports that used to be depended on. Remove automatically installed packets that are no longer needed.
# portmaster --check-port-dbdir
Check for stale entries in /var/db/ports.
# portmaster [--index-only] --clean-packages
Delete stale/obsolete packages. The --index-only option is required if no ports tree is available.
# portmaster --show-work
Show what dependent ports are, and are not installed (missing dependencies).
# portmaster -t packagename
Recurse dependency (mark the package as automatic installed).
# portmaster [-t] --clean-distfiles
With the -t option a distfile is considered valid if it is in use by any port, not just those installed.

PKGNG
# /usr/sbin/pkgng
FreeBSD 9.1 and later includes a "bootstrap" utility for pkgng. The bootstrap utility will download and install pkgng.
# pkg install packagename
FreeBSD users will install binary packages using pkgng.
# pkg delete packagename
FreeBSD users will remove packages using pkgng.
# pkg update
Updates the local copy of a repository catalogue from the remote package repository.
# pkg updating
Scans the installed ports and show all UPDATING entries that affect one of the installed ports.
# pkg upgrade
Packages can be upgraded to newer versions with pkgng.
# pkg autoremove
Unneeded packages that were installed as dependencies can be automatically detected and removed.
# pkg set -A [01]
Set automatic flag to the package: 0 is not automatic, 1 is automatic.
# pkg set -o category/oldport:category/newport
Update package origins.
# pkg install -Rf category/newport
When changing package origins, in most cases it is important to reinstall packages that are dependent on the package that has had the origin changed.
# pkg backup -d /path/to/filename.db
Manually back up the package database contents.
# pkg backup -r /path/to/filename.db
Restore the contents of a previous package database backup.
# pkg clean
By default, pkgng stores binary packages in a cache directory, when upgrading packages with pkg upgrade, old versions of the upgraded packages are not automatically removed.
# pkg audit -F
Audit the software installed on the system.
 
Back
Top