Sunday, November 2, 2025

Typical tasks after FreeBSD installation

FreeBSD manual installation from ISO is very simple and straight forward. It typically takes few minutes. In this blog post, I will document my typical tasks after fresh FreeBSD install.

These tasks are

  • Update of Operating System
  • Add users to Operating System
  •  

Procedure to update operating system

# Check current version of kernel, runtime, userland
freebsd-version -kru

# OS update
freebsd-update fetch
freebsd-update install


# Check current version of (k)ernel, (r)untime, (u)serland
freebsd-version -kru

# if kernel patch level is higher than runtime patch level, reboot the system to use new kernel 

reboot

# try if there is something more to install
freebsd-update install

# Update software packages installed in OS as additional software
pkg update 

 

Procedure to change hostname

# Check current hostname
hostname

# Change hostname
hostname r1.uw.cz

# Change hostname permanently
sysrc hostname="r1.uw.cz"

DNS Settings

When your have following internal DNS servers ...

DNS1: 10.100.4.5
DNS1: 10.100.4.6

... add them into configuration file /etc/resolve.conf

search home.uw.cz
nameserver 10.100.4.5
nameserver 10.100.4.6 
 

IP Settings

In this section, we will configure basic IP settings. Let's assume these are our settings.

Default Network Gateway (Default Router): 10.100.8.254
Network Interface: vmx0
IP Address: 10.100.8.254
Network Mask: 255.255.255.0

Procedure to change IP settings permanently (saved in /etc/rc.conf)

# Set IP settings on vmx0 interface
sysrc ifconfig_vmx0="inet 10.100.8.254 netmask 255.255.255.0"

# set default router (default gateway)
sysrc defaultrouter="10.100.8.254"

Here is the procedure to change IP settings on running system

# Set IP settings on vmx0 interface 
ifconfig vmx0 inet 10.1.0.254 netmask 255.255.255.0

# Show the current IP settings on vmx0 interface
ifconfig vmx0

That's it and your IP settings should be done.

Time Servers

Let's assume we want to use following time server.

NTP Server 01: time.cloudflare.com
NTP Server 02: time.google.com
NTP Server 03: ntp.cesnet.cz

To use above Time Servers, edit configuration file /etc/ntp.conf and ensure time servers are there …

# These time servers must be defined here
server time.cloudflare.com iburst
server time.google.com iburst
server ntp.cesnet.cz iburst
 
# Default public servers from the pool.ntp.org must be disabled
#pool 0.freebsd.pool.ntp.org iburst
#pool 2.freebsd.pool.ntp.org iburst
 

Procedure to enable and time service

# Enable NTPD as a service
sysrc ntpd_enable="YES"
sysrc ntpd_sync_on_start="YES"


# Start service
service ntpd start

# Restart service
service ntpd restart

# Check and Verify NTP time servers
ntpq -p

Time Zone

Let's assume we configure server and we would like to use UTC time to simplify time correlations during potential troubleshooting. 

Time zone: Etc (UTC) / Coordinated Universal Time

Procedure to set and verify Time Zone

sudo timedatectl set-timezone UTC
sudo timedatectl

Procedure to add users into system

There are two methods how to add users into the FreeBSD Operating System. Interactive method usable for human operators and Non-Interactive method, usable for script automation. 

Interactive method 

# Add user
adduser 

Adduser is text based application. Follow the instructions and enter all required inputs.

Non-Interactive method 

If you prefer non-interactive method how to add user into FreeBSD Operating System, you can use following script ...

pw useradd dpasek -m -s /bin/sh -G wheel -c "David Pasek User Account"
passwd dpasek

# User verification
id dpasek
 

Conclusion

In this blog post we have covered typical basic tasks on your fresh FreeBSD server. Hope you find this useful and in case of any trouble, do not hesitate to use comments to ask for further information or report any bug or misconfiguration in my configuration examples.

Enjoy.  

 

No comments:

Post a Comment