Introductie FreeBSD

wikipedia logo
FreeBSD is bekend als een betrouwbaar operating systeem, daarom wordt vaak gebruikt voor webservers.
Voor gebruik als 'PC' voor de desktop zijn er twee aangepaste distributies: PC-BSD en DesktopBSD.
DesktopBSD werd lange tijd niet verder ontwikkeld...
We are back: DesktopBSD is back after a long period of inactivity [juni 2015]

Veel informatie over FreeBSD is te lezen op de pagina's van de Wikipedia De vrije encyclopedie

Bij de hoofdstukken staan aan het einde van het artikel links naar bijbehorende websites.

  Wikipedia Website
NederlandsEngels
FreeBSD FreeBSD FreeBSD
PC-BSD PC-BSD PC-BSD
DesktopBSD DesktopBSD DesktopBSD

In de Engelse versie van de Wikipedia staat een artikel over de verschillende BSD versies: Comparison of BSD operating systems

Hierin worden ook NetBSD en OpenBSD genoemd.

www-server

binnenkort eigen webserver! ..... niet meer!
Dit is een eerste opzet van deze pagina, binnenkort worden er aanpassingen / uitbreidingen gedaan!

  Het plan om op een Laptop met FreeBSD een website te hosten gaat niet door!

Door de komst van zeer zuinige kleine board computers met een ARM processor
is dit de aangewezen methode voor het zelf hosten van een website.
Zie ook: Blog: juli 2013 Raspberry Pi

De FreeBSD webserver draait op een laptop, waardoor het stroomverbruik gering is. De hardware bestaat uit een Intel Pentium 133 MHz processor, en 32 Mb geheugen. De laptop heeft alleen pcmcia slots, nog geen cardbus.

In de toekomst kan een snellere laptop: Intel Celeron 400 MHz mobile processor, en 192 Mb geheugen, met 'cardbus' ingezet worden.

Vanwege de betrouwbaarheid is voor de software van FreeBSD 4.11 gekozen.
Als webserver wordt de Hiawatha software gebruikt in plaats van de meer gebruikelijke Apache.

Info: website Hiawatha en Wikipedia: Hiawatha_webserver

Een Intel Pentium P5C Mobile verbruikt minder dan 5 watt, de harddisk type 2,5 inch gebruikt ook ca 5 watt.
Het LCD scherm kan onder linux uitgeschakeld worden na bv. 15 minuten inactiviteit.

Ook xs4all gebruikt FreeBSD 4.x, zie het volgend PuTTY terminal venster:

uname -a geeft info over de versie van FreeBSD

link to home xs3.xs4all.nl - PuTTY
leeuwef@xs3:~/WWW/doc/www/doc% uname -a
FreeBSD xs3.xs4all.nl 4.10-RELEASE-p2 FreeBSD 4.10-RELEASE-p2 #2: Mon Apr 18 16:45:47 CEST 2005

opmerkingen FreeBSD versie: opmerkingen webserver:

Vanwege de ADSL verbinding is 'upload' snelheid lager.
Bij adsl is de download snelheid bv. 10 M-bit, waarbij de upload snelheid flink lager is.
Hierdoor laden de pagina's langzamer, dan de pagina's die bij xs4all op de webserver staan.

Opmerking:
De door mij gebruikte versie 4.11 van FreeBSD is vrij oud. Met een nieuwere processor of meer geheugen kan men beter een nieuwere versie van het operating systeem installeren.

Installatie

Omdat de laptop geen CD-rom drive heeft, werd de software via floppies geïnstalleerd.

stappen: Op de CD-rom is een bin directory, waarin de kernel is onderverdeeld in 33 delen, die op een floppie gekopieerd kunnen worden.

Bij de installatie was er een probleem dat de 3Com 3C574B Fast Etherlink netwerkkaart niet herkend werd door FreeBSD.
Dit werd verholpen door de download van de website van 3Com van de windows driver. Onderdeel van setup is een install programma, waarmee de 3C574B netwerkkaart ingesteld kon worden op I/O port 0x240 en IRQ 3. Tevens werd de snelheid ingesteld op 100 MHz Full Duplex.

Voor het installeren van de overige software kan een ftp-server gebruikt worden. Hiervoor wordt een laptop met cd drive gebruikt, waarop ook FreeBSD geïnstalleerd is. In de documentatie van FreeBSD staat hoe de ftp-server geconfigureerd wordt.

Omdat de FreeBSD software op alle computers moet werken, zijn (met name voor netwerk interfaces) veel drivers in de kernel opgenomen. Dit is de zg: 'GENERIC' kernel. Speciaal voor 'oudere' computers is het zinvol om een nieuwe kernel te compileren, waarin alleen de benodigde drivers zijn opgenomen. Voor de netwerk kaart bespaart dit ca 16 drivers (ook 'wireless' interfaces) voor o.a.: Intel, Texas Instruments, Via, RealTek, DEC/Intel, Aironet.

Als onderdeel van de installatie worden de volgende stappen uitgevoerd.

Configuratie

Voor de configuratie worden de volgende stappen uitgevoerd, de opties kunnen later uitgevoerd worden. Opmerkingen:
Terminal configuratie

Omdat op webserver weinig op de console gewerkt wordt, wordt het aantal virtuele terminals verminderd. Dit spaart werkgeheugen in de processor, die daardoor meer geheugen voor andere processen beschibaar heeft.

aanpassen file /etc/ttys
resultaat:
# name  getty                           type    status          comments
#
ttyv0   "/usr/libexec/getty Pc"         cons25  on  secure
# Virtual terminals
ttyv1   "/usr/libexec/getty Pc"         cons25  on  secure
ttyv2   "/usr/libexec/getty Pc"         cons25  on  secure
#ttyv3  "/usr/libexec/getty Pc"         cons25  on  secure
#ttyv4  "/usr/libexec/getty Pc"         cons25  on  secure
#ttyv5  "/usr/libexec/getty Pc"         cons25  on  secure
#ttyv6  "/usr/libexec/getty Pc"         cons25  on  secure
#ttyv7  "/usr/libexec/getty Pc"         cons25  on  secure
ttyv8   "/usr/X11R6/bin/xdm -nodaemon"  xterm   off secure
toegevoegd: # op enkele regels!


Netwerk configuratie

aanpassen file /etc/rc.conf
resultaat:
ifconfig_dc0="DHCP"

aanpassen file /etc/resolv.conf
resultaat:
nameserver 192.168.178.1

aanpassen file /etc/hosts
resultaat:
127.0.0.1               localhost.home localhost
192.168.178.35          freebsd

Gebruikers configuratie: nieuwe gebruikers aanmaken.

Bij FreeBSD, Linux en Unix heeft de 'root' gebruiker alle rechten om aanpassingen op het systeem uit te voeren. Deze 'root' rechten zijn slechts incidenteel nodig, voor normaal gebruik worden 'users' aangemaakt, de minder rechten hebben. Bij FreeBSD wordt de 'wheel' groep gebruikt voor gebruikers die 'root' rechten kunnen gebruiken.

Op de console uitvoeren: (nieuwe gebruiker met root rechten)
freebsd # adduser frits
freebsd # pw groupshow wheel
wheel:*:0:root

freebsd # pw groupmod wheel -m frits

freebsd # pw groupshow wheel
wheel:*:0:root, frits
mogelijke foutmeldingen:
$ su
su: you are not in the correct group (wheel) to su root.

Software

webserver installeren: Hiawatha

freebsd # mount_msdosfs /dev/fd0 /mnt

freebsd # mount
/dev/ad0s1e on /tmp (ufs, local, soft-updates)
/dev/ad0s1f on /usr (ufs, local, soft-updates)
/dev/ad0s1d on /var (ufs, local, soft-updates)
/dev/fd0 on /mnt (msdosfs, local)

freebsd # cd /mnt
freebsd # ls -al
total 379
drwxr-xr-x   1 root  wheel    7168 Jan  1  1980 .
drwxr-xr-x  20 root  wheel     512 Oct 13 13:50 ..
-rwxr-xr-x   1 root  wheel   15884 Nov 19 12:12 HOWTO_Hiwatha.wri
-rwxr-xr-x   1 root  wheel  264271 Nov 18 23:09 hiawatha-6.18.tar.gz

freebsd # cp hiawatha-6.18.tar.gz /usr
freebsd # cd /
freebsd # umount /mnt

freebsd # cd /usr
freebsd # tar -zxvf hiawatha-6.18.tar.gz

...extract...

freebsd # ls -l
total 338
drwxrwxr-x   2 root  operator   512 Oct  6 22:06 .snap
drwxr-xr-x   2 root  wheel     7168 Oct  6 22:19 bin
drwxr-xr-x   3 root  wheel      512 Oct  6 22:21 compat
drwxr-xr-x   2 root  wheel      512 Oct  6 22:19 games
drwxr-xr-x   1 1000  100       1536 Nov 15 20:19 hiawatha-6.18
-rwxr-xr-x   1 root  wheel   264271 Nov 19 15:08 hiawatha-6.18.tar.gz
drwxr-xr-x  46 root  wheel     4608 Oct  6 22:06 include

...more...

freebsd # cd hiawatha-6.18
freebsd # ls -l
total 1022
-rw-r--r--   1 1000  100         61 Aug  3 22:19 AUTHORS
-rw-r--r--   1 1000  100      18687 Aug  3 22:19 COPYING
-rw-r--r--   1 1000  100      32059 Nov 15 20:19 ChangeLog
-rw-r--r--   1 1000  100       8771 Aug  3 22:19 INSTALL
-rw-r--r--   1 1000  100       2857 Aug 19 11:46 Makefile.am
-rw-r--r--   1 1000  100      71269 Nov 15 15:55 Makefile.in
-rw-r--r--   1 1000  100      32289 Nov 15 15:55 aclocal.m4

...

-rw-r--r--   1 1000  100       3459 Nov 15 15:55 config.h.in
-rwxr-xr-x   1 1000  100      33387 Nov 15 15:55 config.sub
-rwxr-xr-x   1 1000  100     226011 Nov 15 15:55 configure

freebsd # ./configure

...draait ca 1 minuut...

freebsd # make install

...draait ca 1 minuut...

...
/usr/bin/install -c -m 644 'doc/index.html' '/usr/local/var/www/hiawatha/index.html'
make install-data-hook
document root instellen installeren: dhcp

freebsd # mount_msdosfs /dev/fd0 /mnt

freebsd # mount
/dev/ad0s1e on /tmp (ufs, local, soft-updates)
/dev/ad0s1f on /usr (ufs, local, soft-updates)
/dev/ad0s1d on /var (ufs, local, soft-updates)
/dev/fd0 on /mnt (msdosfs, local)

freebsd # cd /mnt
freebsd # ls -al
total 379
drwxr-xr-x   1 root  wheel    7168 Jan  1  1979 .
drwxr-xr-x  17 root  wheel     512 mar 12 15:47 ..
-rwxr-xr-x   1 root  wheel  804097 Nov 24 23:09 dhcp-3.1.3.tar.gz

freebsd # cp dhcp-3.1.3.tar.gz /usr/ports/net
freebsd # cd /
freebsd # umount /mnt

freebsd # cd /usr/ports/net
freebsd # gunzip dhcp-3.1.3.tar.gz
freebsd # tar -xvf dhcp-3.1.3.tar

...extract...

freebsd # cd dhcp-3.1.3
freebsd # ls -l
total 170
-rw-r--r--  1 10200  100    967 Sep  1  2009 LICENSE
-rw-r--r--  1 10200  100   2831 Jul 23  2009 Makefile
-rw-r--r--  1 10200  100  10961 Jul 23  2009 Makefile.conf
-rw-r--r--  1 10200  100   1941 Jul 23  2009 Makefile.dist
-rw-r--r--  1 10200  100  25618 Oct  5  2009 README
-rw-r--r--  1 10200  100  91488 Oct  5  2009 RELNOTES
drwxr-xr-x  3 10200  100    512 Oct  5  2009 client
drwxr-xr-x  2 10200  100   1024 Oct  5  2009 common
-rwxr-xr-x  1 10200  100   6429 Mar 17  2005 configure
drwxr-xr-x  3 10200  100    512 Oct  5  2009 contrib
drwxr-xr-x  2 10200  100    512 Oct  5  2009 dhcpctl
drwxr-xr-x  3 10200  100    512 Oct  5  2009 doc
drwxr-xr-x  2 10200  100    512 Oct  5  2009 dst
drwxr-xr-x  8 10200  100    512 Oct  5  2009 includes
drwxr-xr-x  2 10200  100    512 Oct  5  2009 minires
drwxr-xr-x  2 10200  100    512 Oct  5  2009 omapip
drwxr-xr-x  2 10200  100    512 Oct  5  2009 relay
drwxr-xr-x  2 10200  100    512 Oct  5  2009 server
-rw-r--r--  1 10200  100     94 Jul  7  1999 site.conf
drwxr-xr-x  3 10200  100    512 Oct  5  2009 tests

freebsd # make install
No build directory for freebsd - please run ./configure

freebsd # ./configure

...draait een paar seconden...

System type: freebsd
Making links in common
Making links in minires
Making links in dst
Making links in omapip
Making links in server
Making links in client
Making links in relay
Making links in dhcpctl

freebsd # make install

...draait ca 1 minuut...
fout:
cc: ../minires/libres.a: No such file or directory
cc: ../dst/libdst.a: No such file or directory
*** Error code 1

Stop in /usr/ports/net/dhcp-3.1.3/work.freebsd.
*** Error code 1

Intel

Informatie over de processor:

On October 19, 1992, Intel announced that the fifth generation of its compatible microprocessor line (codenamed P5) would be named the Pentium processor rather than the 586, as everybody had assumed. Calling the new chip the 586 would have been natural, but Intel discovered that it could not trademark a number designation, and the company wanted to prevent other manufacturers from using the same name for any clone chips they might develop. The actual Pentium chip shipped on March 22, 1993. Systems that used these chips were only a few months behind.

The Pentium is fully compatible with previous Intel processors, but it differs from them in many ways. At least one of these differences is revolutionary: The Pentium features twin data pipelines, which enable it to execute two instructions at the same time. The 486 and all preceding chips can perform only a single instruction at a time. Intel calls the capability to execute two instructions at the same time superscalar technology. This technology provides additional performance compared with the 486.

With superscalar technology, the Pentium can execute many instructions at a rate of two instructions per cycle. Superscalar architecture usually is associated with high-output RISC chips. The Pentium is one of the first CISC chips to be considered superscalar. The Pentium is almost like having two 486 chips under the hood.

The Pentium, like the 486, contains an internal math coprocessor or FPU. The FPU in the Pentium was rewritten to perform significantly better than the FPU in the 486 yet still be fully compatible with the 486 and 387 math coprocessors. The Pentium FPU is estimated to be two to as much as ten times faster than the FPU in the 486. In addition, the two standard instruction pipelines in the Pentium provide two units to handle standard integer math. (The math coprocessor handles only more complex calculations.) Other processors, such as the 486, have only a single-standard execution pipe and one integer math unit. Interestingly, the Pentium FPU contains a flaw that received widespread publicity.

A third generation of Pentium processors (codenamed P55C) was released in January 1997, and incorporates what Intel calls MMX technology into the second-generation Pentium design. These Pentium-MMX processors were manufactured in clock rates of 66/166MHz, 66/200MHz, and 66/233MHz and in a mobile-only version, which is 66/266MHz. The MMX processors have a lot in common with other second-generation Pentiums, including superscalar architecture, multiprocessor support, on-chip local APIC controller, and power-management features. New features include a pipelined MMX unit, 16KB code, write-back cache (versus 8KB in earlier Pentiums), and 4.5 million transistors. Pentium-MMX chips are produced on an enhanced 0.35-micron CMOS silicon process that allows for a lower 2.8V voltage level. The newer mobile 233MHz and 266MHz processors are built on a 0.25-micron process and run on only 1.8V. With this newer technology, the 266 processor actually uses less power than the non-MMX 133.

W3Ccss W3Chtml