Using the YUM versionlock plug-in to control package versions

When you manage multiple Linux servers, you generally try and keep them all at the same patch level, otherwise you find can find your self dealing with problems unique to one or two servers because they have newer or order software than the others.

If your distribution of choice uses YUM, there is a simple to use plug-in that you will find useful, versionlock.

Versionlock allows you specify what version of a package should be installed.   You can find out more about it in the yum wiki.

Installing it is as simple as

yum install yum-plugin-versionlock

The next step is to use the versionlock plug-in to create its file of package versions.

yum versionlock \*

Now, if you try to install updates they will be rejected.  So how do you update?  Update the package version in the version list file, /etc/yum/pluginconf.d/versionlock.list, an then run yum upgrade.



FreeBSD package management

(This information is now available in our wiki in table format.)

The following is a short of cheat sheet I’ve put together for FreeBSD management.  All this information is available in the FreeBSD manual, but I prefer the “to the point” format of a cheat sheet.

Note that along with the individual package management commands, the sysinstall(8) utility can be used to install, delete, and list available and installed packages on a running system.

Packages page in the Freebsd manual:

The sysinstall utility can be invoked on a running system to install, delete, and list available and installed packages.

Finding a packages:



In FreeBSD (both make use of the ports system to find packages, dont’t feel you have to install the port):

whereis command

# whereis lsof
lsof: /usr/ports/sysutils/lsof

make command

# cd /usr/ports
# make search name=lsof
Port:   lsof-4.56.4
Path:   /usr/ports/sysutils/lsof
Info:   Lists information about open files (similar to fstat(1))
Index:  sysutils

Port gives you the package/port name.
Path tell’s you where to find the package/port.

The  example, the lsof package can be found in:

Package management

Adding a packages from a local file

# pkg_add <package-file>

Adding a package from a remote server

# pkg_add -r <package-file>

Two environment variables affect where pkg_add will pull it’s packages from
when the -r option is used.

$PACKAGEROOT specifies an alternate server for pkg_add to fetch from.
Example: “”

$PACKAGESITE specifies an alternate server with a full path for pkg_add to fetch from.
Thus it should be a complete URL to the remote package file(s).

Listing packages

pkg_info <options> <file|package name>
When run with no options, lists installed packages

– pkg_version:  Compares version of installed package to the version in the ports directory.

Removing  packages

pkg_delete <package-name>
Example:  pkg_delete xchat-1.7.1