After installing FreeBSD, we will start building the server, but it is difficult to work on the console screen, so we will change the SSH connection settings for now in order to operate the server from Windows using TeraTerm or other software.
The OpenSSH server allows password authentication login by default.
If the service is enabled, you can log in remotely.
Confirm validity of sshd service
1 2 |
# grep sshd /etc/rc.conf sshd_enable="YES" |
Now you can connect via SSH from TeraTerm on Windows (see the default settings for other operating systems for settings in TeraTerm).
Contents
1. Binary Update
Display of kernel and other version information
1 2 |
# uname -srm FreeBSD 14.3-RELEASE amd64 |
Get all available binary updates (security updates)
There was no update this time
1 2 3 4 5 6 7 8 9 10 |
# freebsd-update fetch Looking up update.FreeBSD.org mirrors... 3 mirrors found. Fetching public key from update2.freebsd.org... done. Fetching metadata signature for 14.3-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 14.3-RELEASE-p0. |
Install updates or upgrades
1 2 3 |
# freebsd-update install No updates are available to install. Run 'freebsd-update [options] fetch' first. |
Restart the server to boot with the installed image
1 |
# shutdown -r now |
Check for updated version
1 2 |
# uname -srm FreeBSD 14.3-RELEASE amd64 |
1 2 3 4 |
# freebsd-version -kur 14.3-RELEASE 14.3-RELEASE 14.3-RELEASE |
2. Pkgng
2.1 Package system (pkgng) first run configuration
Bring up to date.
1 2 3 4 5 6 7 8 9 10 |
# pkg update The package management tool is not yet installed on your system. Do you want to fetch and install it now? [y/N]: y Bootstrapping pkg from pkg+https://pkg.FreeBSD.org/FreeBSD:14:amd64/quarterly, please wait… Verifying signature with trusted certificate pkg.freebsd.org.2013102301… done Installing pkg-2.1.2… Extracting pkg-2.1.2: 100% Updating FreeBSD repository catalogue… -------------------------------------- |
2.2 Pkg command usage
1️⃣ Application Search
For example, if you are looking for Mysql8
1 2 3 4 5 6 |
# pkg search mysql8 mysql-connector-odbc-unixodbc-mysql80-8.0.32 ODBC driver for MySQL80 / unixodbc mysql80-client-8.0.41 Multithreaded SQL database (client) mysql80-server-8.0.41 Multithreaded SQL database (server) mysql84-client-8.4.3_1 Multithreaded SQL database (client) mysql84-server-8.4.3_1 Multithreaded SQL database (server) |
2️⃣ Install Application
Install curl as an example
1 |
# pkg install curl |
3️⃣ Obtaining information about installed packages
1 2 3 4 5 6 7 8 9 10 11 12 |
# pkg info brotli-1.1.0,1 Generic-purpose lossless compression algorithm curl-8.14.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 liblz4-1.10.0,1 LZ4 compression library, lossless and very fast libnghttp2-1.65.0 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.3 Unicode string library pkg-2.1.2 Package manager zstd-1.5.7 Fast real-time compression algorithm |
To retrieve information about the curl you just installed
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# pkg info curl curl-8.14.0 Name : curl Version : 8.14.0 Installed on : Fri Jun 13 18:37:15 2025 JST Origin : ftp/curl Architecture : FreeBSD:14:amd64 Prefix : /usr/local Categories : www net ftp Licenses : MIT Maintainer : sunpoet@FreeBSD.org WWW : https://curl.se/ Comment : Command line tool and library for transferring data with URLs --------------------------------------------------- |
4️⃣Deleting Applications
1 |
# pkg delete [Package Name] |
5️⃣ Application Status
1 2 3 4 5 6 7 8 9 10 11 12 |
# pkg info brotli-1.1.0,1 Generic-purpose lossless compression algorithm curl-8.14.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 liblz4-1.10.0,1 LZ4 compression library, lossless and very fast libnghttp2-1.65.0 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.3 Unicode string library pkg-2.1.2 Package manager zstd-1.5.7 Fast real-time compression algorithm |
6️⃣ See application update status
1 2 3 4 5 6 7 8 9 10 11 12 |
# pkg version brotli-1.1.0,1 = curl-8.14.0 > indexinfo-0.3.1_1 = libidn2-2.3.8 = liblz4-1.10.0,1 = libnghttp2-1.65.0 = libpsl-0.21.5_2 = libssh2-1.11.1,3 = libunistring-1.3 = pkg-2.1.2 = zstd-1.5.7 = |
>: If a newer version is released than the one currently installed
=: If a version equivalent to the one currently installed has been released
<: If an older version is released than the one currently installed
7️⃣ Update Packages
1 |
# pkg upgrade [Package Name] |
To update all packages
1 |
# pkg upgrade |
3 Installing the Ports Collection
Since portsnap has been removed in FreeBSD14, use git to download and update the ports collection.
1️⃣ Install git
When installing from ports
1 2 |
# cd /usr/ports/devel/git # make install clean |
When installing with pkg
1 |
# pkg install git |
2️⃣Port Collection Installation
Check out a copy of the HEAD branch of the ports tree
If there is already a Port Collection, delete it.
1 |
# rm -Rf /usr/ports |
1 |
# git clone --depth 1 https://git.FreeBSD.org/ports.git /usr/ports |
Update /usr/ports
1 |
# git -C /usr/ports pull |
3️⃣ perl5 upgrade
You will need “perl5 40” to upgrade.
Copy and edit the “make” configuration file.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# cp /usr/share/examples/etc/make.conf /etc/make.conf # chmod 644 /etc/make.conf # vi /etc/make.conf If X11 is not used, add the following OPTIONS_UNSET+=X11 OPTIONS_UNSET+=GUI NO_X=true Install PHP and add the following if you want to use Japanese OPTIONS_SET+=MBSTRING If you mainly use the python3.11 series, write the following DEFAULT_VERSIONS+=python=3.11 python3=3.11 If you mainly use the ruby3.2 series, write the following DEFAULT_VERSIONS+=ruby=3.2 When installing autoconf, “perl5 5.40” is required. DEFAULT_VERSIONS+=perl5=5.40 |
Uninstall perl5.36
1 |
# pkg remove -y perl5 |
1 2 3 |
# cd /usr/ports/lang/perl5.40 # make NO_DIALOG=yes # make reinstall |
git has been removed and should be re-installed.
1 |
# pkg install git |
4️⃣ Maintenance tools for ports
Install “ports” and ‘portupgrade’ to maintain “ports”.
1 2 3 4 5 6 7 |
# cd /usr/ports/ports-mgmt/portupgrade # make config Options are defaults # make NO_DIALOG=yes # make reinstall |
5️⃣ Updating INDEX
1 2 3 |
# portsdb -Fu -F:IINDEX file acquisition -u:Update binary DB based on the resulting INDEX file |
To see the status of the database
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# portversion -v [Reading data from pkg(8) ... - 68 packages found - done] autoconf-2.72 = up-to-date with port autoconf-switch-20220527 = up-to-date with port automake-1.17 = up-to-date with port brotli-1.1.0,1 = up-to-date with port bsddialog-1.0.4 = up-to-date with port curl-8.14.0 = up-to-date with port db5-5.3.28_9 = up-to-date with port expat-2.7.0 < needs updating (port has 2.7.1) gettext-runtime-0.23.1 = up-to-date with port gettext-tools-0.23.1_1 = up-to-date with port git-2.49.0 = up-to-date with port gmake-4.4.1 = up-to-date with port help2man-1.49.3_1 = up-to-date with port indexinfo-0.3.1_1 = up-to-date with port --------------------------------------------------- |
If there is an “=” mark, the latest version is installed.
If there is a “<” mark, there is a newer version in “ports”.
6️⃣ Upgrading ports
Update “ports” with newer versions as a result of the above checks.
1 |
# portupgrade expat |