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.
Enter the following command on the FreeBSD console screen
# vi /etc/ssh/sshd_config
Line 61.
#PasswordAuthentication no → PasswordAuthentication yes Make the changes and reflect the settings with the following command
# service sshd restart
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 13.3-RELEASE amd64 |
Get all available binary updates (security updates)
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 |
# freebsd-update fetch Looking up update.FreeBSD.org mirrors... 2 mirrors found. Fetching public key from update2.freebsd.org... done. Fetching metadata signature for 13.2-RELEASE from update2.freebsd.org... done. Fetching metadata index... done. Fetching 2 metadata files... done. Inspecting system... done. Preparing to download files... done. Fetching 22 patches.....10....20. done. Applying patches... done. The following files will be updated as part of updating to 13.2-RELEASE-p1: /bin/freebsd-version /boot/kernel/kernel /boot/kernel/mpr.ko /boot/loader /boot/loader.efi /boot/loader_4th /boot/loader_4th.efi /boot/loader_lua /boot/loader_lua.efi /boot/loader_simp /boot/loader_simp.efi /boot/pxeboot /boot/zfsloader /usr/lib/debug/boot/kernel/kernel.debug /usr/lib/debug/boot/kernel/mpr.ko.debug /usr/lib/libpam.a /usr/lib/pam_krb5.so.6 /usr/lib32/libpam.a /usr/lib32/pam_krb5.so.6 /usr/share/man/man8/pam_krb5.8.gz /usr/src/lib/libpam/modules/pam_krb5/pam_krb5.8 /usr/src/lib/libpam/modules/pam_krb5/pam_krb5.c /usr/src/stand/i386/libi386/comconsole.c /usr/src/sys/conf/newvers.sh /usr/src/sys/dev/mpr/mpr.c |
Install updates or upgrades
1 2 3 4 5 6 7 8 9 10 11 12 |
# freebsd-update install Creating snapshot of existing boot environment... done. Installing updates... Restarting sshd after upgrade Performing sanity check on sshd configuration. Stopping sshd. Waiting for PIDS: 818. Performing sanity check on sshd configuration. Starting sshd. Scanning //usr/share/certs/blacklisted for certificates... Scanning //usr/share/certs/trusted for certificates... done. |
Restart the server to boot with the installed image
1 |
# shutdown -r now |
Check for updated version
1 2 |
# uname -srm FreeBSD 13.3-RELEASE-p1 amd64 |
1 2 3 4 |
# freebsd-version -kur 13.3-RELEASE-p1 13.3-RELEASE-p1 13.3-RELEASE-p1 |
2. Update Packages and Ports Collection
2.1 Package system (pkgng) first run configuration
①Initial run configuration
1 2 3 4 5 6 7 8 9 10 11 12 |
# /usr/sbin/pkg 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+http://pkg.FreeBSD.org/FreeBSD:13:amd64/quarterly, please wait... Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done Installing pkg-1.20.9... Extracting pkg-1.20.9: 100% pkg: not enough arguments Usage: pkg [-v] [-d] [-l] [-N] [-j <jail name or id>|-c <chroot path>|-r <rootdir>] [-C <configuration file>] [-R <repo config dir>] [-o var=value] [-4|-6] <command> [<args>] For more information on available commands and options see 'pkg help'. |
➁confirmation
OK when the list of installed packages appears.
1 2 |
# pkg info pkg-1.20.9 Package manager |
2.2 Update Packages
PACKAGES can use the pkg command to install applications without requiring compilation. However, packages alone cannot install all applications. Dependencies can get in the way and cause necessary applications to be removed.
1 2 3 4 5 6 7 |
# pkg update -f Updating FreeBSD repository catalogue... Fetching meta.conf: 100% 163 B 0.2kB/s 00:01 Fetching packagesite.pkg: 100% 7 MiB 7.2MB/s 00:01 Processing entries: 100% FreeBSD repository update completed. 33643 packages processed. All repositories are up to date. |
1 2 3 4 5 6 7 8 9 |
# pkg upgrade Updating FreeBSD repository catalogue... FreeBSD repository is up to date. All repositories are up to date. Updating database digests format: 100% Checking for upgrades (1 candidates): 100% Processing candidates (1 candidates): 100% Checking integrity... done (0 conflicting) Your packages are up to date. |
2.3 Ports Collection Install
Download and update the ports collection using portsnap included with FreeBSD.
①download and deploy the ports collection
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# portsnap fetch Looking up portsnap.FreeBSD.org mirrors... 5 mirrors found. Fetching public key from dualstack.aws.portsnap.freebsd.org... done. Fetching snapshot tag from dualstack.aws.portsnap.freebsd.org... done. Fetching snapshot metadata... done. Fetching snapshot generated at Sun Apr 7 09:09:55 JST 2024: 5df03a7caabbb9064ce1f11d6769964eecbbfc74abc53f 106 MB 55 MBps 02s Extracting snapshot... done. Verifying snapshot integrity... done. Fetching snapshot tag from dualstack.aws.portsnap.freebsd.org... done. Fetching snapshot metadata... done. Updating from Sun Apr 7 09:09:55 JST 2024 to Sun Apr 7 13:02:13 JST 2024. Fetching 5 metadata patches... done. Applying metadata patches... done. Fetching 0 metadata files... done. Fetching 3 patches. (3/3) 100.00% done. done. Applying patches... done. Fetching 6 new ports or files... done. |
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 |
# portsnap extract ------------------ ------------------ /usr/ports/x11/xvidtune/ /usr/ports/x11/xvinfo/ /usr/ports/x11/xvkbd/ /usr/ports/x11/xvmcinfo/ /usr/ports/x11/xvt/ /usr/ports/x11/xwatchwin/ /usr/ports/x11/xwayland-run/ /usr/ports/x11/xwaylandvideobridge/ /usr/ports/x11/xwd/ /usr/ports/x11/xwininfo/ /usr/ports/x11/xwinwrap/ /usr/ports/x11/xwit/ /usr/ports/x11/xwud/ /usr/ports/x11/xxkb/ /usr/ports/x11/xzoom/ /usr/ports/x11/yad/ /usr/ports/x11/yakuake/ /usr/ports/x11/yalias/ /usr/ports/x11/yeahconsole/ /usr/ports/x11/yelp/ /usr/ports/x11/zenity/ /usr/ports/x11/zutty/ Building new INDEX files... done. |
➁Port Collection Installation
If you did not install ports during the OS installation, proceed as is.
If you have installed ports, please remove the Ports Collection already installed before proceeding if you intend to use git in the future.
1 |
# rm -rf /usr/ports |
1 2 3 4 5 6 7 8 9 10 |
# pkg install git # git clone https://git.FreeBSD.org/ports.git /usr/ports Cloning into '/usr/ports'... remote: Enumerating objects: 6165976, done. remote: Counting objects: 100% (936/936), done. remote: Compressing objects: 100% (120/120), done. remote: Total 6165976 (delta 923), reused 816 (delta 816), pack-reused 6165040 Receiving objects: 100% (6165976/6165976), 1.22 GiB | 12.19 MiB/s, done. Resolving deltas: 100% (3724852/3724852), done. Updating files: 100% (157395/157395), done. |
➂When installing pkg with Ports Collection
If make stopped --- make deinstall →make reinstall
1 2 |
# cd /usr/ports/ports-mgmt/pkg # make install |
2.4 Ports Collection Update
①How to use portsnap
1 |
# portsnap update |
➁Port upgrade using portmaster
Find a portmaster
1 2 3 |
# cd /usr/ports # echo */portmaster ports-mgmt/portmaster |
Installing portmaster
1 2 3 4 5 6 7 8 9 10 |
# cd /usr/ports/ports-mgmt/portmaster # make install clean -------- -------- ====> Compressing man pages (compress-man) ===> Installing for portmaster-3.29_2 ===> Checking if portmaster is already installed ===> Registering installation for portmaster-3.29_2 Installing portmaster-3.29_2... ===> Cleaning for portmaster-3.29_2 |
Search for updates
1 |
# portmaster -L |
Bulk update using portmaster
portmaster creates a backup package before deleting an existing port.
If the new version is successfully installed, Portmaster will delete the backup.
1 |
# portmaster -a |
Examples of typical options
-b : Portmaster will not automatically delete backups
-i : Start Portmaster in interactive mode and ask for confirmation before upgrading each port
If an error occurs during the upgrade, add -f to upgrade and rebuild all ports
1 |
# portmaster -af |
➁Port upgrade using Portupgrade
Install portupgrade
1 2 |
# cd /usr/ports/ports-mgmt/portupgrade # make install clean |
Scan the list of installed ports and correct any inconsistencies
1 |
# pkgdb -F |
Upgrade all old ports installed in the system
1 |
# portupgrade -a |
When upgrading while asking for confirmation of individual upgrades
1 |
# portupgrade -ai |