Contents
First do the following
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).
1. Binary Update
Display of kernel and other version information
1 2 |
# uname -srm FreeBSD 14.0-RELEASE amd64 |
Get all available binary updates (security updates)
There was no update this time
1 2 3 4 5 6 7 8 |
# freebsd-update fetch Looking up update.FreeBSD.org mirrors... 3 mirrors found. Fetching metadata signature for 14.0-RELEASE from update1.freebsd.org... done. Fetching metadata index... done. Inspecting system... done. Preparing to download files... done. No updates needed to update system to 14.0-RELEASE-p0. |
Install updates or upgrades
1 2 3 |
# freebsd-update install No updates are available to install. Run '/usr/sbin/freebsd-update 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.0-RELEASE amd64 |
1 2 3 4 |
# freebsd-version -kur 14.0-RELEASE 14.0-RELEASE 14.0-RELEASE |
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:14:amd64/quarterly, please wait... Verifying signature with trusted certificate pkg.freebsd.org.2013102301... done Installing pkg-1.20.8... Extracting pkg-1.20.8: 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.8 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. 33966 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 Installing packages
Use pkg-install to install binary packages
To install curl as an example
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 |
# pkg install curl Updating FreeBSD repository catalogue... FreeBSD repository is up to date. All repositories are up to date. The following 7 package(s) will be affected (of 0 checked): New packages to be INSTALLED: curl: 8.4.0 indexinfo: 0.3.1 libidn2: 2.3.4 libnghttp2: 1.57.0 libpsl: 0.21.2_3 libssh2: 1.11.0,3 libunistring: 1.1 Number of packages to be installed: 7 The process will require 10 MiB more space. 3 MiB to be downloaded. Proceed with this action? [y/N]: y [1/7] Fetching indexinfo-0.3.1.pkg: 100% 6 KiB 6.0kB/s 00:01 [2/7] Fetching libnghttp2-1.57.0.pkg: 100% 140 KiB 143.5kB/s 00:01 [3/7] Fetching libidn2-2.3.4.pkg: 100% 155 KiB 158.7kB/s 00:01 [4/7] Fetching libunistring-1.1.pkg: 100% 674 KiB 689.7kB/s 00:01 [5/7] Fetching libssh2-1.11.0,3.pkg: 100% 281 KiB 287.9kB/s 00:01 [6/7] Fetching libpsl-0.21.2_3.pkg: 100% 63 KiB 64.3kB/s 00:01 [7/7] Fetching curl-8.4.0.pkg: 100% 2 MiB 1.6MB/s 00:01 Checking integrity... done (0 conflicting) [1/7] Installing indexinfo-0.3.1... [1/7] Extracting indexinfo-0.3.1: 100% [2/7] Installing libunistring-1.1... [2/7] Extracting libunistring-1.1: 100% [3/7] Installing libidn2-2.3.4... [3/7] Extracting libidn2-2.3.4: 100% [4/7] Installing libnghttp2-1.57.0... [4/7] Extracting libnghttp2-1.57.0: 100% [5/7] Installing libssh2-1.11.0,3... [5/7] Extracting libssh2-1.11.0,3: 100% [6/7] Installing libpsl-0.21.2_3... [6/7] Extracting libpsl-0.21.2_3: 100% [7/7] Installing curl-8.4.0... [7/7] Extracting curl-8.4.0: 100% |
Installed packages and additional packages installed as dependencies can be found in the list of installed packages
1 2 3 4 5 6 7 8 9 10 |
# pkg info curl-8.4.0 Command line tool and library for transferring data with URLs indexinfo-0.3.1 Utility to regenerate the GNU info page index libidn2-2.3.4 Implementation of IDNA2008 internationalized domain names libnghttp2-1.57.0 HTTP/2.0 C Library libpsl-0.21.2_3 C library to handle the Public Suffix List libssh2-1.11.0,3 Library implementing the SSH2 protocol libunistring-1.1 Unicode string library pkg-1.20.8 Package manager |
2.4 Obtaining information about installed packages
For example, to get information about the curl you just installed
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 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
# pkg info curl curl-8.4.0 Name : curl Version : 8.4.0 Installed on : Fri Nov 17 00:52:41 2023 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 Options : ALTSVC : on BROTLI : off CARES : off COOKIES : on CURL_DEBUG : off DEBUG : off DICT : on DOCS : on EXAMPLES : on FTP : on GNUTLS : off GOPHER : on GSSAPI_BASE : on GSSAPI_HEIMDAL : off GSSAPI_MIT : off GSSAPI_NONE : off HTTP : on HTTP2 : on IDN : off IMAP : on IPV6 : on LDAP : off LDAPS : off LIBSSH : off LIBSSH2 : on MQTT : off NTLM : on OPENSSL : on POP3 : on PROXY : on PSL : on RTMP : off RTSP : on SMB : off SMTP : on STATIC : on TELNET : on TFTP : on THREADED_RESOLVER: on TLS_SRP : on WEBSOCKET : off WOLFSSL : off ZSTD : off Shared Libs required: libssh2.so.1 libpsl.so.5 libnghttp2.so.14 Shared Libs provided: libcurl.so.4 Annotations : FreeBSD_version: 1400097 build_timestamp: 2023-11-04T02:29:48+0000 built_by : poudriere-git-3.3.0-1251-ge8a0e12e cpe : cpe:2.3:a:haxx:curl:8.4.0:::::freebsd14:x64 port_checkout_unclean: no port_git_hash : fa18677c9 ports_top_checkout_unclean: no ports_top_git_hash: a24e513f1 repo_type : binary repository : FreeBSD Flat size : 4.38MiB Description : curl is used in command lines or scripts to transfer data. It is also used in cars, television sets, routers, printers, audio equipment, mobile phones, tablets, settop boxes, media players and is the internet transfer backbone for thousands of software applications affecting billions of humans daily. 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. |
2.3 Ports Collection Install
Since portsnap has been removed in FreeBSD14, use git to download and update the ports collection.
①Install git
When installing from ports
1 2 |
# cd /usr/ports/devel/git # make install clean |
When installing with pkg
1 |
# pkg install git |
➁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 https://git.FreeBSD.org/ports.git /usr/ports |
Update /usr/ports
1 |
# git -C /usr/ports pull |
➂Installing Ports
Internet connection required to use the Ports Collection
To compile and install a port, go to the directory of the port you want to install and type make at the prompt
To install lsof as an example
1 2 |
# cd /usr/ports/sysutils/lsof # make install |
During installation, a working subdirectory is created.
Deleting this directory saves disk space.
1 2 |
# make clean ===> Cleaning for lsof-4.97.0,8 |
2.4 Upgrade Ports
①Port upgrade using Portmaster
Find a portmaster
1 2 3 |
# cd /usr/ports # echo */portmaster ports-mgmt/portmaster |
portmaster installation
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.27 ===> Checking if portmaster is already installed ===> Registering installation for portmaster-3.27 Installing portmaster-3.27... ===> Cleaning for portmaster-3.27 |
Search for updates
1 2 3 4 |
# portmaster -L ===>>> 39 total installed ports ===>>> 7 have new versions available |
Bulk update using portmaster
Portmaster creates a backup package before removing an existing port.
If the the new version is successfully installed, portmaster will delete the backup.
1 |
# portmaster -a |
Examples of typical options
-b : Portmaster does 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
Find portupgrade
1 2 3 |
# cd /usr/ports # echo */portupgrade ports-mgmt/portupgrade |
Install portupgrade
1 2 |
# cd /usr/ports/ports-mgmt/portupgrade # make install clean |
Updating INDEX
1 2 3 |
# portsdb -Fu -F:INDEX file retrieval -u:Update binary DB based on the resulting INDEX file |
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 |