A few months ago I started using FreeBSD. First it was only virtual machine but later on I bought a Lenovo ThinkPad x240  to install there Freebsd 11.2.

This is a story of my setup and customization.

The most up to date manual and backup config files are here at https://gitlab.com/jacekkowalczyk82/freebsd

 

2018-11-20-160101_1920x975_scrot.png

2018-11-20-160942_1920x975_scrot.png

Installation FreeBSD 11.2

Auto ZFS
created user added to group wheel

FreeBSD 11.2 in Virtualbox VM – Post installer configurations and steps

#as root
freebsd-update fetch 
freebsd-update install

portsnap fetch 
portsnap extract

pkg update
pkg upgrade

pkg install bash nano sudo 
bash 
nano /usr/local/utc/sudoers
uncomment line: %wheel ALL = (ALL) ALL

pkg install xorg 
pkg install mate-desktop mate slim vim htop git screenfetch

nano /etc/fstab
#I added this line
proc /proc procfs rw 0 0

nano /etc/rc.conf
#I added these 3 lines
dbus_enable="YES"
hald_enable="YES"
slim_enable="YES"

cd ~/
nano .xinitrc
# set this line
exec /usr/local/bin/mate-session


ln -s .xinitrc .xsession
cp .xinitrc /home/kowalczy/
ln -s /home/kowalczy/.xinitrc /home/kowalczy/.xsession

chown kowalczy:kowalczy /home/kowalczy/.xinitrc
chown kowalczy:kowalczy /home/kowalczy/.xsession

pkg install virtualbox-ose-additions

nano /etc/rc.conf
# I added these 2 lines
vboxguest_enable="YES"
vboxservice_enable="YES"

reboot

FreeBSD 11.2 at thinkpad x240 – Post installer configurations and steps

# as root

freebsd-update fetch 
freebsd-update install

portsnap fetch 
portsnap extract

pkg update
pkg upgrade

pkg install bash nano sudo 
bash 
nano /usr/local/utc/sudoers
uncomment line: %wheel ALL = (ALL) ALL

pkg install xorg 
pkg install mate-desktop mate slim vim htop git screenfetch

nano /etc/fstab
# I added this line
proc /proc procfs rw 0 0

nano /etc/rc.conf
#I added these 3 lines

dbus_enable="YES"
hald_enable="YES"
slim_enable="YES"

cd ~/
nano .xinitrc
#I added this 1 line
exec /usr/local/bin/mate-session

ln -s .xinitrc .xsession
cp .xinitrc /home/jacek/
ln -s /home/kowalczy/.xinitrc /home/jacek/.xsession

chown kowalczy:kowalczy /home/jacek/.xinitrc
chown kowalczy:kowalczy /home/jacek/.xsession

reboot

Install Virtualbox at host

  • First of all in BIOS settings enable Kernel Virtualization of the CPU
  • Install desired software
freebsd-version -k
sudo pkg install subversion
sudo svn co svn://svn.freebsd.org/base/releng/11.2/ /usr/src

cd /usr/ports/emulators/virtualbox-ose-kmod/
sudo make install clean

sudo pkg install gcc

cd /usr/ports/emulators/virtualbox-ose
sudo make install clean
  • Configure User for running Virtualbox
sudo pw groupmod vboxusers -m jacek
sudo pw groupmod operator -m jacek

sudo pluma /etc/rc.conf
# add this to file
#for virtualbox
vboxnet_enable="YES"
devfs_system_ruleset="system"
#

sudo pluma /etc/devfs.conf 
#add this to file 
#for virtualbox 
own vboxnetctl root:vboxusers
perm vboxnetctl 0660
#

sudo /etc/rc.d/devfs restart
  1. Enable Virtualbox kernel modules
sudo kldload vboxdrv
sudo chown root:vboxusers /dev/vboxnetctl

sudo pluma /boot/loader.conf 
#add this to file 
#for virtualbox
vboxdrv_load="YES"
##

Setup Wifi

  1. Create file /etc/wpa_supplicant.conf
network={
ssid="WORK_OFFICE_WIFI_SSID"
psk="PIN_OR_PASSWORD"
id_str="work"
}

network={
ssid="HOME_WIFI_SSID"
psk="PIN_OR_PASSWORD"
id_str="home"
}
  • Restart networking by command
sudo service netif restart

More responsive GUI

  • Edit file /etc/sysctl.conf and set
kern.sched.preempt_thresh=224
  • reboot machine

 

Install Graphics drivers

cd /usr/ports/graphics/drm-next-kmod/ 
sudo make install clean

sudo echo "# for graphics" >> /etc/rc.conf
sudo echo "kld_list=\"/boot/modules/i915kms.ko\"" >> /etc/rc.conf

 

Connecting external display by the miniDP -> HDMI cable

  • Run xrandr without connected cable, and check available resolution modes and device names
  • Connect cable and run xrandr command again. Examples:
xrandr --output HDMI-1 --mode 1600x900 --above eDP-1 
# or 
xrandr --output HDMI-1 --mode 1600x900 --same-as eDP-1
# or just 
xrandr

Byobu

sudo pkg install byobu
sudo mkdir -p /compat/linux/proc
sudo mount -t linprocfs linproc /compat/linux/proc
To make it permanent, you need the following line in /etc/fstab:
linproc /compat/linux/proc linprocfs rw,late 0 0

FreeBSD 11.2 – install i3wm
# as root

 

pkg update
pkg upgrade

pkg install i3 i3lock i3status 
pkg install dmenu nitrogen

cp /usr/local/etc/i3/config ~/.config/i3/config 
edit the file ~/.config/i3/config and add at the beginning 
#use Windows key as mod key
set $mod Mod4 
# replace all default Mod1 with $mod 
# default Mod1 is left Alt key

nano ~/.xinitrc
#I set this only one line 
/usr/local/bin/i3

Slim themes

sudo pkg install slim-themes
sudo nano /usr/local/etc/slim.conf
set current_theme fbsd

The names of all themes can be found in /usr/local/share/slim/themes/
archlinux-simple
debian-moreblue
fbsd
flat
gentoo-simple
lake
mindlock
rainbow
scotland-road
wave
capernoited
default
fingerprint
flower2
gnewsense
lunar
parallel-dimensions
rear-window
subway
zenwalk

 

Update system and applications

freebsd-update fetch
freebsd-update install

pkg update
pkg upgrade

Tweak system for Desktop use plus some usefull light GUI application

  • Install packages:
sudo pkg install xedit geany ted scribus diffuse
sudo pkg install bsdstats
  • Edit /boot/loader.conf and add entries:
##### from desktop-installer investigation
kern.hz="100"
kern.maxfiles="25000"
kern.timecounter.hardware=i8254
uplcom_load="YES"
firewire_load="YES"
ng_ubt_load="YES"
kern.vty=vt
cuse4bsd_load="YES"
  • Edit /etc/fstab and add lines:
# from desktop installer investigation , for automounting USB, cdrom devices
fdesc /dev/fd fdescfs rw 0 0

/dev/cd0 /removable/cdrom0 cd9660 ro,noauto 0 0
/dev/cd1 /removable/cdrom1 cd9660 ro,noauto 0 0
/dev/cd2 /removable/cdrom2 cd9660 ro,noauto 0 0
/dev/da0s1 /removable/flash0 msdosfs rw,noauto 0 0
/dev/da1s1 /removable/flash1 msdosfs rw,noauto 0 0
/dev/da2s1 /removable/flash2 msdosfs rw,noauto 0 0

  • Edit /etc/devfs.conf and add lines:
# Added by desktop-installer:
perm cuad0 0660
own cuad0 root:operator

perm cuad1 0660
own cuad1 root:operator

perm cuau0 0660
own cuau0 root:operator

perm cuau1 0660
own cuau1 root:operator

perm acd0 0660
own acd0 root:operator

perm acd1 0660
own acd1 root:operator

perm cd1 0660
own cd1 root:operator

perm fd0 0660
own fd0 root:operator

perm fd1 0660
own fd1 root:operator
  • Edit /etc/devfs.rules and add lines:
[system=10]
# Added by desktop-installer.
add path 'ugen*' mode 0660 group operator
# Added by desktop-installer.
add path 'cuaU*' mode 0660 group operator
# Added by desktop-installer.
add path 'uhid*' mode 0660 group operator
# Added by desktop-installer.
add path 'usbctl*' mode 0660 group operator
# Added by desktop-installer.
add path 'usb/*' mode 0660 group operator
# Added by desktop-installer.
add path 'video*' mode 0660 group operator
# Added by desktop-installer.
add path 'ng_ubt*' mode 0660 group operator
# Added by desktop-installer.
add path 'acd*' mode 0660 group operator
# Added by desktop-installer.
add path 'cd*' mode 0660 group operator
# Added by desktop-installer.
add path 'da*' mode 0660 group operator
# Added by desktop-installer.
add path 'pass*' mode 0660 group operator
# Added by desktop-installer.
add path 'xpt*' mode 0660 group operator
# Added by desktop-installer.
add path 'unlpt*' mode 0660 group cups
# Added by desktop-installer.
add path 'ulpt*' mode 0660 group cups
# Added by desktop-installer.
add path 'lpt*' mode 0660 group cups
  • Edit ‘/etc/rc.conf’ and add lines
# from desktop installer investigation
nfs_client_enable="YES"
#rpc_statd_enable="YES"
#rpc_lockd_enable="YES"
devd_enable="YES"
devfs_system_ruleset="system"

#vboxguest_enable="YES"
#vboxservice_enable="YES"
cupsd_enable="YES"
#webcamd_enable="YES"
bsdstats_enable="YES"


# from Robo Nuggie
#automount NFS
autofs_enable="YES"
  • Edit /etc/sysctl.conf and add lines:
#more power for GUI
kern.sched.preempt_thresh=224

# From desktop-installer investigation
vfs.usermount=1
kern.ipc.shm_allow_removed=1

  • Reboot the system

Install DWM from suckless.org as a desktop

  • Install required packages
sudo pkg install dwm sterm dmenu

sudo pkg install surf-browser

sudo pkg install gcc libX11 libXft libXinerama 
cd ~/git/
git clone git://git.suckless.org/dwm
  • make changes in config.mk
diff --git a/config.mk b/config.mk
index 25e2685..b81970e 100644
--- a/config.mk
+++ b/config.mk
@@ -7,8 +7,8 @@ VERSION = 6.1
PREFIX = /usr/local
MANPREFIX = ${PREFIX}/share/man

-X11INC = /usr/X11R6/include
-X11LIB = /usr/X11R6/lib
+X11INC = /usr/local/include
+X11LIB = /usr/local/lib

# Xinerama, comment if you don't want it
XINERAMALIBS = -lXinerama
@@ -16,7 +16,7 @@ XINERAMAFLAGS = -DXINERAMA

# freetype
FREETYPELIBS = -lfontconfig -lXft
-FREETYPEINC = /usr/include/freetype2
+FREETYPEINC = /usr/local/include/freetype2
# OpenBSD (uncomment)
#FREETYPEINC = ${X11INC}/freetype2
  • make changes in config.def.h
diff --git a/config.def.h b/config.def.h
index 1c0b587..0bf6c2a 100644
--- a/config.def.h
+++ b/config.def.h
@@ -44,7 +44,7 @@ static const Layout layouts[] = {
};

/* key definitions */
-#define MODKEY Mod1Mask
+#define MODKEY Mod4Mask
#define TAGKEYS(KEY,TAG) \
{ MODKEY, KEY, view, {.ui = 1 << TAG} }, \
{ MODKEY|ControlMask, KEY, toggleview, {.ui = 1 << TAG} }, \

 

  • Execute commands to build DWM
sudo make clean install
  • Prepare .xinitrc file
setxkbmap pl
xrdb ~/.Xresources

exec xrandr --output VGA-0 --mode 1920x975 --rate 60 &
exec nitrogen --restore &

while true ; do xsetroot -name "`date '+%Y-%m-%d %H:%M.%S'` `uptime | sed 's/.*,//'`"; sleep 1; done &

exec /home/kowalczy/git/dwm/dwm

 

  • Edit ~/.Xresources and set/add lines:
uxterm*background: black
uxterm*foreground: lightgray

XTerm.vt100.scrollBar: true
XTerm.vt100.scrollBar.width: 8
Advertisements

One thought on “How to install and configure FreeBSD 11.2

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s