業務用エアコン関連の技術情報、エラーコード、環境問題対策に関する別サイト「エアコンの安全な修理・適切なフロン回収」

FreeBSD15.1 : Initial Setup (Updating Binaries, Packages and Ports Collection)

Now that the FreeBSD installation is complete, I’m ready to start setting up the server. However, since it’s difficult to perform various tasks on the console screen, I’ll use a tool like Tabby Terminal to connect remotely from Windows.
By default, the OpenSSH server allows login via password authentication.
As long as the service is enabled, you can log in remotely.
Confirm validity of sshd service

# grep sshd /etc/rc.conf
sshd_enable="YES"

You can now connect via SSH from Tabby Terminal on Windows.

1. Binary Update

Displaying version information such as kernel version

# uname -srm
FreeBSD 15.1-RELEASE amd64

Get all available binary updates (security updates)
There were no updates this time.

# freebsd-update fetch

Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching public key from update2.freebsd.org... done.
Fetching metadata signature for 15.1-RELEASE from update2.freebsd.org... done.
Fetching metadata index... done.
Fetching 1 metadata files... done.
Inspecting system... done.
Preparing to download files... done.

No updates needed to update system to 15.1-RELEASE-p0.

When installing an update or upgrade

# freebsd-update install

Restart the server to boot from the installed image.

# shutdown -r now

Check the updated version

# uname -srm
# freebsd-version -kur
15.1-RELEASE
15.1-RELEASE
15.1-RELEASE

2. Pkgng

2.1 Initial Configuration for Package System (pkgng)

Update to the latest version.

# pkg update

2.2 How to Use the Pkg Command

① Application Search

For example, when searching for MySQL 8

# pkg search mysql8
mysql80-client-8.0.46          Multithreaded SQL database (client)
mysql80-server-8.0.46          Multithreaded SQL database (server)
mysql84-client-8.4.9           Multithreaded SQL database (client)
mysql84-server-8.4.9           Multithreaded SQL database (server)

➁ Install the application

For example, installing curl

# pkg install curl

➂ Retrieving information about installed packages

# pkg info
brotli-1.2.0,1                 Generic-purpose lossless compression algorithm
curl-8.20.0                    Command line tool and library for transferring data with URLs
indexinfo-0.3.1_1              Utility to regenerate the GNU info page index
libidn2-2.3.8                  Implementation of IDNA2008 internationalized domain names
libnghttp2-1.68.1              HTTP/2 C Library
libpsl-0.21.5_2                C library to handle the Public Suffix List
libssh2-1.11.1,3               Library implementing the SSH2 protocol
libunistring-1.4.2             Unicode string library
pkg-2.6.2_1                    Package manager
zstd-1.5.7_1                   Fast real-time compression algorithm

④ To retrieve information about the curl you just installed,

# pkg info curl
curl-8.20.0
Name           : curl
Version        : 8.20.0
Installed on   : Tue Jun 16 22:49:33 2026 JST
Origin         : ftp/curl
Architecture   : FreeBSD:15:amd64
Prefix         : /usr/local
Categories     : ftp net www
Licenses       : MIT
Maintainer     : sunpoet@FreeBSD.org
WWW            : https://curl.se/
Comment        : Command line tool and library for transferring data with URLs
------------------------------------------------------------------------------
------------------------------------------------------------------------------
It supports DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP,
LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, Telnet and
TFTP. curl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP
form based upload, proxies, HTTP/2, cookies, user+password authentication
(Basic, Plain, Digest, CRAM-MD5, NTLM, Negotiate and Kerberos), file transfer
resume, proxy tunneling and more.

⑤ Application Removal

# pkg delete [Package Name]

⑥  Application Status

# pkg version
brotli-1.2.0,1                     =
curl-8.20.0                        =
indexinfo-0.3.1_1                  =
libidn2-2.3.8                      =
libnghttp2-1.68.1                  =
libpsl-0.21.5_2                    =
libssh2-1.11.1,3                   =
libunistring-1.4.2                 =
pkg-2.6.2_1                        =
zstd-1.5.7_1                       =

>: If a newer version than the one currently installed has been released
=: If a version equivalent to the one currently installed has been released
<: If an older version than the one currently installed is released

⑦ Updating Packages

# pkg upgrade [Package Name]

To update all packages

# pkg upgrade

3  Installing the Ports Collection

① Install Git

When installing from ports

# cd /usr/ports/devel/git
# make install clean

When installing via pkg

# pkg install git

➁ Installing Port Collection
Check out a copy of the HEAD branch of the ports tree
If you already have a Port Collection, delete it beforehand

# rm -Rf /usr/ports
# git clone --depth 1 https://git.FreeBSD.org/ports.git /usr/ports

Update /usr/ports

# git -C /usr/ports pull

➂ Perl 5 Upgrade

You will need "perl5 42", so please upgrade.
Copy and edit the configuration file for "make".

# cp /usr/share/examples/etc/make.conf /etc/make.conf
# chmod 644 /etc/make.conf

# vi  /etc/make.conf
If you are not using X11, add the following:
OPTIONS_UNSET+=X11
OPTIONS_UNSET+=GUI
NO_X=true

When installing PHP and using Japanese, add the following:
OPTIONS_SET+=MBSTRING

When primarily using the Python 3.11 series, write the following:
DEFAULT_VERSIONS+=python=3.11 python3=3.11

When primarily using the Ruby 3.2 series, write the following:
DEFAULT_VERSIONS+=ruby=3.2

When installing autoconf, "perl5 5.40" is required, so please note this in advance.
DEFAULT_VERSIONS+=perl5=5.42
# cd /usr/ports/lang/perl5.42
# make NO_DIALOG=yes
# make reinstall

④ Maintenance Tools for Ports

Install the "ports" and "portupgrade" tools for maintaining ports.

# pkg install ports-mgmt/portupgrade

⑤ Before starting the upgrade, read the /usr/ports/UPDATING file to check for important changes or items requiring manual intervention.

# less /usr/ports/UPDATING

6 .Bulk Upgrade Ports

# portupgrade -aR

To check upgrades individually, add the -i option.

# portupgrade -aRi