FreeBSD
Partition example for GPT
| Partition | Size | File System | Mount Point |
|---|---|---|---|
| ada0p1 | 512KB | freebsd-boot | |
| ada0p2 | 50GB | freebsd-ufs | / |
| ada0p3 | 100GB | freebsd-ufs | /home |
| ada0p4 | 4GB | freebsd-swap | none |
After installation setup
su -pkg infopkg updatepkg --y sudopw group mod wheel -m cheopw group mod operator -m cheovisudo
VISUDO editing below...- uncomment this line
# %wheel ALL=(ALL) ALL)(users in wheel group cansudo) - uncomment this line
# %wheel ALL=(ALL) NOPASSWD: ALL(users in wheel group cansudowithout 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
cdgit clone https://github.com/cheomanigua/config.gitmv config/suckless/freebsd .mv freebsd/freebsd_autoinstall_dwm.sh rc_conf ../freebsd_autoinstall_dwm.shsudo ./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.gitmv config/suckless/freebsd .
Install and configure dwm
mkdir sucklesscd sucklessgit clone https://git.suckless.org/dwmcd dwmcp ../../freebsd/dwm/* .sudo make clean install
Install and configure st
cd ..git clone git://git.suckless.org/stcd stcp ../../freebsd/st/* .sudo make clean install
Install and configure dmenu
cd ..wget https://dl.suckless.org/tools/dmenu-5.0.tar.gztar -xvf dmenu-5.0.tar.gzcd dmenu-5.0cp ../../freebsd/dmenu/* .sudo make clean install
Install and configure dwm-bar
cd ..git clone https://github.com/joestandring/dwm-bar.gitcp -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/includeX11LIB = /usr/X11R6/lib......FREETYPEINC = /usr/include/freetype2
- Edited (for FreeBSD)
X11INC = /usr/local/includeX11LIB = /usr/local/lib......FREETYPEINC = /usr/local/include/freetype2
Prepare the wallpaper image
mv freebsd/wallpaper.jpg .
Add entry to .xinitrc:
setxkbmap esfeh --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
zcatorzlessto view it. There is alsobzcat,bzless,xzcatandxzless.