What to Do After Finishing Installing FreeBSD

FreeBSD is a popular server platform and Unix-like operating system that is free and open source. FreeBSD can be used as a powerful desktop or development machine, depending on your needs. It also supports network services such as web, email, files, and other programs. One of FreeBSD's most well-known features is its dependability as an internet server. Netflix and Sony rely on FreeBSD to provide reliable service for their PlayStation consoles.

FreeBSD is very stable, and also has a high level of security. It's lightning fast and very responsive. FreeBSD is a free operating system that focuses on performance, networking, and storage, integrating comprehensive system management and documentation to let every computer realize its full potential.

FreeBSD was initially released in 1993. By 2005 FreeBSD had become widely known and became one of the most popular and well-known open source operating systems in the BSD category. FreeBSD captures more than 75% of installed BSD systems. FreeBSD has a very close similarity to Linux. However, FreeBSD has two significant differences in terms of licensing and scope.


This article will explain what steps a system administrator must take after installing FreeBSD. For those who are already familiar with FreeBSD, this article can be used as a reference or to recall forgotten scripts, but for those who are new to FreeBSD, this article may be very useful and helpful in terms of optimizing their FreeBSD system.

Below I will explain what things you have to do after installing FreeBSD.



1. Determine the IP Address, hostname, domain and resolver

Each server must have an IP address, host name and domain, as does FreeBSD. Before you do anything else on the FreeBSD system, first determine the IP address of the FreeBSD server. To create an IP address and host name for the FreeBSD server, you must edit the /etc/rc.conf file. The following is a script to create a FreeBSD IP address and host.

root@ns1:~ # ee /etc/rc.conf
sendmail_enable="NONE"
hostname="ns1"
ifconfig_nfe0="inet 192.168.5.2 netmask 255.255.255.0"
defaultrouter="192.168.5.1"
ntpdate_enable="YES"
ntpd_enable="YES"

In the example script above the FreeBSD IP includes Static IP 192.168.5.2 with netmask 255.255.255.0, if you want to make the FreeBSD IP a dynamic IP the script is changed to ifconfig_nfe0="DHCP"

After we have created the FreeBSD server IP address, the next step is to create a domain. Create an IP domain on FreeBSD by editing the /etc/hosts file. Look at the following example to create a domain and its IP address.

root@ns1:~ # ee /etc/hosts
::1 localhost localhost.unixexplore.com
127.0.0.1 localhost localhost.unixexplore.com
192.168.5.2 ns1 ns1.unixexplore.com

In the example script above, ns1 is the hostname that we created earlier in the /etc/rc.conf file, while unixexplore.com is the domain name and 192.168.5.2 is the IP address of the unixexplore.com domain. For domain names, you are free to create any name according to your taste.

After that, we determine the DNS that will be used on the FreeBSD server. To determine the DNS server, you can edit the /etc/resolve.conf file. Consider the following example.

root@ns1:~ # ee /etc/resolv.conf
domain unixexplore.com
nameserver 1.1.1.1
nameserver 1.0.0.1
nameserver 8.8.8.8

In the example above, our FreeBSD server uses DNS servers 1.1.1.1, 1.0.0.1 and 8.8.8.8 with the domain unixexplore.com.


2. FreeBSD System Update

Before you update FreeBSD, first check the version of FreeBSD you are using.

root@ns1:~ # uname -a
FreeBSD ns1 13.2-RELEASE FreeBSD 13.2-RELEASE releng/13.2-n254617-525ecfdad597 GENERIC amd64


Once you know which version of FreeBSD you are currently using, immediately update the FreeBSD system.

root@ns1:~ # freebsd-update fetch
root@ns1:~ #
freebsd-update install


3. Enable SSH so you can use Remote Putty and Winscp

If we work directly from the FreeBSD server computer it will feel very troublesome, therefore to make the process of installing, configuring and operating the FreeBSD server easier, we need a remote that can access the FreeBSD server from a Windows or Ubuntu Linux system. The way to activate SSH remote mode so that it can be remote using the putty or winscp program is to activate the SSH program in the /etc/rc.conf file. Consider the following example to activate the SSH program.

root@ns1:~ # ee /etc/rc.conf
sendmail_enable="NONE"
hostname="ns1"
ifconfig_nfe0="inet 192.168.5.2 netmask 255.255.255.0"
defaultrouter="192.168.5.1"
ntpdate_enable="YES"
ntpd_enable="YES"
sshd_enable="NO"

In the example above, the sshd_enable="YES" script is to enable the SSH program so that it can be remote using putty or winscp. After the SSH program is active, we continue by editing the /etc/ssh/sshd_config file. In the sshd_config file, remove the "#" sign in the following script.
root@ns1:~ # ee /etc/ssh/sshd_config
Port 22
PermitRootLogin yes


By activating the 2 scripts above, you can run the FreeBSD server from a Windows client with the help of putty or winscp. The PermitRootLogin yes script will give permission to the user to log in as root.


4. Update ports and pkg packages

The last step you have to do after you have finished installing FreeBSD is to update the ports and pkg packages.

a. FreeBSD ports update
To update FreeBSD ports you can follow the steps below.

root@ns1:~ # portsnap fetch
root@ns1:~ #
portsnap extract
root@ns1:~ #
portsnap update

The script above is to download ports. After the download, extract and update ports process is complete, continue with the following script.

root@ns1:~ # cd /usr/ports/ports-mgmt/portmaster
root@ns1:/usr/ports/ports-mgmt/portmaster #
make install clean

After that, continue with the following script.

root@ns2:~ # portmaster -L
root@ns2:~ #
portmaster -a
root@ns2:~ #
portmaster -af
root@ns2:~ #
portupgrade -a
root@ns2:~ #
portupgrade -ai


b. Update the FreeBSD pkg package
To update the pkg package you can use the following script.

root@ns1:~ # pkg update -f
root@ns1:~ #
pkg upgrade -f
root@ns1:~ #
pkg bootstrap -f


For complete details about how to update FreeBSD ports and pkg packages, you can read the previous article.




The steps above are not only applied to FreeBSD servers, but can also be used on HardenedBSD or DargonflyBSD servers.
Iwan Setiawan

I Like Adventure: Mahameru Mount, Rinjani Mount I Like Writer FreeBSD

Post a Comment

Previous Post Next Post