 |
|
| |
| Introduction
| |
Almost everything you add to your VPS — web server, database, mail tools, language interpreters
— arrives through a package manager. Each operating system has its own: FreeBSD 15 uses
pkg (backed by the Ports Collection for the rare case where a package isn't enough), and
Rocky Linux 10 uses dnf (drawing on a small set of repositories). This page covers both,
plus how to build software from source when you must.
Jump to FreeBSD Packages and Ports or
Rocky Linux: dnf and Repositories.
| |
| FreeBSD: pkg Basics
| |
On FreeBSD, pkg installs pre-built binary packages. pkg search is often the fastest way
to find the exact package name; a typical first encounter follows the same short arc — search, look
before you leap, install, confirm:
$ pkg search nginx # find the exact package name
$ pkg info -d nginx # what would it pull in as dependencies?
# pkg install nginx # install it (and its dependencies)
$ pkg info nginx # confirm the installed version
$ pkg info -l nginx | grep etc # where did it put its config files?
Keeping packages current is a two-step routine you will run regularly (the
Securing Your VPS page folds it
into a maintenance habit):
# pkg update # refresh the catalog of what's available
# pkg upgrade # install newer versions of what you have
# pkg autoremove # drop orphaned dependencies nothing needs anymore
# pkg clean -a # reclaim disk space from the download cache
pkg keeps a log of everything it does in /var/log/pkg.log. If an upgrade leaves a
package's config behind as *.pkgsave (because you had edited the original), pkg tells you
so; merge your changes into the new file at your convenience.
| |
| FreeBSD: The Ports Collection
| |
The Ports Collection is the source from which most pkg packages are themselves built — a
tree of small Makefiles (one per piece of software) that know how to download, configure, compile, and
install it. Almost everyone should use pkg rather than building from ports: it is faster (no
compilation) and the packages are built and tested centrally. Two situations where ports still help: you
need a non-default build-time option, or you want a version newer than the package repository currently
provides.
As of FreeBSD 15 the Ports Collection is distributed only via Git (the older portsnap tool
has been retired):
# pkg install git
# git clone https://git.FreeBSD.org/ports.git /usr/ports
# ...or track a specific quarterly branch (security fixes, stable versions):
# git clone --branch 2026Q2 https://git.FreeBSD.org/ports.git /usr/ports
Build a port from inside its directory. make config opens a checklist of optional features (if
any); make install clean compiles, installs, and removes the temporary build files:
# cd /usr/ports/mail/roundcube
# make config # choose build-time options, if any (skip for defaults)
# make install clean
|
NOTE: Mixing source-built ports and binary pkg packages on the same system
can lead to version mismatches, since the two are updated on different schedules. The simplest,
most reliable policy for a typical VPS is to use pkg for everything and reach for ports
only for the one package that needs a non-default option.
|
| |
| Rocky Linux: dnf Basics
| |
On Rocky Linux, dnf installs RPM packages. The same search-then-install arc applies:
$ dnf search nginx # find the exact package name
$ dnf info nginx # version, repository, and summary
$ dnf repoquery --requires nginx # what would it pull in as dependencies?
# dnf install nginx # install it (and its dependencies)
$ rpm -ql nginx | grep /etc # where did it put its config files?
Keeping current:
# dnf upgrade # install newer versions of what you have
# dnf autoremove # drop orphaned dependencies nothing needs anymore
# dnf clean all # reclaim disk space from the metadata/download cache
Every dnf transaction is recorded: dnf history lists them, dnf history info <id>
shows exactly what one changed, and dnf history undo <id> rolls one back — invaluable
for answering "what changed?" after an upgrade.
| |
| Rocky Linux: Repositories
| |
A fresh Rocky system installs from a few repositories, and you will add one or two more for software
this documentation uses. List the enabled ones with dnf repolist.
BaseOS — the core operating system: kernel, system libraries, core utilities.
AppStream — applications and runtimes layered on top: Apache, PHP, MariaDB,
language interpreters.
CRB (CodeReady Builder) — additional libraries and development headers; disabled
by default and required by a handful of EPEL packages.
EPEL (Extra Packages for Enterprise Linux) — a large, community-maintained
repository. Several tools in this documentation live here:
web-stats programs,
SpamAssassin,
ClamAV,
fail2ban, Certbot, and
Roundcube among them.
Because so much depends on EPEL, enable it (and CRB) early:
# dnf install epel-release
# dnf config-manager --set-enabled crb
# dnf upgrade
Add third-party repositories deliberately and from sources you trust: each one is software allowed to
install onto your VPS as root.
| |
| Building from Source
| |
When no package exists, you can compile an upstream tarball the traditional way. Install the compiler
toolchain and use the familiar three-step dance, keeping hand-built software under /usr/local so
it never collides with packaged files:
# FreeBSD: pkg install gcc (clang is already in the base system)
# Rocky Linux: dnf group install "Development Tools"
$ ./configure --prefix=/usr/local
$ make
# make install
On Rocky Linux, the closest equivalent to a "ports" build is rebuilding a source RPM — take the
distribution's own .spec recipe, optionally tweak it, and produce your own binary RPM with
rpm-build and rpmdevtools. See the
Perl page's note on XS modules for
a common reason you may need a compiler even when you weren't planning to build anything by hand.
| |
| Documentation
| |
The pkg(8) and ports(7) manual pages on FreeBSD, and dnf(8) on Rocky Linux,
document every option. Fuller guides:
|
Toll Free 1-866-GSP-4400 • 1-301-464-9363 • service@gsp.com
Copyright © 1994-2026 GSP Services, Inc.
|