Guide On How To Install FreeBSD Post Install

Guide On How To Install FreeBSD Post Install 2017-08-04T09:47:00+02:00

Things To Do After You Installed FreeBSD
Unless otherwise specified accept the default options when asked a question during installation. Right so post installation tasks. The tasks here are my suggestions on what needs to be done right after finishing installing FreeBSD.

Configure SSH for remote login on some other port than 22

vi /etc/ssh/sshd_config

Find the highlighted line and remove the # sign and modify the port to suit your needs.

#Port 22
#AddressFamily any
#ListenAddress ::

Here is an example of an alternate port. I highly suggest using port numbers above 1000 range, as to not interfere with other services like for example apache. And watch out for port 3306 as well as this is MySQL if you decide to install it.

Port 43210
#AddressFamily any
#ListenAddress ::

If you frequently get “Write failed: Broken pipe” a solution is to adjust the following lines from.

#ClientAliveInterval 0
#ClientAliveCountMax 3

To something like this.

ClientAliveInterval 30
ClientAliveCountMax 5

Adding a “Daily” user

Now running around doing stuff as root is not really considered cool, so we need to create a daily user account who is able to “become” root. Daily work is done running as that user and if you need something done the requires root privileges you can switch to the root account. In order to create an account issue the following command.


You will be asked a few questions. Just hit “Enter” except for the highlighted questions, for line 7 “shell” you can go with the default shell. Later in this guide we will install Bash and I will show you how to change shell.

Username: johndoe
Full name: John Fitzgerald Joe
Uid (Leave empty for default): 
Login group [johndoe]: 
Login group is johndoe. Invite John Doe into other groups? []: 
Login class [default]: 
Shell (sh csh tcsh bash rbash nologin) [sh]: 
Home directory [/home/johndoe]: 
Home directory permissions (Leave empty for default): 
Use password-based authentication? [yes]: 
Use an empty password? (yes/no) [no]: 
Use a random password? (yes/no) [no]: 
Enter password: 
Enter password again: 
Lock out the account after creation? [no]:

You will be asked whether the information you entered is correct. If you choose “No” here you will have to start from scratch.

Username   : johndoe
Doe        : 
Password   : *****
Full Name  : John Fitzgerald Joe
Uid        : 1005
Class      : 
Groups     : johndoe 
Home       : /home/johndoe
Home Mode  : 
Shell      : /bin/sh
Locked     : no
OK? (yes/no):

Once done we need to enable the user to be able to switch to the root account.

pw user mod USERNAME -G wheel

Optional csh configuration start
If you want to add colors to csh you can do it like this.

cd ~
vi .cshrc

Then add the following lines.

setenv  TERM xterm-color
setenv  CLICOLOR
setenv  LSCOLORS dxfxcxdxbxegedbaagbxbx

Optional csh configuration stop

Now that we have remote access to the machine we can proceed to configure FreeBSD over an SSH connection, this has the benefit of allowing copy and paste in order to speed things up a bit.

Update / Patch FreeBSD
I would strongly recommend you to update and or patch your system. Chances are that the image you installed FreeBSD from already needs to be patched. So in order to just do that run the following commands.

freebsd-update fetch
freebsd-update install
reboot now

Note: The above may fail for various reasons. In that case you can try to fetch the update from a designated FreeBSD server like this.

freebsd-update -s fetch

Like updating the system you should also update your ports and packages collection. This is easily done by issuing these commands.

portsnap fetch extract
portsnap fetch update

Modify the hosts config file

The host configuration file should reflect your machine. The file we need to edit is located here /etc/hosts

::1					      localhost			    localhost

# This Host		yourdomain

# Known Hosts		domain

# Known Servers		servername1		servername2

Install the Bash shell

Most people myself included prefer the Bash shell. Be warned it will take a few minutes to install as it also installs perl.

cd /usr/ports/shells/bash && make install clean BATCH=yes

Once Bash is installed run the command below to add an extra line for Bash in /etc/fstab

echo "fdesc   	/dev/fd         fdescfs rw      0       0" >> /etc/fstab

Change the shell from “Whatever was used to Bash”

chsh -s /usr/local/bin/bash USERNAME
chsh -s /usr/local/bin/bash root

Notes on Bash

You may need to modify the configuration files for bash. This is especially true if you plan to install Ntp from ports. For root the configuration file is called .bashrc For everyone else it’s called .profile I recommend adjusting the search path for all users not just root.

Right find the following highligtet line allmost at the top in either .profile or .bashrc config file.

# remove /usr/games if you want
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:$HOME/bin; export PATH

# Setting TERM is normally done through /etc/ttys.  Do only override
# if you're sure that you'll never log in via telnet or xterm or a
# serial line.

Change that line i.e. the “search path” to look like this.

# remove /usr/games if you want
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:$HOME/bin; export PATH

# Setting TERM is normally done through /etc/ttys.  Do only override
# if you're sure that you'll never log in via telnet or xterm or a
# serial line.

In order for changes to take effect either log out and in again or “re-source” your profile. You can resource your profile as a normal user by running the command from the users home dir.

source .profile

And for the root account it goes like this.

source .bashrc

Modify The Perl Path
Important: Many programs are still relying on perl being located in /usr/bin like for example VMware Tools, but perl now installs itself in /usr/local/bin. Luckily we can have our cake and eat it too. Add the following symlink to solve the issue.

cd /usr/bin
mv perl perl.old
ln -s /usr/local/bin/perl perl

Note: The above command “mv perl perl.old” should result in an error as perl should not be found there until symlinked.

Optional Preventing Console Spam
Preventing console spam. Some applications especially Qmail tends to spam your console, which can be quite annoying when you work. This can be solved by redirecting these messages to a logfile rather than tty. This can be done in /etc/syslog.conf

vi /etc/syslog.conf

Change or add the following line.

*.emerg                                         *

Now pipe it to a log file. In this case we are going to use /var/log/messages, which is as good a place as any.

*.emerg                                         *

Notes on Xen: If you are running Citrix Xen Visualization changes are that your date and timezone may need to be adjusted accordingly or you may have entered wrong timezone. You may have to choose UTC. Normally you would Choose “No” to UTC. To rerun the timezone setup run the following command but this time use UTC.


And we are done here.

Spell checkers don’t – Grammar checkers don’t either.