GNU/Linux {docs}

FreeBSD

Partition example for GPT

PartitionSizeFile SystemMount Point
ada0p1512KBfreebsd-boot
ada0p250GBfreebsd-ufs/
ada0p3100GBfreebsd-ufs/home
ada0p44GBfreebsd-swapnone

After installation setup

su -
pkg info
pkg update
pkg --y sudo
pw group mod wheel -m cheo
pw group mod operator -m cheo
visudo
  • VISUDO editing below...
  • uncomment this line # %wheel ALL=(ALL) ALL) (users in wheel group can sudo)
  • uncomment this line # %wheel ALL=(ALL) NOPASSWD: ALL (users in wheel group can sudo without entering password. Use ONLY for temporary tasks!!)
  • add this line %operator ALL=(ALL) NOPASSWD: ALL (users in operator group can reboot, shutdown, etc without sudoing)
  • Now don't forget to logout from root account

Suckless

Instrucions below are consecutive and inline with time. This means the we would issue the command in the directory we finished the previous section.

Automatic installation

cd
git clone https://github.com/cheomanigua/config.git
mv config/suckless/freebsd .
mv freebsd/freebsd_autoinstall_dwm.sh rc_conf .
./freebsd_autoinstall_dwm.sh
sudo ./rc_conf

Clean up

sudo rm -r config freebsd

Start dwm

When installation is finished, run:

startx

Manual installation

Download the template

git clone https://github.com/cheomanigua/config.git
mv config/suckless/freebsd .

Install and configure dwm

mkdir suckless
cd suckless
git clone https://git.suckless.org/dwm
cd dwm
cp ../../freebsd/dwm/* .
sudo make clean install

Install and configure st

cd ..
git clone git://git.suckless.org/st
cd st
cp ../../freebsd/st/* .
sudo make clean install

Install and configure dmenu

cd ..
wget https://dl.suckless.org/tools/dmenu-5.0.tar.gz
tar -xvf dmenu-5.0.tar.gz
cd dmenu-5.0
cp ../../freebsd/dmenu/* .
sudo make clean install

Install and configure dwm-bar

cd ..
git clone https://github.com/joestandring/dwm-bar.git
cp -r ../freebsd/dwm-bar/* dwm-bar

Explanation

Part of the templates are the corrected config.h files that are used for installing dwm, st and dmenu. The original config.h files are targeted to Linux system. I had to change a bit the files:

  • Original (for Linux)
X11INC = /usr/X11R6/include
X11LIB = /usr/X11R6/lib
......
FREETYPEINC = /usr/include/freetype2
  • Edited (for FreeBSD)
X11INC = /usr/local/include
X11LIB = /usr/local/lib
......
FREETYPEINC = /usr/local/include/freetype2

Prepare the wallpaper image

mv freebsd/wallpaper.jpg .

Add entry to .xinitrc:

setxkbmap es
feh --bg-scale wallpaper.jpg &
freebsd/dwm-bar/dwm_bar.sh &
exec dwm

Other packages to install

git, wget, py37-ranger, zathura, zathura-pdf-poppler, pulseaudio, pavucontrol, simplescreenrecorder, py37-ansible, vscode

Changing configuration

You can change the configuration of your suckless apps by editing the config.h file. Once you are finished, run:

sudo make clean install

/etc/rc.conf and /etc/login.conf

FreeBSD is started by the program init. The first thing init does when starting multiuser mode (ie, starting the computer up for normal use) is to run the shell script /etc/rc. By reading /etc/rc and the /etc/rc.d/ scripts, you can learn a lot about how the system is put together, which again will make you more confident about what happens when you do somthing with it.

You can change configurations by editing the file /etc/rc.conf

Disable sendmail daemon

Edit /etc/rc.conf:

sendmail_enable="NO"
sendmail_submit_enable="NO"
sendmail_outbound_enable="NO"
sendmail_msp_queue_enable="NO"

Sync time

Edit /etc/rc.conf:

ntpd_enable="YES"
ntpd_sync_on_start="YES"

Color in terminal

Edit .shrc

alias ls='ls -G'

Color in terminal with gdircolors

sudo pkg install coreutils

Edit .shrc

alias ls='gls --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'

Spanish characters

Even after selection the Spanish keyboard during FreeBSD installation, some special Spanish characters are not shown. The reason behind this is FreeBSD not having UTF-8 enabled by default. Let's enable it.

Edit /etc/login.conf and append these lines in the default:\ section under the last entry :umask=022::

:umask=022:\
:charset=UTF-8:\
:lang=en_US.UTF-8:

Note the lang=en_US bit. This will keep the system in English, but with a Spanish character set because we installed the system selecting the Spanish keyboard. If you want also to change th system locale to Spain, use es_ES instead.

Now regenerate the login database:

sudo cap_mkdb /etc/login.conf

Once you reboot, you can use the especial Spanish characters.

Disks and filesystem

  • geom disk list: List disks
  • sudo camcontrol devlist: List disks
  • geom part list: List partitions
  • gpart list: List partitions
  • sudo camcontrol eject /dev/da0: Eject pendrive

Tips

  • To read a compressed file without having to first uncompress it, use zcat or zless to view it. There is also bzcat, bzless, xzcat and xzless.