User Tools

Site Tools


project:bsd:start
no way to compare when less than two revisions

Differences

This shows you the differences between two versions of the page.


project:bsd:start [2018/05/17 18:26] – created maxfx
Line 1: Line 1:
 +
 +{{template>:project:infobox | name=BSD OS Systems | image=freebsd.jpg?200| sw=BSD| hw=BSD| founder=
 +[[user:maxfx]]| 
 +interested=[[user:ruza]]\\ 
 +[[user:malanius]]\\ 
 +[[user:rainbof]]\\ 
 +[[user:ray]]\\ 
 +[[user:foonix]] | status=active }}
 +
 +~~META:
 +status = active
 +&relation firstimage = :project:freebsd.jpg
 +~~
 +
 +====== BSD OS Systems ======
 +
 +====== FreeBSD ====== 
 +**FreeBSD** is a freely available and open source implementation of the Berkeley version of the UNIX operating system.This system is in the same family of operating systems as Solaris, AIX, HP-UX, and Digital UNIX. The original UNIX operating system can trace its roots back to the 1960s. The designers of UNIX created a design so flexible and powerful that even 30 years later, UNIX (and thus FreeBSD as well) remains one of the most versatile, well-respected operating systems available. It runs on the following platforms: **AMD64, ARM, ARM64, I386, MIPS, PC98, PPC, SPARC, XBOX, RPI, PICO**. FreeBSD offers advanced networking, performance, security and compatibility features today which are still missing in other operating systems, even some of the best commercial ones.
 +
 +[[https://brmlab.cz/lib/exe/detail.php?id=project:freebsd:start&media=project:freebsd-boot-screen.png|{{:project:freebsd-boot-screen.png?800|}}]]
 +
 +
 +====== Goals and ideas project ======
 +
 + * More information about FreeBSD OS.
 +
 + * More information about network layer
 +
 + * More information about kernel
 +
 + * Porting kernel for other unfriendly platforms 
 +
 + * Porting or Run kernel for other unfriendly android mobile phones or tablets.
 +
 + * More desktops with BSD ! ....
 + 
 +====== Derivates FreeBSD OS ======
 +
 +^  Derivate FreeBSD  ^  Use      ^  Link                                                                                        ^   ^
 +| FreeBSD            | Easy use  | [[https://www.freebsd.org/|https://www.freebsd.org/]]                                        |   |
 +| TrueOS / PCBSD     | Easy use  | [[https://www.trueos.org/|https://www.trueos.org/]]                                          |   |
 +| GhostBSD           | Easy use  | [[http://www.ghostbsd.org/|http://www.ghostbsd.org/]]                                        |   |
 +| DesktopBSD         | Easy use  | [[http://www.desktopbsd.net/|http://www.desktopbsd.net/]]                                    |   |
 +| HardenedBSD        | Easy use  | [[https://hardenedbsd.org/|https://hardenedbsd.org/]]                                        |   |
 +| MidnightBSD        | Easy use  | [[http://www.midnightbsd.org/|http://www.midnightbsd.org/]]                                  |   |
 +| DragonFly          | Easy use  | [[https://www.dragonflybsd.org/|https://www.dragonflybsd.org/]]                              |   |
 +| TrustedBSD         | Easy use  | [[http://www.trustedbsd.org/|http://www.trustedbsd.org/]]                                    |   |
 +| Frenzy             | Easy use  | [[http://frenzy.org.ua/eng/|http://frenzy.org.ua/eng/]]                                      |   |
 +| Debian FreeBSD     | Easy use  | [[https://wiki.debian.org/Debian_GNU/kFreeBSD|https://wiki.debian.org/Debian_GNU/kFreeBSD]]  |   |
 +| Gentoo FreeBSD     | Easy use  | [[https://wiki.gentoo.org/wiki/Gentoo_FreeBSD|https://wiki.gentoo.org/wiki/Gentoo_FreeBSD]]  |   |
 +| Raspbsd            | Easy use  | [[http://www.raspbsd.org/|http://www.raspbsd.org/]]                                          |   |
 +| Freesbie           | Easy use  | [[http://www.freesbie.org/|http://www.freesbie.org/]]                                        |   |
 +| MfsBSD                       | http://mfsbsd.vx.sk/                                                                           |
 +| True-Pico          |           | [[https://www.trueos.org/trueos-pico/|https://www.trueos.org/trueos-pico/]]                  |   |
 +|                    |                                                                                                        |   |
 +
 +\\
 +
 +====== Information about FreeBSD ======
 +
 +==== Comparing BSD and Linux ====
 +
 +[[https://www.freebsd.org/doc/en_US.ISO8859-1/articles/explaining-bsd/index.html | Explaining BSD]]
 +
 +[[https://www.freebsd.org/doc/en_US.ISO8859-1/articles/explaining-bsd/comparing-bsd-and-linux.html | Comparing BSD and linux]]
 +
 +==== For Beginner  ====
 +
 +[[https://www.youtube.com/watch?v=YncqBz0bZcQ | How To Get a GUI In FreeBSD - Beginner Class]]
 +
 +[[https://www.youtube.com/watch?v=MZaZjK-cOYc | FreeBSD 11.1 Installation + GNOME Desktop + Apps + Guest Additions on Oracle VirtualBox [2017] ]]
 +
 +[[https://www.youtube.com/watch?v=qKQFIPent8o | FreeBSD 11.1 Installation + XFCE Desktop + Apps + Guest Additions on Oracle VirtualBox [2017]  ]]
 +
 +[[https://websetnet.com/how-to-install-freebsd-10-2-with-mate-desktop/ | FreeBSD Installation + MATE Desktop + UFS]]
 +
 +==== FreeBSD is not Windows ===
 +
 +[[http://vtbsd.net/notwindows.html]]
 +
 +==== FreeBSD Myth (For linux users) ====
 +
 +[[https://wiki.freebsd.org/Myths|https://wiki.freebsd.org/Myths]]
 +
 +[[https://www.freebsd.org/advocacy/myths.html#closed-model]]
 +
 +==== FreeBSD features ====
 +
 +[[https://www.freebsd.org/features.html]]
 +
 +==== FreeBSD tips and tricks ====
 +
 +[[https://calomel.org/freebsd_network_tuning.html | FreeBSD network tuning]]
 +
 +[[https://calomel.org/network_performance.html | Network performance]]
 +
 +[[https://cooltrainer.org/a-freebsd-desktop-howto/]]
 +
 +[[http://www.packetwatch.net/documents/guides/2008030201.php]]
 +
 +[[https://home.nuug.no/~peter/pf/en/|Firewalling with OpenBSD's PF packet filter]]
 +
 +[[https://www.freebsdnews.com/2017/07/18/building-bsd-home-router-pt-4-installing-pfsense/ | Building-bsd-home-router-pt-4-installing-pfsense/]]
 +
 +[[https://www.digitalocean.com/community/tutorials/a-comparative-introduction-to-freebsd-for-linux-users | comparative-introduction-to-freebsd-for-linux-users ]]
 +
 +[[http://truelogic.org/wordpress/2015/09/24/freebsd-how-to-clean-and-rebuild-all-ports-with-portmaster/|How to clean and rebuild all ports with Portmaster]]
 +
 +[[http://www.wonkity.com/~wblock/docs/html/disksetup.html]]
 +
 +[[http://www.freebsdmadeeasy.com/tutorials/freebsd/schedule-tasks-with-crontab.php| schedule-tasks-with-crontab]]
 +
 +[[http://blog.up-link.ro/how-to-set-up-a-freebsd-router-step-by-step-tutorial/ | Freebsd router step by step]]
 +
 +[[https://unixblogger.com/2011/10/18/the-pain-of-an-realtek-rtl8111rtl8168-ethernet-card/ | The pain of a Realtek (RTL8111/RTL8168) ethernet card]]
 +
 +[[http://blog.ataboydesign.com/2014/04/23/freebsd-10-mounting-usb-drive-with-ext4-filesystem/ | Mounting drive with ext4 filesystem]]
 +
 +[[https://www.garron.me/en/bits/change-permissions-recursively.html | Change permissions]]
 +
 +[[https://unrelenting.technology/articles/freebsd-on-the-thinkpad-x240 | Freebsd on the Thinkpad x240]]
 +
 +
 +==== FreeBSD Video ====
 +
 +[[https://www.youtube.com/watch?v=wwbO4eTieQY | FreeBSD: Not a Linux Distro, George Neville-Neil   ]]
 +
 +[[https://www.youtube.com/watch?v=ps67ECyh0sM | FreeBSD is not a Linux distribution: Philip Paes]]
 +
 +[[https://www.youtube.com/watch?v=nwbqBdghh6E | FreeBSD Kernel Internals, Dr. Marshall Kirk McKusick ]]
 +
 +[[https://www.youtube.com/watch?v=UfiTV9QWhM4 | An Overview of Locking in the FreeBSD Kernel - Kirk McKusick, EuroBSDcon 2012 ]]
 +
 +[[https://www.youtube.com/watch?v=E04LxKiu79I | An Overview of Security in the FreeBSD Kernel, Dr. Marshall Kirk McKusick ]]
 +
 +[[https://www.youtube.com/watch?v=ds77e3aO9nA | A Narrative History of BSD, Dr. Kirk McKusick]]
 +
 +[[https://www.youtube.com/watch?v=_oWcfUt9QUs | Systems, Science and FreeBSD, George Neville-Neil]]
 +
 +[[https://www.youtube.com/watch?v=cofKxtIO3Is | Convincing a Linux guy to use FreeBSD :-) ]]
 +
 +[[https://www.youtube.com/watch?v=Ib7tFvw34DM | The Trouble with FreeBSD ]]
 +
 +[[https://www.youtube.com/watch?v=D-iKNtfBySg | The Realities of DTrace on FreeBSD, by George Neville Neil (EuroBSDcon 2017)]]
 +
 +[[https://www.youtube.com/watch?v=WnCClGMzB58 | Tuning FreeBSD for routing and firewalling, by Olivier Cochard-Labbé (EuroBSDcon 2017)]]
 +
 +[[https://www.youtube.com/watch?v=NMUf6VGK2fI | Brian Kidney: The Realities of DTrace on FreeBSD - BSDCan 2017 ]]
 +
 +[[https://www.youtube.com/watch?v=XnO4S7kb7vg | What is FreeBSD by Gavin Atkinson]]
 +
 +[[https://www.youtube.com/watch?v=A5rmG2j4Lk8 | Case Study: Switching from Linux to FreeBSD ]]
 +
 +[[https://www.youtube.com/watch?v=Mri66Uz6-8Y | Jordan Hubbard - FreeBSD: The Next 10 Years]]
 +
 +[[https://www.youtube.com/watch?v=TneLO5TdW_M | Rick Reed - WhatsApp: Half a billion unsuspecting FreeBSD users]]
 +==== FreeBSD Video ZFS ====
 +
 +[[https://www.youtube.com/watch?v=8f9TREeqb5o | An introduction to the implementation of ZFS by Kirk McKusick]]
 +
 +[[https://www.youtube.com/watch?v=IQp_FglfzUQ | ZFS Internals Overview by Kirk McKusick ]]
 +
 +==== FreeBSD Video ASIANBSDCON 2018 ====
 +[[https://www.youtube.com/watch?v=e1B_6iGY2lU | P01A: Institutionalizing FreeBSD Isolated and Virtualized Hosts -- Michael Dexter]]
 +
 +[[https://www.youtube.com/watch?v=SLlzep0IxVY | P02A: Tuning FreeBSD for routing and firewalling -- Olivier Cochard Labbe]]
 +
 +[[https://www.youtube.com/watch?v=bwbLuQDoxuQ | P03A: PC BSD evolves into TrueOS - Kris Moore]]
 +
 +[[https://www.youtube.com/watch?v=Y5cx9hEhxfE | P04A: FreeBSD ARM32ARM64 Porting to a new board - Emmanuel Vadot]]
 +
 +[[https://www.youtube.com/watch?v=NeJ2ztPasso | P05A: Profiling the FreeBSD kernel boot -- Colin Percival]]
 +
 +[[https://www.youtube.com/watch?v=FzF9e4jrnJ4 | P06A: Role based Access Control in BCHS Web Applications -- Kristaps Dzonsons]]
 +
 +[[https://www.youtube.com/watch?v=vOVoylirkUU | P07A: OpenBSD/x-ray: OpenBSD on medical x-ray machines -- Henning Brauer]]
 +
 +[[https://www.youtube.com/watch?v=bBLSvTQY7xw | P08A: Improving netdump hardware support and performance with iflib -- Sam Gwydir]]
 +
 +[[https://www.youtube.com/watch?v=9mOFFovdAw0 | P09A: Introducing FreeBSD VPC -- Sean Chittenden]]
 +
 +[[https://www.youtube.com/watch?v=lcrnXQ7xp7k | AsiaBSDCon 2018 Work in Progress Session and Closing]]
 +
 +==== FreeBSD Kernel Porting ====
 +
 +[[https://www.bidouilliste.com/blog/2015/11/27/Porting-FreeBSD-to-a-new-ARM-Board-Part-1/]]
 +
 +[[https://www.bidouilliste.com/blog/2015/11/27/Porting-FreeBSD-to-a-new-ARM-Board-Part-2/]]
 +
 +[[https://www.bidouilliste.com/blog/2015/11/27/Porting-FreeBSD-to-a-new-ARM-Board-Part-3/]]
 +
 +[[https://www.digitalocean.com/community/tutorials/how-to-install-and-manage-ports-on-freebsd-10-1]]
 +
 +[[https://bsdimp.blogspot.cz/2007/10/building-bootable-freebsdi386-images.html]]
 +
 +[[https://www.cl.cam.ac.uk/research/security/ctsrd/pdfs/201403-asiabsdcon2014-freebsd-smp-boot.pdf]]
 +
 +[[https://www.bsdcan.org/2008/schedule/attachments/49_2008_uboot_freebsd.pdf]]
 +
 +[[http://www.strugglingcoder.info/index.php/category/freebsd/]]
 +
 +[[http://www.isysop.com/unpacking-and-repacking-u-boot-uimage-files/]]
 +
 +[[https://github.com/bitboss-ca/freebsd-arm-tools]]
 +
 +[[http://blog.khubla.com/freebsd/building-u-boot-for-chromebook]]
 +
 +[[http://www.nikoopour.com/2015/03/]]
 +
 +[[https://raybsd.blogspot.cz/2012/12/]]
 +
 +[[http://distkeys.com/blog/2014/08/03/inside-freebsd/ ]]
 +
 +==== FreeBSD Kernel for beringer ====
 +[[https://bsdmag.org/basic-unix-queuing-techniques/]]
 +
 +[[https://bsdmag.org/unix-kernel-system-calls/]]
 +
 +[[https://bsdmag.org/dynamic-memory-allocation-unix-systems/]]
 +
 +==== FreeBSD Port ====
 +[[https://networking.ringofsaturn.com/Unix/createportpatch.php| Creating a FreeBSD Port Patch]]
 +
 +==== FreeBSD Jails ====
 +[[https://clinta.github.io/freebsd-jails-the-hard-way/]]
 +
 +[[https://www.cyberciti.biz/faq/howto-setup-freebsd-jail-with-ezjail/]]
 +
 +[[https://www.cyberciti.biz/faq/how-to-install-and-configure-jails-on-freenas-corral-10/]]
 +
 +[[https://gundersen.net/32bit-jail-on-64bit-freebsd/]]
 +
 +[[https://medium.com/chris-opperwall/quick-jail-updating-in-freebsd-f7c6bb52c6de]]
 +
 +[[https://www.kirkg.us/posts/how-to-configure-a-freebsd-jail-on-a-digital-ocean-droplet/]]
 +
 +
 +==== How to build package ====
 +=== Poudriere ===
 +[[https://www.freebsd.org/doc/handbook/ports-poudriere.html | Building Packages with Poudriere]]
 +
 +[[https://github.com/freebsd/poudriere/wiki | Poudriere wiki]]
 +
 +
 +=== Making new port ===
 +[[http://www.freebsd.cz/doc/en/books/porters-handbook/own-port.html | Making a New Port]]
 +==== How to Become a FreeBSD Committer ====
 +[[https://wiki.freebsd.org/BecomingACommitter | How to Become a FreeBSD Committer]]
 +
 +
 +==== FreeBSD Sound ====
 +[[https://wiki.jriver.com/index.php/Mixing]]
 +
 +[[https://people.freebsd.org/~ariff/SOUND_4.TXT.html]]
 +
 +
 +==== Steam on FreeBSD ====
 +[[https://github.com/SteamOnFreeBSD/SteamOnFreeBSD | Steam on FreeBSD]]
 +
 +
 +==== FreeBSD as Bitcoin Full Node ====
 +
 +[[https://bsdmag.org/5374-2/]]
 +
 +
 +==== Avoiding Linuxisms ====
 +
 +[[https://wiki.freebsd.org/AvoidingLinuxisms]]
 +
 +
 +==== Quick start for Linux users ====
 +
 +[[http://www.freebsd.cz/doc/en/articles/linux-users/article.html|http://www.freebsd.cz/doc/en/articles/linux-users/article.html]]
 +
 +^ Purpose                                 | FreeBSD command      ^ Linux® command (Red Hat)  ^ Linux® command (Debian)  ^
 +| Install package from remote repository  | pkg install package  | yum install package       | apt-get install package  |
 +|  Install local package                  | pkg add package      | rpm -ivh package          | dpkg -i package          |
 +|  List installed packages                | pkg info             | rpm -qa                   | dpkg -l                  |
 +|  List PCI devices                       | pciconf              | lspci                     | lspci                    |
 +|  List loaded kernel modules             | kldstat              | lsmod                     | lsmod                    |
 +|  Load/Unload kernel modules             | kldload / kldunload  | modprobe                  | modprobe                 |
 +|  Trace system calls                     | truss                | strace                    | strace                   |
 +
 +
 +==== FreeBSD handbook ====
 +{{ :project:freebsd:book.pdf | FreeBSD handbook}}
 +
 +[[https://wiki.freebsd.org/ZFSTuningGuide | ZFS Tuninig guide]]
 +
 +
 +==== Support Laptops ====
 +
 +[[https://wiki.freebsd.org/Laptops|https://wiki.freebsd.org/Laptops]]
 +
 +
 +==== Tuning Power Laptops ==== 
 +[[https://wiki.freebsd.org/TuningPowerConsumption]]
 +
 +====== First step after installation FreeBSD ======
 +
 +The first step after installation system is good download security patches for the operating system 
 +and download new files for operating system and install.
 +
 +<code>
 +freebsd-update fetch install
 +shutdown -r now
 +</code>
 +
 +Next step is to update ports collection for the operating system.
 +
 +for updating information for FreeBSD ports developers is /usr/ports/CHANGES
 +
 +<code>
 +portsnap auto
 +
 +or
 +
 +portsnap fetch
 +portsnap extract
 +</code>
 +
 +Update ports is east command
 +
 +<code>
 +portsnap fetch update
 +</code>
 +
 +Security audit for package and FreeBSD
 +
 +<code>
 +pkg audit -F
 +</code>
 +
 +====== Apply security patches FreeBSD update, upgrade ======
 +
 +==== Apply security patches ====
 +<code>
 +freebsd-update fetch
 +freebsd-update install
 +</code>
 +
 +==== Upgrade FreeBSD ====
 +<code>
 +freebsd-update fetch
 +freebsd-update upgrade -r 11.0-RELEASE or other version
 +freebsd-update install
 +</code>
 +====== Desktop Environments ====== 
 +
 +FreeBSD has several desktop environments - Xfce4, Mate, Gnome3, Cinnamon, KDE, Lumina
 +
 +==== How install Mate desktop ====
 +
 +<code>
 +pkg install mate-desktop mate xorg slim
 +</code>
 +
 +Enable components for kernel in etc/rc.conf
 +
 +You need enable this component:
 +
 +<code>
 +zfs_enable="YES"  - if you use ZFS file system
 +hald_enable="YES"
 +dbus_enable="YES"
 +slim_enable="YES"
 +</code>
 +
 +if you want to enable crash dump, if don't you write "NO"
 +
 +<code>
 +dumpdev="AUTO"
 +</code>
 +
 +Next step is create file .xinitrc in /root/ and /home/user/ with command
 +
 +<code>
 +exec mate-session
 +</code>
 +
 +  and reboot.
 +  
 +
 +==== How install Xfce desktop ====
 +
 +<code>
 +pkg install xfce4-desktop xfce xorg slim
 +</code>
 +
 +Enable components for kernel in etc/rc.conf
 +
 +You need to run desktop
 +
 +<code>
 +zfs_enable="YES"  - if you use ZFS file system
 +hald_enable="YES"
 +dbus_enable="YES"
 +slim_enable="YES"
 +</code>
 +
 +if you want to enable crash dump, if don't you write "NO"
 +
 +<code>
 +dumpdev="AUTO"
 +</code>
 +
 +Next step is create file .xinitrc in /root/ and /home/user/ with command
 +
 +<code>
 +exec startxfce4
 +</code>
 +
 +  and reboot.
 +  
 +==== How to set slim theme ====
 +<code>
 +# pkg install slim-themes
 +# cd /usr/local/share/slim/themes
 +# fetch http://daemon-notes.com/downloads/assets/themes/slim-freebsd.tar.bz2
 +# tar jxvf slim-freebsd.tar.bz2
 +# rm slim-freebsd.tar.bz2
 +
 +Edit and set /usr/local/etc/slim.conf
 +#current_theme       default
 +current_theme       freebsd
 +
 +</code>
 +
 +==== Optimus on Freebsd ====
 +Comment out Nvidia-related parts from your [[ https://www.freebsd.org/cgi/man.cgi?xorg.conf | xorg.conf ]]:
 +
 +<code>
 +...
 +
 +Section "Device"
 +    Identifier  "Card0"
 +    Driver      "intel"
 +    BusID       "PCI:0:2:0"
 +EndSection
 +
 +#Section "Device"
 +#   Identifier  "Card1"
 +#   Driver      "nvidia"
 +#   BusID       "PCI:1:0:0"
 +#EndSection
 +
 +...
 +</code>
 +
 +Then add the following bits to [[ https://www.freebsd.org/cgi/man.cgi?rc.conf | rc.conf(5) ]]:
 +
 +<code>
 +kld_list='i915kms'
 +</code>
 +
 +
 +==== NTPD ====
 +==== NTPD synchronize ====
 +
 +<code>
 +ntpdate_enable="YES"
 +ntpdate_hosts="in.pool.ntp.org"
 +</code>
 +
 +Or manually update time and date
 +<WRAP center round important 60%>
 +securelevel on 2 then you cannot set time only about second.
 +</WRAP>
 +
 +<code>
 +ntpdate -b pool.ntp.org
 +sudo service ntpd start
 +</code>
 +
 +==== Disable Beep ====
 +
 +<code>
 +# sysctl hw.syscons.bell=0
 +# reboot
 +</code>
 +
 +or if you use XFCE
 +
 +<code>
 +set bell-style none
 +</code>
 +
 +==== Enable sudo ====
 +You must edit sudoers file
 +<code>
 +visudo
 +</code>
 +
 +==== Change standard shell to fish ====
 +
 +You must add line in /etc/shells for example fish shell
 +<code>
 +/usr/local/bin/fish
 +</code>
 +
 +Change shell and path your favorite shell
 +<code>
 +chsh -s /usr/local/bin/fish
 +</code>
 +
 +=== Aliases === 
 +[[http://bin63.com/cool-bash-aliases-for-freebsd | Cool aliases ]]
 +
 +=== Paths for shell ===
 +If you need PATH for example compiler or some options 
 +<code>
 +# ASAN settings
 +set -x ASAN_SYMBOLIZER_PATH /usr/local/llvm50/bin/llvm-symbolizer
 +set -x ASAN_OPTIONS verbosity=1
 +set -x ASAN_OPTIONS symbolize=1
 +set -x ASAN_OPTIONS detect_stack_use_after_scope=1
 +
 +# UBSAN settings
 +set -x UBSAN_SYMBOLIZER_PATH /usr/local/llvm50/bin/llvm-symbolizer
 +set -x UBSAN_OPTIONS verbosity=2
 +
 +# MSAN
 +set -x MSAN_SYMBOLIZER_PATH /usr/local/llvm50/bin/llvm-symbolizer
 +set -x MSAN_OPTIONS fsanitize-memory-track-origins=2
 +set -x MSAN_OPTIONS verbosity=2
 +set -x MSAN_OPTIONS symbolize=1
 +
 +</code>
 +
 +==== Nano tuning ====
 +<code>
 +set constantshow
 +set smooth
 +set autoindent
 +set casesensitive
 +set historylog
 +set morespace
 +
 +syntax "comments" ".*"
 +color blue "^#.*"
 +
 +## nanorc files
 +include "/usr/local/share/nano/asm.nanorc"
 +include "/usr/local/share/nano/awk.nanorc"
 +include "/usr/local/share/nano/c.nanorc"
 +include "/usr/local/share/nano/cmake.nanorc"
 +include "/usr/local/share/nano/css.nanorc"
 +include "/usr/local/share/nano/debian.nanorc"
 +include "/usr/local/share/nano/fortran.nanorc"
 +include "/usr/local/share/nano/gentoo.nanorc"
 +include "/usr/local/share/nano/groff.nanorc"
 +include "/usr/local/share/nano/html.nanorc"
 +include "/usr/local/share/nano/java.nanorc"
 +include "/usr/local/share/nano/makefile.nanorc"
 +include "/usr/local/share/nano/man.nanorc"
 +include "/usr/local/share/nano/mgp.nanorc"
 +include "/usr/local/share/nano/mutt.nanorc"
 +include "/usr/local/share/nano/nanorc.nanorc"
 +include "/usr/local/share/nano/objc.nanorc"
 +include "/usr/local/share/nano/ocaml.nanorc"
 +include "/usr/local/share/nano/patch.nanorc"
 +include "/usr/local/share/nano/perl.nanorc"
 +include "/usr/local/share/nano/php.nanorc"
 +include "/usr/local/share/nano/pov.nanorc"
 +include "/usr/local/share/nano/python.nanorc"
 +include "/usr/local/share/nano/ruby.nanorc"
 +include "/usr/local/share/nano/sh.nanorc"
 +include "/usr/local/share/nano/tcl.nanorc"
 +include "/usr/local/share/nano/tex.nanorc"
 +include "/usr/local/share/nano/xml.nanorc"
 +
 +</code>
 +==== Mount Devices ====
 +
 +==== Mount msdosfs ====
 +<code>
 +# ls /dev/da*
 +# mount_msdosfs /dev/da0 /media/usb
 +</code>
 +
 +==== Mount ext2/ext3/ext4 ====
 +Fuse-ext2 mounts an ext2/ext3/ext4 partition or image file
 +
 +For control kernels fuse modules is command: 
 +<code>
 +kldstat
 +</code>
 +
 +If you don't have fuse.ko module in the kernel
 +you use this command
 +<code>
 +kldload fuse
 +</code>
 +
 +Then mount your partition 
 +<code>
 +fuse-ext2  /dev/your_partition /media/
 +</code> 
 +
 +
 +==== Mount NTFS ====
 +
 +For mounting ntfs file system you must kernel module loaded.
 +
 +For control kernels fuse modules is command: 
 +<code>
 +kldstat
 +</code>
 +
 +and load FUSE kernel module: 
 +<code>
 +kldload fuse
 +</code> 
 +
 +and then you can mount ntfs filesystem.
 +
 +<code>
 +# ls /dev/da*
 +# ntfs-3g  /dev/your_partition  /mnt/
 +</code>
 +
 +==== Automounting Removable Media ==== 
 +
 +Uncomment in config file in /etc/auto_master
 +<code>
 +/media -media -nosuid
 +</code>
 +
 +Add lines to /etc/devd.conf
 +
 +<code>
 +notify 100 {
 + match "system" "GEOM";
 + match "subsystem" "DEV";
 + action "/usr/sbin/automount -c";
 +};
 +</code>
 +
 +Reload service 
 +
 +<code>
 +service automount reload
 +service devd restart
 +</code>
 +
 +and added configuration /etc/rc.conf
 +<code>
 +autofs_enable="YES"
 +</code>
 +======  Portmaster ====== 
 +<code>
 +portmaster -L - Check all update for ports
 +portmaster -a - Upgrade ports
 +portmaster -af - Rebuild of installed application
 +</code>
 +
 +======  Debug ports ====== 
 +
 +Just put the following in /etc/make.conf and then recompile the ports
 +you want to include debug symbols:
 +
 +<code>
 +WITH_DEBUG= yes
 +</code>
 +
 +more information 
 +<code>
 +/usr/ports/Mk/bsd.port.mk
 +</code>
 +====== Compiling programs ====== 
 +
 +==== Python3, Py3-QT5 ====
 +
 +First thing is to add version python to /etc/make.conf .If you haven't this file you must create.
 +This conf file is for every compilation in system.
 +<code>
 +DEFAULT_VERSIONS+= python=3.5 python3=3.5
 +</code>
 +
 +Next step is compile with default version python3.5
 +<code>
 +sudo portmaster python3
 +</code>
 +
 +
 +===== How to setup MYSQL Database =====
 +
 +The first step is the installation
 +
 +<code>
 +sudo pkg install mysql56-server
 +</code>
 +
 +next step is enable in /etc/rc.conf
 +
 +<code>
 +sudo sysrc mysql_enable=yes
 +</code>
 +
 +Remember to run mysql_upgrade the first time you start the MySQL server after an upgrade from an earlier version.
 +
 +Now start MYSQL Server
 +
 +<code>
 +sudo service mysql-server start
 +</code>
 +
 +then set database
 +
 +<code>
 +sudo mysql_secure_installation
 +</code>
 +
 +====== Jails =====
 +Simple script for create jail on zfs filesystem
 +<code bash>
 +#!/bin/sh
 +
 +########################################################################                         
 +# Donwload i386 base, ports tree FreeBSD OS
 +# and unpack base OS to your jail folder
 +########################################################################                          
 +
 +name_jail="freebsd386"
 +arch_jail="i386"
 +
 +# Create new zfs dataset for jail - only once
 +#zfs create -o mountpoint=/usr/local/jails zroot/jails
 +
 +# Create jail folder 
 +zfs create zroot/jails/$name_jail 
 +        
 +rm /tmp/base.txz
 +rm /tmp/ports.txz
 +
 +echo "Fetching package from FreeBSD server ..."
 +
 +fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/$arch_jail/11.1-RELEASE/base.txz -o /tmp/base.txz
 +fetch ftp://ftp.freebsd.org/pub/FreeBSD/releases/$arch_jail/11.1-RELEASE/ports.txz -o /tmp/ports.txz
 +
 +mkdir /usr/local/jails/$name_jail
 +
 +echo "Unpacking Freebsd base OS ..."
 +tar -xf /tmp/base.txz -C /usr/local/jails/$name_jail
 +tar -xf /tmp/ports.txz -C /usr/local/jails/$name_jail
 +
 +cp /etc/resolv.conf /usr/local/jails/$name_jail/etc
 +
 +echo "Done"
 +</code>
 +
 +/etc/jail.conf
 +<code>
 +# /etc/jail.conf
 +
 +# Global settings applied to all jails.
 +
 +exec.start = "/bin/sh /etc/rc";
 +exec.stop = "/bin/sh /etc/rc.shutdown";
 +exec.clean;
 +mount.devfs;
 +
 +# The jail definition for freebsd386
 +freebsd386 {
 +    host.hostname = "freebsd386.domain.local";
 +    path = "/usr/local/jails/freebsd386";
 +    interface = "lagg0";
 +    ip4.addr = 10.0.2.15;
 +}
 +
 +</code>
 +
 +Packet forwarding
 +<code>
 +#Define the interfaces
 +ext_if = "em0"
 +int_if = "lagg0"
 +jail_net = $int_if:network
 +
 +#Define the NAT for the jails
 +nat on $ext_if from $jail_net to any -> ($ext_if)
 +</code>
 +
 +Run jail 
 +<code>
 +bsd@ ~> sudo jail -c freebsd386
 +bsd@ ~> jls
 +bsd@ ~> sudo jail -m jid=28 allow.raw_sockets=1
 +</code>
 +====== ZFS =====
 +
 +===== Mount ZFS =====
 +<code>
 +zpool import
 +</code>
 +
 +For control command mount.
 +
 +===== Mount ZFS from Live CD =====
 +<code>
 +zpool import -fR /media zroot
 +</code>
 +
 +===== Tuning zfs on i386 ====
 +If you will have i386 OS you must set wm.kmem_size="512M" and vm.kmem_size_max="" is minimal value. 
 +
 +This is little tunables
 +more information on http://www.freebsd.cz/doc/handbook/zfs-advanced.html
 +<code>
 +vfs.zfs.prefetch_disable=0
 +vm.kmem_size="512M"
 +vm.kmem_size_max="768M"
 +vfs.zfs.arc_max="40M"
 +vfs.zfs.vdev.cache.size="5M"
 +</code>
 +
 +
 +===== Resize partition =====
 +
 +We added space for virtual disk (VirtualBox, or other)
 +but we have disk CORRUPT 
 +<code>
 +lol@ ~/> gpart show ada0
 +=>      40  41942960  ada0  GPT  (39G) [CORRUPT]
 +        40      1024      freebsd-boot  (512K)
 +      1064       984        - free -  (492K)
 +      2048   4194304      freebsd-swap  (2.0G)
 +   4196352  37744640      freebsd-zfs  (18G)
 +  41940992      2008        - free -  (1.0M)
 +</code>
 +
 +Fix is easy : 
 +<code>
 +gpart recover ada0
 +</code>
 +
 +Now we need resize partion 3.
 +<code>
 +lol@ ~/> gpart show 
 +=>      40  81919920  ada0  GPT  (39G)
 +        40      1024      freebsd-boot  (512K)
 +      1064       984        - free -  (492K)
 +      2048   4194304      freebsd-swap  (2.0G)
 +   4196352  37744640      freebsd-zfs  (18G)
 +  41940992  39978968        - free -  (19G)
 +</code>
 +
 +<code>
 +lol@ ~/> zpool list
 +NAME    SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
 +zroot  17.9G  17.3G   621M            76%    96%  1.00x  ONLINE  -
 +</code>
 +
 +For device is Busy , we have set this value:
 +<code>
 +lol@ ~/> sysctl kern.geom.debugflags=16
 +kern.geom.debugflags: 0 -> 16
 +</code>
 +
 +Now resize partition number 3 
 +<code>
 +lol@ ~/> gpart show 
 +=>      40  81919920  ada0  GPT  (39G)
 +        40      1024      freebsd-boot  (512K)
 +      1064       984        - free -  (492K)
 +      2048   4194304      freebsd-swap  (2.0G)
 +   4196352  37744640      freebsd-zfs  (18G)
 +  41940992  39978968        - free -  (19G)
 +
 +lol@ ~/> sudo gpart resize -i 3 ada0
 +
 +ada0p3 resized
 +
 +lol@ ~/> gpart show 
 +=>      40  81919920  ada0  GPT  (39G)
 +        40      1024      freebsd-boot  (512K)
 +      1064       984        - free -  (492K)
 +      2048   4194304      freebsd-swap  (2.0G)
 +   4196352  77723608      freebsd-zfs  (37G)
 +</code>
 +
 +Last step with zfs pool: 
 +<code>
 +lol@ ~/> sudo zpool set autoexpand=on zroot
 +lol@ ~/> sudo zpool online -e zroot ada0p3 ada0p3
 +</code>
 +
 +Control space in zpool.Size of zroot is right.
 +<code>
 +lol@ ~/> zpool list
 +NAME    SIZE  ALLOC   FREE  EXPANDSZ   FRAG    CAP  DEDUP  HEALTH  ALTROOT
 +zroot    37G  17.3G  19.7G            36%    46%  1.00x  ONLINE  -
 +</code>
 +
 +<code>
 +lol@ ~/Desktop> sudo sysctl kern.geom.debugflags=0
 +kern.geom.debugflags: 16 -> 0
 +
 +</code>
 +
 +====== Virtualbox ====== 
 +===== Virtuabox in FreeBSD =====
 +
 +Added line with kernel module to /boot/loader.conf
 +
 +<code>
 +vboxdrv_load="YES"
 +</code>
 +
 +Added line for bridged or host-only networking to /etc/rc.conf
 +<code>
 +vboxnet_enable="YES"
 +</code>
 +
 +Added to group
 +<code>
 +pw groupmod vboxusers -m yourusername
 +chown root:vboxusers /dev/vboxnetctl
 +chmod 0660 /dev/vboxnetctl
 +</code>
 +
 +Permanent permisions added lines to /etc/devfs.conf
 +<code>
 +own     vboxnetctl root:vboxusers
 +perm    vboxnetctl 0660
 +</code>
 +
 +===== FreeBSD as guest Virtualbox =====
 +
 +Write to /etc/rc.conf
 +
 +<code>
 +vboxguest_enable="YES"
 +vboxservice_enable="YES"
 +</code>
 +
 +======  Wifi and FreeBSD  ====== 
 +
 +===== How to setup WIFI card =====
 +<code>
 +pciconf -l - look for if see wifi hardware
 +sudo ifconfig wlan0 create wlandev wpi0
 +sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
 +</code>
 +
 +===== How to setup USB WIFI =====
 +
 +Add kernel module to /boot/loader.conf
 +<code>
 +
 +# Kenel drives for wifi 
 +if_ath_load="YES"
 +if_iw_load="YES"
 +
 +# Next wifi modules
 +wlan_wep_load="YES"
 +wlan_ccmp_load="YES"
 +wlan_tkip_load="YES"
 +</code>
 +
 +
 +Add to configure /etc/rc.conf this lines.
 +Configure you wifi device.
 +<code>
 +wlans_run0="wlan0"
 +create_args_wlan0="wlanmode sta country CZ mtu 1500 indoor"
 +</code>
 +
 +
 +Look to your hardware if you have drivers.
 +<code>
 +
 +# Look for if see wifi hardware (wpi, run0)
 +pciconf -l 
 +
 +# Create a device with name wlan0
 +sudo ifconfig wlan0 create wlandev wpi0
 +
 +# Create wpa_supplicant configure file with ssid network 
 +sudo wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf
 +
 +# Scan your wifi networks
 +ifconfig wlan0 up scan 
 +SSID/MESH ID    BSSID              CHAN RATE   S:    INT CAPS
 +lol        00:13:46:49:41:76   11   54M -90:96   100 EPS  WPA WME
 +trololo    00:11:95:c3:0d:ac    1   54M -83:96   100 EPS  WPA
 +
 +# IP address from DHCP server
 +sudo dhclient wlan0
 +</code>
 +
 +====== GELI ======
 +<code>
 +Install CD -> Partition -> Shell
 +
 +gpart create -s gpt vtbd0
 +gpart add -t freebsd-boot -s 512k -a 4k vtbd0
 +gpart add -t freebsd-ufs -a 1M vtbd0
 +gpart bootcode -b /boot/pmbr -p /boot/gptboot -i 1 vtbd0
 +
 +geli init -b -g vtbd0p2
 +geli attach vtbd0p2
 +
 +newfs -j /dev/vtbd0p2.eli
 +mount /dev/vtbd0p2.eli /mnt
 +
 +- /tmp/bsdinstall_etc/fstab
 +/dev/vtbd0p2.eli / ufs rw,noatime 1 1
 +
 +- /tmp/bsdinstall_boot/loader.conf
 +geom_eli_load="YES"
 +
 +exit (installer will continue)
 +
 +Change  /dev/vtbd0p2.eli to gptid/rawuuid (gpart list):
 +/dev/gptid/015ceb9a-90a4-11e6-b8fc-1392a9ed1847 / ufs rw,noatime 1 1
 +</code>
 +
 +====== FreeBSD Kernel ======
 +
 +=== Source code FreeBSD kernel ===
 +<code>
 +sudo pkg install subversion  
 +sudo svn checkout https://svn0.us-east.FreeBSD.org/base/stable/you_version_system /usr/src
 +svn up /usr/src
 +</code>
 +
 +
 +=== Profiling and debugging kernel ===
 +{{ :project:freebsd:profiling_debugging_freebsd_kernel_321772.pdf |}}
 +
 +=== Performance observality tools ===
 +
 +{{:project:freebsd:freebsd_performance_observability_tools.png?600|}}
 +}===== Kernel module =====
 +
 +<code>
 +Simple kernel module.
 +https://github.com/Martinfx/FreeBSD-Kernel-module
 +</code>
 +
 +====== FreeBSD Security ====== 
 +===== Security on FreeBSD =====
 +
 +To check the status of the securelevel on a running system: Add to /etc/sysctl.conf
 +
 +<code>
 +kern.securelevel=2
 +security.bsd.see_other_uids=0
 +security.bsd.stack_guard_page=1
 +net.inet.ip.random_id=1
 +</code>
 +
 +more : [[http://www.freebsd.cz/doc/faq/security.html|http://www.freebsd.cz/doc/faq/security.html]]
 +
 +===== Enabling and Utilizing Process Accounting =====
 +
 +Tracking information such as CPU statistics and executed commands. 
 +
 +<code>
 +touch /var/account/acct
 +chmod 600 /var/account/acct
 +accton /var/account/acct
 +echo 'accounting_enable="YES"' >> /etc/rc.conf
 +</code>
 +
 +======  ACPI ======
 +
 +===== IBM ACPI =====
 +
 +If you use notebooks, is better enable acpi driver in /boot/loader.conf For IBM notebooks is command:
 +
 +<code>
 +acpi_ibm_load="YES"
 +</code>
 +
 +===== HP ACPI =====
 +
 +If you use notebooks, is better enable acpi driver in /boot/loader.conf For HP notebooks is command:
 +
 +<code>
 +acpi_hp_load="YES"
 +</code>
 +
 +More : [[https://www.freebsd.org/cgi/man.cgi?acpi_ibm|https://www.freebsd.org/cgi/man.cgi?acpi_ibm]]
 +
 +====== Linux® Binary Compatibility ======
 +
 +<code>
 +# kldload linux
 +# kldload linux64
 +
 +# kldstat - you can look for modules
 +   72 0xffffffff80200000 1fa7c38  kernel
 +    1 0xffffffff821a9000 30aec0   zfs.ko
 +    2 0xffffffff824b4000 adc0     opensolaris.ko
 +...
 +23    1 0xffffffff827bc000 389f4    linux64.ko
 +
 +and add line to /etc/rc.conf:
 +linux_enable="YES"
 +</code>
 +
 +====== Troubleshooting with FreeBSD ======
 +
 +===== SSH =====
 +==== Too many authentication failures ====
 +If You are not able to authenticate via ssh and message "Too many authentication failures" is logged in /var/log/auth.log you probably have more than 2 keys loaded in your ssh agent that are failing to authenticate. To solve this unload keys you are not using from ssh agent (ssh-add -d path/ ssh-add -D), use ssh -i path_to_key or create an appropriate section in your ~/.ssh/config with IdentityFile.
 +
 +===== BOOT on FreeBSD =====
 + ==== Fatal double fault FreeBSD 10.3 - i386 , FreeBSD 11 - i386  ====
 +
 +{{:project:freebsd:img_20170101_174458_hdr.jpg?600|}}
 +
 +The fatal double fault is a problem on FreeBSD - i386 with ZFS file system.
 +
 +As described in /usr/src/UPDATING entry 20121223, rebuilding the kernel with options KSTACK_PAGES=4 has been observed to resolve the boot-time crash. 
 +This, however, is not an ideal solution for inclusion in the GENERIC kernel configuration, as increasing KSTACK_PAGES 
 +implicitly decreases available usermode threads in an environment that is already resource-starved. 
 +
 +You must do this steps for new kernel:
 +<code>
 +# mkdir -p /usr/src
 +# svnlite co svn://svn.freebsd.org/base/releng/10.2 /usr/src
 +# make -C /usr/src kernel-toolchain
 +# printf "include GENERIC\noptions KSTACK_PAGES=4\n" > /usr/src/sys/i386/conf/ZFS
 +# make -C /usr/src buildkernel KERNCONF=ZFS
 +# make -C /usr/src installkernel KERNCONF=ZFS
 +</code>
 +
 +
 +For FreeBSD 10.3 - More information on page https://www.freebsd.org/releases/10.3R/errata.html
 +For FreeBSD 11.0 - More information on page https://www.freebsd.org/releases/11.0R/errata.html
 +
 +==== How to boot from live CD ====
 +
 +If you have a problem with boot on FreeBSD and cannot run the system.
 +
 +{{:project:freebsd:img_20170101_174458_hdr.jpg?600|}}
 +
 +Back to FreeBSD menu and choose option 3. ( Escape to loader prompt )
 +For help in command line is command help or ? (list of commands )
 +help set are options for the command set 
 +
 +{{:project:freebsd:img_20170102_192147_hdr.jpg?600|}}
 +
 +For boot from CD is commnad 
 +<code>
 +set boot_cdrom (for mount filesystem)
 +boot
 +</code>
 +
 +{{:project:freebsd:img_20170105_201210_hdr.jpg?600|}}
 +
 +
 +Look for a mounted filesystem with command mount.If you haven't zfs filesystem mounted you must run command and connect zpool :
 +<code>
 +zpool import -f zroot
 +</code>