FreeBSD 9 System aufsetzen
Nach dem die Installation von FreeBSD 9 erfolgreich abgeschlossen wurde, können folgende Schritte sinnvoll sein.
Diese Schritte stellen meine persönliche Vorgehensweise dar und sind bestimmt nicht die ultimativ richtige Vorlage für jede Installation.
1. Ports aktualisieren
portsnap fetch extract
2. Make Konfiguration
Damit die Applikationen von Anfang etwas schneller installiert werden, gehört für mich in die Datei /etc/make.conf
THREAD=4 INSTALL_NODEBUG=YES MASTER_SITE_BACKUP?= ftp://ftp2.de.freebsd.org/pub/FreeBSD/ports/distfiles/${DIST_SUBDIR}/ MASTER_SITE_OVERRIDE?= ${MASTER_SITE_BACKUP}
3. Im Screen arbeiten
Die Applikation ist schnell installiert und schützt vor unangenehmen Abbrüchen: Das Tool screen
cd /usr/ports/sysutils/screen && make install clean && rehash && screen
Kleine Hilfe:
- Strg-ad Screen in den Hintergrund, alle Prozesse im Screen laufen weiter. Dieser Screen lässt sich mit screen -r wieder herstellen.
- Strg-d Screen schließen; dies schließt auch alle Prozesse im Screen.
- Strg-ac Neuen Screen im Screen öffnen, dieser neue Screen lässt sich auch mit Strg-d wieder schließen
- Strg-aa Zum vorherigen Screen umschalten
Natürlich gibt es noch mehr wissenswertes über Screen.
4. Mit den Ports arbeiten
Es gibt zahlreiche Werkzeuge Ports. In der Regel wird portmaster bevorzugt. Meine Wahl fällt auf portupgrade:
cd /usr/ports/ports-mgmt/portupgrade && make config-conditional install clean && rehash
Das dauert dann eine Weile, schließlich werden jetzt Perl, Ruby & Co gebaut ....
4. NTP
NTP konfigurieren und starten.
Monitoring
SmartMonTools
Installieren
portinstall smartmontools
Konfigurieren der zwei SATA-Platten
Editieren der Datei /usr/local/etc/smartd.conf
# -a alle SMART-Werte beobachten # -o on aktiviert regelmaessiges OFFLINE-Testen # -S on aktiviert autosave # -H Health-Status ausgeben /dev/ada0 -a -o on -S on -H /dev/ada1 -a -o on -S on -H
Und den smartd automatisch starten:
echo 'smartd_enable="YES"' >> /etc/rc.conf && /usr/local/etc/rc.d/smartd start
Munin
portinstall -c munin-node portinstall -c munin-common munin-master
Monit
portinstall -c monit
Sicherheit
Ist SSH weltweit offen, sollte mindestens sshguard installiert werden. Dieser benötigt die FreeBSD eigene Firewall ipfw, doch der Reihe nach:
1. Installation
portinstall -c sshguard-ipfw
Firewall
Minimale Firewall-Konfiguration in der Datei /etc/ipfw.conf:
# Erlaube Loopback add 1000 allow ip from any to any via lo0 # Erlaube Pakete von bestehenden Verbindungen add 1010 allow tcp from any to any established add 1015 allow all from any to any out keep-state add 1020 allow all from any to any frag # Erlaube notwendigen ICMP Traffic (etwa Ping) add 1030 allow icmp from any to any icmptype 0,3,4,11,12 # Erlaube Network Time (NTP) add 2010 allow udp from any 123 to any 123 # Erlaube DNS add 2050 allow udp from any to any 53 out add 2051 allow udp from any 53 to any in # Verbiete FTP add 3110 deny tcp from any to any 21 in add 3120 deny tcp from any to any 21 out # Erlaube SSH add 56000 allow tcp from any to any 22 in setup # Erlaube alles andere add 56010 allow ip from any to any
Dann die rc.conf ergänzen:
echo 'firewall_enable="YES"' >> /etc/rc.conf echo 'firewall_type="/etc/ipfw.conf"' >> /etc/rc.conf /etc/rc.d/ipfw start
Läuft die Firewall, muss nun noch der syslogd konfiguriert und neu gestartet werden. Dazu in der Datei /etc/syslog.conf das Kommentarzeichen zu Beginn entfernen
auth.info;authpriv.info |exec /usr/local/sbin/sshguard
Und dann neu starten:
/etc/rc.d/syslogd restart
Applikationen
Je nach Einsatz werden unterschiedliche Applikationen benötigt. Die Installation erfolgt für mich via portinstall mit den Optionen c (Konfiguration und P Folgende gehören für mich zu jeder FreeBSD-Installation:
- portinstall -cP portaudit && rehash && portaudit -dFa
- portinstall -cP bash
- portinstall -Pc phpMyAdmin
(Installiert Apache 2.2, PHP 5.3 inklusive Erweiterungen und MySQL 5.5 gleich mit) - portinstall -c anacron (für Rechner die nicht 24/7 laufen)
-
- Configuration hints:
- - Edit /usr/local/etc/anacrontab
- - Deactivate the 'periodic' commands in /etc/crontab
- - Add a call to anacron to /etc/crontab, like
- 0 0 * * * root /usr/local/sbin/anacron
- - Add anacron_enable="YES" to /etc/rc.conf
- - Read anacron(8) and anacrontab(5)