Added FreeBSD install notes to website.
[website_subgeniuskitty.com] / data / notes / freebsd_11.md
CommitLineData
294e7375
AT
1# Overview #
2
3Installation notes for a FreeBSD 11 graphical workstation.
4
5
6# X11 & Fluxbox #
7
8Compile from ports:
9
10 x11/xorg
11 curl+libssh+smb
12 gmp+assembly_opts
13 mesa_libs+wayland
14 webp+x11
15 (xterm+xinerama)
16 x11/nvidia-driver
17 x11-wm/fluxbox
18
19Add the following line to `/etc/rc.conf`, rebooting or using `kldload` before
20attempting to start X.
21
22 kld_list="nvidia-modeset"
23
24Create the following configuration file at
25`/usr/local/etc/X11/xorg.conf.d/driver-nvidia.conf`.
26
27 Section "Device"
28 Identifier "NVIDIA Card"
29 VendorName "NVIDIA Corporation"
30 Driver "nvidia"
31 EndSection
32
33Create `/home/ataylor/.xinitrc` to load Fluxbox and set
34resolution/orientation/etc.
35
36 xrandr --output HDMI-0 --mode 3840x2160 --pos 0x0 --output DVI-D-0 --rotate left --mode 2560x1600 --pos 3840x-150
37 /usr/local/bin/fluxbox
38
39After starting X, use the Fluxbox config menus to set:
40
41* Focus model = mouse focus
42* Auto-raise windows? = no
43* Style = Meta
44
45Overwrite `~/.fluxbox/keys` with my keys file:
46
47 # click on the desktop to get menus
48 OnDesktop Mouse1 :HideMenus
49 OnDesktop Mouse2 :WorkspaceMenu
50 OnDesktop Mouse3 :RootMenu
51
52 # scroll on the desktop to change workspaces
53 OnDesktop Mouse4 :PrevWorkspace
54 OnDesktop Mouse5 :NextWorkspace
55
56 # alt + left/right click to move/resize a window
57 OnWindow Mod1 Mouse1 :MacroCmd {Raise} {Focus} {StartMoving}
58 OnWindowBorder Move1 :StartMoving
59
60 OnWindow Mod1 Mouse3 :MacroCmd {Raise} {Focus} {StartResizing NearestCorner}
61 OnLeftGrip Move1 :StartResizing bottomleft
62 OnRightGrip Move1 :StartResizing bottomright
63
64 # control-click a window's titlebar and drag to attach windows
65 OnTitlebar Control Mouse1 :StartTabbing
66
67 # double click on the titlebar to shade
68 OnTitlebar Double Mouse1 :Shade
69
70 # left click on the titlebar to move the window
71 OnTitlebar Mouse1 :MacroCmd {Raise} {Focus} {ActivateTab}
72 OnTitlebar Move1 :StartMoving
73
74 # middle click on the titlebar to lower
75 OnTitlebar Mouse2 :Lower
76
77 # right click on the titlebar for a menu of options
78 OnTitlebar Mouse3 :WindowMenu
79
80 # open a terminal
81 Mod1 F1 :Exec xterm
82 # open a dialog to run programs
83 Mod1 F2 :Exec fbrun
84 # Open file manager
85 #Mod1 F3 :Exec spacefm
86 # current window commands
87 Mod1 F4 :Close
88
89 # Take a screenshot
90 111 :Exec /home/ataylor/bin/take_screenshot.sh
91
92 # Start screensaver, lock screen
93 110 :Exec xscreensaver-command -lock
94
95 # Window sizing commands
96 Control F1 :Minimize
97 Control F2 :Shade
98 Control F3 :Maximize
99 Control F4 :Fullscreen
100
101 Control F5 :MacroCmd {ResizeTo 1600 1250} {Moveto 0 0 UpperLeft}
102 Control F6 :MacroCmd {ResizeTo 1600 1250} {Moveto 0 0 LowerLeft}
103
104 Control F7 :MacroCmd {ResizeTo 1905 2160} {Moveto 0 0 UpperLeft}
105 Control F8 :MacroCmd {ResizeTo 1905 2160} {Moveto 0 0 UpperRight}
106
107 Control F9 :MacroCmd {ResizeTo 1920 1080} {Moveto 0 0 UpperLeft}
108 Control F10 :MacroCmd {ResizeTo 1920 1080} {Moveto 0 0 UpperRight}
109 Control F11 :MacroCmd {ResizeTo 1920 1080} {Moveto 0 0 LowerLeft}
110 Control F12 :MacroCmd {ResizeTo 1920 1080} {Moveto 0 0 LowerRight}
111
112Set the system clock by modifying `~/.fluxbox/init` to contain:
113
114 session.screen0.strftimeFormat: %a, %b %d %H:%M:%S
115
116# Ports - Misc #
117
118To enable searching ports via `make search key=text-string`, execute the
119following command.
120
121 cd /usr/ports && make index
122
123Some packages with auto-updating strings (like version number) fail checksum
124tests. Both `print/texinfo` and `security/trousers` are common examples. When
125encountering a message about size mismatches during the fetch stage, perform
126the following steps.
127
1281. Download the source file manually with `wget`.
1292. Use `make fetch-list` with `grep` to find out where the file should go.
130 Should be somewhere under `/usr/ports/distfiles`.
1313. Copy the file to the proper location.
1324. In the folder of the port you are trying to build, run `make makesum` to
133 update the checksum based on the currently present file.
1345. Resume making the port as normal.
135
136Compile and install the following ports:
137
138 sysutils/screen
139 ftp/wget
140 editors/vim
141 Set EDITOR=vim in ~/.profile
142 www/firefox
143 Build failing on ffmpeg dependency
144 going into ffmpeg folder and building directly solved it.
145 Also had to run (as root) dbus-uuidgen > /etc/machine-id
146 Otherwise firefox coredumps with:
147 "D-Bus library appears to be incorrectly set up; failed to read machine uuid: Failed to open "/etc/machine-id": No such file or directory"
148 mail/mutt
149 +sidebar
150 www/links (start with links -g)
151 sysutils/nitrogen
152 net/samba46
153 -ads,ad_dc,ldap
154 mount_smbfs -I 192.168.1.5 //ataylor@talisker/zfs_stripe_0 /mnt/zfs_stripe_0
155 graphics/geeqie
156 multimedia/vlc
157 +x264/x265 support
158 sysutils/fusefs-exfat
159 fuse_load="YES" -> /boot/loader.conf
160 /dev/nvd0s3 /mnt/windows exfat rw,mountprog=/usr/local/sbin/mount.exfat 0 0 -> /etc/fstab
161 devel/git
162 git config --global user.name "Aaron Taylor"
163 git config --global user.email "ataylor@subgeniuskitty.com"
164 devel/sdl20
165 graphics/ImageMagick-nox11
166 graphics/sdl2_image
167 net-p2p/deluge
168 irc/irssi
169 dns/bind-tools
170 www/apache24
171 apache24_enable="yes" -> rc.conf
172 in httpd.conf set:
173 ServerName
174 ServerAdmin
175 and uncomment the cgi (not cgid) module in the MPMPREFORK IFDEF
176 net-mgmt/icmpmonitor
177 emulators/simh
178 emulators/virtualbox-ose
179 Add "vboxdrv_load="YES"" to /boot/loader.conf
180 pw groupmod vboxusers -m ataylor
181 Add "vboxnet_enable="YES"" to /etc/rc.conf for bridging support
182 multimedia/quodlibet
183 devel/arm-none-eabi-gdb
184 devel/valgrind
185 devel/arm-none-eabi-gcc
186 editors/libreoffice
187 graphics/inkscape
188 graphics/okular
189 math/gnuplot
190 editors/texmaker
191 devel/openocd
192 Enable USB for non-root users:
193 pw groupmod operator -m ataylor
194 setup the devfs subsystem by adding these lines to the following files:
195 ***/etc/devfs.rules (FreeBSD >= 8):
196 [localrules=10]
197 add path 'ugen*' mode 0660 group operator
198 add path 'usb/*' mode 0660 group operator
199 add path 'usb' mode 0770 group operator
200 ***/etc/rc.conf:
201 devfs_system_ruleset="localrules"
202 graphics/gimp
203 -gutenprint (brings in samba-4.4 and conflicts with installed samba-4.6)
204 x11-fm/qtfm
205 x11-fm/twander
206 TODO: Re-work ~/.twander for FreeBSD
207 www/py-beautifulsoup
208 www/py-requests
209 www/py3-requests
210 games/linux-dwarffortress
211 games/openmw
212
213# Mounting SMB/CIFS at Boot #
214
215Add to `/etc/fstab`:
216
217 //ataylor@TALISKER/zfs_mirror_0 /mnt/zfs_mirror_0 smbfs rw,late,-N,-I192.168.1.5 0 0
218 //ataylor@TALISKER/zfs_stripe_0 /mnt/zfs_stripe_0 smbfs rw,late,-N,-I192.168.1.5 0 0
219
220Set ownership to `ataylor:ataylor` on `/mnt/zfs_stripe_0 and /mnt/zfs_mirror_0`
221since `mount_smbfs` uses default "owner and group IDs from the directory where
222the volume is mounted." (from `mount_smbfs` manpage)
223
224Add to `/etc/nsmbd.conf`
225 [TALISKER:ATAYLOR]
226 password=password-goes-here
227
228
229# Firefox Configuration #
230
231In `about:config`:
232
233 browser.newtabpage.enabled = false
234 general.useragent.override = NCSA Mosaic/1.0 (X11;SunOS 4.1.4 sun4m)
235 gfx.canvas.azure.backends = cairo
236 gfx.content.azure.backends = cairo
237 gfx.canvas.azure.accelerated = true
238
239Note that the `gfx.*` entries enable hardware acceleration since the Nvidia
240drivers I am using support cairo but not skia, or is it that cairo supports my
241video drives and skia doesn't?
242
243In preferences:
244
245* Remember last session on startup
246* Download files to `/home/ataylor/downloads`
247* Check for updates but do not auto-install
248* Default search -> DuckDuckGo
249* Do not provide search suggestions
250* Location Bar, disable all 'suggest' locations (History, Bookmarks, Open Tabs)
251
252Install plugins:
253
254
255* uBlock Origin
256* NoScript
257* Image Zoom
258* Save Image in Folder
259* Thumbnail Zoom Plus
260
261Execute `touch ~/.null` and then create `~/.config/user-dirs.dirs` as below.
262
263 XDG_DESKTOP_DIR="$HOME/.null"
264 XDG_DOWNLOAD_DIR="$HOME/.null"
265 XDG_TEMPLATES_DIR="$HOME/.null"
266 XDG_PUBLICSHARE_DIR="$HOME/.null"
267 XDG_DOCUMENTS_DIR="$HOME/.null"
268 XDG_MUSIC_DIR="$HOME/.null"
269 XDG_PICTURES_DIR="$HOME/.null"
270 XDG_VIDEOS_DIR="$HOME/.null"
271
272To make scrollbars move one-page-per-click rather than jumping to the cursor,
273create the file `~/.config/gtk-3.0/settings.ini` with contents:
274
275 [Settings]
276 gtk-primary-button-warps-slider=false
277
278
279# X11 Configuration #
280
281In `~/.Xresources`:
282
283 xterm*faceName: Liberaqtion Mono:size=12:antialias=true
284 xterm*font: 7x13
285
286In `~/.Xmodmap`:
287
288 !
289 ! Swap Caps_Lock and Control_L
290 !
291 remove Lock = Caps_Lock
292 remove Control = Control_L
293 keycode 9 = Caps_Lock NoSymbol Caps_Lock
294 keycode 37 = Escape NoSymbol Escape
295 keycode 66 = Control_L NoSymbol Control_L
296 add Lock = Caps_Lock
297 add Control = Control_L
298
299In `~/.xinitrc`:
300
301 xrdb /home/ataylor/.Xresources
302 xmodmap /home/ataylor/.Xmodmap
303
304
305# FreeBSD Configuration #
306
307Add to `/etc/sysctl.conf`:
308
309 kern.corefile=/dev/null
310
311# Screensaver/Screenlock #
312
313Compile the `x11/xscreensaver` port and execute `xscreensaver-demo` to
314configure the screensaver.
315
316Add `xscreensaver -nosplash &` to `~/.xinitrc`.
317
318Add a line like the one below to `~/.fluxbox/keys`.
319
320 110 :Exec xscreensaver-command -lock
321
322
323# Wallpaper Configuration #
324
325Create `~/bin/wallpaper_rotation.sh` and add to `~/.xinitrc`.
326Remember to make it executable.
327
328 #!/usr/local/bin/python3
329 # This script creates a wallpaper slideshow.
330
331 ##### Configuration
332
333 # List of image source directories
334 # Each sublist is of the form:
335 # [monitor ID, absolute path to directory containing images for this monitor]
336 source_dir = [
337 [0,"/mnt/zfs_mirror_0/wallpaper/ratio_10_16"],
338 [1,"/mnt/zfs_mirror_0/wallpaper/ratio_16_9"]
339 ]
340
341 # This list will be populated during runtime.
342 # Each sublist is of the form:
343 # [monitor ID, absolute path to image file to display on this monitor]
344 current_wallpaper = [
345 [0,""],
346 [1,""]
347 ]
348
349 # Path to nitrogen configuration file
350 nitrogen_config = "/home/ataylor/.config/nitrogen/bg-saved.cfg"
351
352 ##### Dependencies
353
354 from subprocess import call
355 from os import listdir
356 from os.path import isfile, join
357 from random import choice
358 from time import sleep
359
360 ##### Source Code
361
362 def write_config():
363 config_file = open(nitrogen_config, 'w')
364 for monitor in current_wallpaper:
365 # Indenting the following triple-quoted text inserts leading whitespace in the
366 # nitrogen config file. However, nitrogen strips leading whitespace before
367 # processing its config file and the extra whitespace makes this Python script
368 # more readable.
369 template = """[xin_{monitor_n}]
370 file={wallpaper_file}
371 mode=0
372 bgcolor=#000000
373 """
374 context = {
375 "monitor_n":monitor[0],
376 "wallpaper_file":monitor[1]
377 }
378 config_file.write(template.format(**context))
379 config_file.close()
380
381 def refresh_wallpaper():
382 write_config()
383 call(["/usr/local/bin/nitrogen", "--restore"])
384
385 def get_rand_from_dir():
386 file_choices = [x for x in listdir(source_dir[current_monitor][1]) if isfile(join(source_dir[current_monitor][1], x))]
387 filename = choice(file_choices)
388 filename = join(source_dir[current_monitor][1], filename)
389 current_wallpaper[current_monitor][1] = filename
390
391 # Put something up on all monitors
392 for i in range(len(source_dir)):
393 current_monitor = i
394 get_rand_from_dir()
395 refresh_wallpaper()
396
397 # Eternal slideshow loop
398 while 1:
399 current_monitor = (current_monitor + 1) % len(source_dir)
400 get_rand_from_dir()
401 refresh_wallpaper()
402 sleep(10)
403
404
405# Vim Configuration #
406
407Create `~/.vimrc` as follows.
408
409 set nocompatible " be iMproved, required
410 filetype off " required
411
412 set number
413 syntax on
414 set tabstop=4
415 set expandtab
416 "set background=dark
417 "colorscheme solarized
418
419 "Folding
420 "http://vim.wikia.com/wiki/Folding_for_plain_text_files_based_on_indentation
421 "set foldmethod=expr
422 "set foldexpr=(getline(v:lnum)=~'^$')?-1:((indent(v:lnum)<indent(v:lnum+1))?('>'.indent(v:lnum+1)):indent(v:lnum))
423 "set foldtext=getline(v:foldstart)
424 "set fillchars=fold:\ "(there's a space after that \)
425 "highlight Folded ctermfg=DarkGreen ctermbg=Black
426 "set foldcolumn=6
427
428 " Color the 100th column.
429 set colorcolumn=100
430 highlight ColorColumn ctermbg = lightgray
431
432
433# Deluge Configuration #
434
435Follow instructions at <https://whatbox.ca/wiki/deluge>. Add check boxes in Connection Manager:
436
437* "Automatically connect to selected host on start-up"
438* "Do not show this dialog on start-up".
439
440
441# Personal Software #
442
443Compile and install `wallproc`. Requires the following dependencies from ports:
444
445 devel/sdl20
446 graphics/ImageMagick-nox11
447 graphics/sdl2_image
448
449
450# Printer Configuration #
451
452Create a spool directory:
453
454 mkdir -p /var/spool/lpd/lp
455 chown daemon:daemon /var/spool/lpd/lp
456 chmod 770 /var/spool/lpd/lp
457
458Add an entry to `/etc/printcap`.
459
460 # HP LaserJet, M's Office
461 lp:\
462 :lp=:rm=192.168.1.252:rp=raw:\
463 :sh:\
464 :mx#0:\
465 :sd=/var/spool/lpd/lp:\
466 :lf=/var/log/lpd-errs:
467
468Edit `/etc/rc.conf` to add the line `lpd_enable="YES"`.
469
470Note that plaintext files print in stairstep. See the link below if I want to
471fix this. Consider adding a smart filter to only apply this to text and pass PS
472straight through.
473
474<https://www.freebsd.org/doc/en_US.ISO8859-1/books/handbook/printing-lpd.html#printing-lpd-filters-stairstep>
475
476# TODO #
477
478 After reboot:
479 Setup virtualbox and verify CAD software runs
480 Firefox:
481 Menus/tabs/etc use AA fonts but websites don't. Why not?
482 YES: wiki.archlinux.org
483 NO: reddit
484 https://forums.freebsd.org/threads/firefox-no-gpu-acceleration-since-50-0.59089/
485 Check Debian & FreeBSD install notes from previous desktop systems
486 Add lagavulin to tape backup schedule over network. Where to spool?
487 sysutils/bacula-client
488
489
490# temp notes from ports compiles #
491
492===================================================================================================================
493
494 Virtualbox USB Support
495 USB Support:
496 ============
497
498 For USB support your user needs to be in the operator group and needs read
499 and write permissions to the USB device.
500
501 % pw groupmod operator -m jerry
502
503 Add the following to /etc/devfs.rules (create if it doesn't exist):
504
505 [system=10]
506 add path 'usb/*' mode 0660 group operator
507
508 To load these new rule add the following to /etc/rc.conf:
509
510 devfs_system_ruleset="system"
511
512 Then restart devfs to load the new rules:
513
514 % /etc/rc.d/devfs restart
515
516===================================================================================================================
517
518 FreeBSD USB NOTE:
519 To allow an ordinary user to acces any of the the hotplug USB interface
520 add him/her to the operator group (pw groupmod operator -m username), then
521 setup the devfs subsystem by adding these lines to the following files:
522
523 ***/etc/devfs.rules (FreeBSD >= 8):
524 [localrules=10]
525 add path 'ugen*' mode 0660 group operator
526 add path 'usb/*' mode 0660 group operator
527 add path 'usb' mode 0770 group operator
528
529 ***/etc/devfs.rules (FreeBSD <= 7):
530 [localrules=10]
531 add path 'ugen*' mode 0660 group operator
532
533 ***/etc/rc.conf:
534 devfs_system_ruleset="localrules"