Contents
FreeBSDとは
FreeBSD(フリービーエスディー)は、UNIXライクなオープンソースのOSソフトウェア。特にネットワークOSとしての稼動実績はLinux系を上回り、高い負荷にも安定したパフォーマンスを維持します。
FreeBSD(フリービーエスディー)は実用性を重視し堅牢で頑丈な設計を施されている点から、大手企業・サービスのFTP、WWW、電子メールサーバなどの運用に適しています。
今回は2026 年 3 月 10 日にリリースされたFreeBSD14.4をインストールし、サーバーの構築を行います。
インストール
1.インストールイメージのダウンロード
FreeBSD の配布サイト(https://download.freebsd.org/releases/amd64/amd64/ISO-IMAGES/14.4/) にアクセスし,
"FreeBSD-14.4-RELEASE-amd64-dvd1.iso"をダウンロードする
2.ブートディスクの作成
ダウンロードしたFreeBSD-14.4-RELEASE-amd64-dvd1.isoからブートディスクを作成する(DVDディスク)
USBメモリーに作成する場合はFreeBSD-14.4-RELEASE-amd64-memstick.imgをダウンロードしてWin32 Disk Imager等Image Writerを利用し、作成する
3.BIOS設定を変更し、作成したブートメディアから起動する
以降、インストールはFreeBSD-14.3と同様ですので割愛します。
初期設定
FreeBSDのインストールが終わり、これからサーバーの構築を始めますがコンソール画面では何かと作業がしにくいので、TeraTerm等を使用しWindowsから操作します。
OpenSSH サーバーはデフォルトでパスワード認証方式でのログインは可能となっています。
サービスが有効になっていればリモートログインすることができます。
sshd サービスの有効確認
|
1 2 |
# grep sshd /etc/rc.conf sshd_enable="YES" |
これでWindowsのTeraTermからSSH接続できます(TeraTermでの設定は他のOSの初期設定を参照してください)
1. バイナリーの更新
カーネルなどのバージョン情報の表示
|
1 2 |
# uname -srm FreeBSD 14.4-RELEASE amd64 |
利用可能なすべてのバイナリ更新(セキュリティアップデート)を取得
今回はアップデートがありませんでした
|
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 update1.freebsd.org... done. Fetching metadata signature for 14.4-RELEASE from update1.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.4-RELEASE-p0. |
更新またはアップグレードをインストール
|
1 2 3 |
# freebsd-update install No updates are available to install. Run 'freebsd-update [options] fetch' first. |
インストールしたイメージで起動するようにサーバーを再起動
|
1 |
# shutdown -r now |
更新後のバージョンを確認
|
1 2 |
# uname -srm FreeBSD 14.4-RELEASE amd64 |
|
1 2 3 4 |
# freebsd-version -kur 14.4-RELEASE 14.4-RELEASE 14.4-RELEASE |
2. Pkgng
2.1 パッケージシステム (pkgng) の初回実行設定
最新の状態にします。
|
1 |
# pkg update |
2.2 Pkgコマンド使用方法
1️⃣ アプリケーションの検索
例としてMysql8を探す場合
|
1 2 3 4 5 |
# pkg search mysql8 mysql80-client-8.0.44 Multithreaded SQL database (client) mysql80-server-8.0.44 Multithreaded SQL database (server) mysql84-client-8.4.7 Multithreaded SQL database (client) mysql84-server-8.4.7 Multithreaded SQL database (server) |
2️⃣ アプリケーションをインストール
例としてcurl をインストールする
|
1 |
# pkg install curl |
3️⃣ インストールされているパッケージに関する情報の取得
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# pkg info brotli-1.2.0,1 Generic-purpose lossless compression algorithm curl-8.17.0 Command line tool and library for transferring data with URLs gettext-runtime-0.26 GNU gettext runtime libraries and programs 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.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.4.1 Unicode string library pkg-2.5.1 Package manager vim-9.2.0078 Improved version of the vi editor (console flavor) xxd-9.2.0078 Hexdump and reverse hexdump utility from vim distribution zstd-1.5.7_1 Fast real-time compression algorithm |
先ほどインストールしたcurlの情報を取得するには
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# pkg info curl curl-8.17.0 Name : curl Version : 8.17.0 Installed on : Tue Mar 10 14:05:12 2026 JST Origin : ftp/curl Architecture : FreeBSD:14: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 --------------------------------------------------- |
4️⃣ アプリケーションの削除
|
1 |
# pkg delete [パッケージ名] |
5️⃣ アプリケーションの状態
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# pkg info brotli-1.2.0,1 Generic-purpose lossless compression algorithm curl-8.17.0 Command line tool and library for transferring data with URLs gettext-runtime-0.26 GNU gettext runtime libraries and programs 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.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.4.1 Unicode string library pkg-2.5.1 Package manager vim-9.2.0078 Improved version of the vi editor (console flavor) xxd-9.2.0078 Hexdump and reverse hexdump utility from vim distribution zstd-1.5.7_1 Fast real-time compression algorithm |
6️⃣ アプリケーションの更新状態を参照
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
# pkg version brotli-1.2.0,1 = curl-8.17.0 = gettext-runtime-0.26 = indexinfo-0.3.1_1 = libidn2-2.3.8 = libnghttp2-1.68.0 = libpsl-0.21.5_2 = libssh2-1.11.1,3 = libunistring-1.4.1 = pkg-2.5.1 = vim-9.2.0078 > xxd-9.2.0078 > zstd-1.5.7_1 = |
>: 現在インストールされているものより新しいバージョンがリリースされている場合
=: 現在インストールされているものと同等のバージョンがリリースされている場合
<: 現在インストールされているものより古いバージョンがリリースされている場合
7️⃣ Packagesの更新
|
1 |
# pkg upgrade [バッケージ名] |
全てのパッケージを更新する場合
|
1 |
# pkg upgrade |
3 Ports Collectionのインストール
FreeBSD14ではportsnapが削除されていますのでgitを用いて,ポーツ・コレクション(ports collection) をダウンロード,アップデート(更新)する.
1. gitをインストールする
portsからインストールする場合
|
1 2 |
# cd /usr/ports/devel/git # make install clean |
pkgでインストールする場合
|
1 |
# pkg install git |
2. Port Collectionのインストール
portsツリーのHEADブランチのコピーをチェックアウトする
すでにPort Collectionがある場合は削除しておく
|
1 |
# rm -Rf /usr/ports/* |
|
1 |
# git clone --depth 1 https://git.FreeBSD.org/ports.git /usr/ports |
/usr/portsを更新する
|
1 |
# git -C /usr/ports pull |
3. perl5 アップグレード
インストールできるperlのバージョン確認
|
1 2 3 4 5 |
# pkg search lang/perl lang/perl5-devel Practical Extraction and Report Language lang/perl5.38 Practical Extraction and Report Language lang/perl5.40 Practical Extraction and Report Language lang/perl5.42 Practical Extraction and Report Language |
今回は最新のperl5.42をインストールする
|
1 2 3 |
# cd /usr/ports/lang/perl5.42 # make NO_DIALOG=yes # make reinstall |
4. ports 用メンテナンスツール
まず「ports」の環境を整える
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
# cp /usr/share/examples/etc/make.conf /etc/make.conf # chmod 644 /etc/make.conf # vi /etc/make.conf X11を使用しない OPTIONS_UNSET+=X11 OPTIONS_UNSET+=GUI NO_X=true PHPで日本語を使用する OPTIONS_SET+=MBSTRING ※python rubyのversionを指定する場合 python3.11の系列をメインに使用する DEFAULT_VERSIONS+=python=3.11 python3=3.11 ruby3.2の系列をメインに使用する DEFAULT_VERSIONS+=ruby=3.2 |
「ports」をメンテナンスするための「ports」、「portupgrade」をインストールします。
|
1 2 3 4 5 6 7 |
# cd /usr/ports/ports-mgmt/portupgrade # make config オプションはデフォルト # make NO_DIALOG=yes # make reinstall |
5. INDEXの更新
|
1 2 3 |
# portsdb -Fu -F:INDEXファイル取得 -u:できたINDEXファイルを元にバイナリDBを更新 |
データベースの状態を参照するには
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
# portversion -v [Reading data from pkg(8) ... - 61 packages found - done] autoconf-2.72_1 = up-to-date with port autoconf-switch-20220527 = up-to-date with port automake-1.18.1 = up-to-date with port brotli-1.2.0,1 = up-to-date with port bsddialog-1.1 = up-to-date with port curl-8.17.0 = up-to-date with port db5-5.3.28_10 = up-to-date with port expat-2.7.4 = up-to-date with port gettext-runtime-0.26 = up-to-date with port gettext-tools-0.26 = up-to-date with port git-2.52.0 < needs updating (port has 2.53.0) 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 libffi-3.5.1 = up-to-date with port libiconv-1.18_1 = up-to-date with port libidn2-2.3.8 = up-to-date with port libnghttp2-1.68.0 = up-to-date with port libpsl-0.21.5_2 = up-to-date with port libssh2-1.11.1,3 = up-to-date with port libtextstyle-0.26 = up-to-date with port libunistring-1.4.1 < needs updating (port has 1.4.2) libunwind-20250904 = up-to-date with port libyaml-0.2.5 = up-to-date with port m4-1.4.21,1 = up-to-date with port mpdecimal-4.0.1 = up-to-date with port p5-Authen-SASL-2.1900 = up-to-date with port p5-Crypt-URandom-0.54 = up-to-date with port p5-Digest-HMAC-1.05 = up-to-date with port p5-Error-0.17030 = up-to-date with port p5-IO-Socket-SSL-2.095 < needs updating (port has 2.098) p5-Locale-gettext-1.07 = up-to-date with port p5-Locale-libintl-1.35 = up-to-date with port p5-MIME-Base32-1.303 = up-to-date with port p5-MIME-Base64-3.16 = up-to-date with port p5-Mozilla-CA-20250602 = up-to-date with port p5-Net-SSLeay-1.94 = up-to-date with port p5-Text-Unidecode-1.30 = up-to-date with port p5-URI-5.34 = up-to-date with port p5-Unicode-EastAsianWidth-12.0 = up-to-date with port pcre2-10.47_1 = up-to-date with port perl5-5.40.3_2 = up-to-date with port pkg-2.5.1 < needs updating (port has 2.6.2) pkgconf-2.4.3,1 = up-to-date with port portconfig-0.6.2_2 = up-to-date with port portupgrade-2.4.16_4,2 = up-to-date with port python311-3.11.15 = up-to-date with port readline-8.3.3 = up-to-date with port ruby-3.3.10,1 = up-to-date with port ruby33-bdb-0.6.6_9 = up-to-date with port ruby33-gems-4.0.6 = up-to-date with port rubygem-date-3.5.1 = up-to-date with port rubygem-erb-6.0.1 = up-to-date with port rubygem-psych-5.3.1 = up-to-date with port rubygem-rdoc-6.17.0 = up-to-date with port rubygem-stringio-3.2.0 = up-to-date with port rubygem-tsort-0.2.0 = up-to-date with port texinfo-7.2_4,1 = up-to-date with port vim-9.2.0078 = up-to-date with port xxd-9.2.0078 = up-to-date with port zstd-1.5.7_1 = up-to-date with port |
「=」マークがついていれば、最新版がインストールされている
「<」マークがついていれば、「ports」に新しい版が存在する
6. ports のアップグレード
上記で確認した結果、新しいバージョンが出ている「ports」を更新する
|
1 |
# portupgrade expat |

