FreeBSD ➔ BaseTools


Writing Icon

Lizenz: Attribution-NonCommercial-ShareAlike 4.0 International (CC BY-NC-SA 4.0)
Letzte Aktualisierung:
Veröffentlicht:
Verfasser: Markus Kohlmeyer
Beitragender: Jesco Freund
Beitragender: Eckhard Doll
Beitragender: Olaf Uecker


In diesem HowTo beschreibe ich step-by-step die Installation einiger Tools (Ports / Packages / Pakete) welche auf keinem FreeBSD 64Bit BaseSystem auf einem dedizierten Server, auch RootServer genannt, fehlen sollten.

Zu den Voraussetzungen für dieses HowTo siehe bitte: FreeBSD ➔ Remote Installation ➔ Voraussetzungen

Einleitung

Unsere BaseTools werden am Ende folgende Dienste umfassen.

  • Portupgrade 2.4.16
  • Portmaster 3.19
  • Nano 2.9.6
  • cURL 7.59.0
  • Bash 4.4.19
  • w3m 0.5.3
  • SVN 1.10.0
  • GIT 2.17.0
  • SMARTmontools 6.6

Einloggen und zu root werden

putty -ssh -P 2222 -i "%USERPROFILE%\VirtualBox VMs\FreeBSD\ssh\id_rsa.ppk" admin@127.0.0.1

su - root

Software installieren

Wir installieren ftp/curl und dessen Abhängigkeiten.

mkdir -p /var/db/ports/dns_libpsl
cat > /var/db/ports/dns_libpsl/options << "EOF"
_OPTIONS_READ=libpsl-0.20.2
_FILE_COMPLETE_OPTIONS_LIST=ICU IDN IDN2
OPTIONS_FILE_SET+=ICU
OPTIONS_FILE_UNSET+=IDN
OPTIONS_FILE_UNSET+=IDN2
"EOF"

mkdir -p /var/db/ports/misc_libmetalink
cat > /var/db/ports/misc_libmetalink/options << "EOF"
_OPTIONS_READ=libmetalink-0.1.3
_FILE_COMPLETE_OPTIONS_LIST=EXPAT LIBXML2
OPTIONS_FILE_UNSET+=EXPAT
OPTIONS_FILE_SET+=LIBXML2
"EOF"

mkdir -p /var/db/ports/security_libssh2
cat > /var/db/ports/security_libssh2/options << "EOF"
_OPTIONS_READ=libssh2-1.8.0
_FILE_COMPLETE_OPTIONS_LIST=GCRYPT TRACE ZLIB
OPTIONS_FILE_UNSET+=GCRYPT
OPTIONS_FILE_UNSET+=TRACE
OPTIONS_FILE_SET+=ZLIB
"EOF"

mkdir -p /var/db/ports/textproc_libxml2
cat > /var/db/ports/textproc_libxml2/options << "EOF"
_OPTIONS_READ=libxml2-2.9.7
_FILE_COMPLETE_OPTIONS_LIST=MEM_DEBUG SCHEMA THREAD_ALLOC VALID XMLLINT_HIST
OPTIONS_FILE_UNSET+=MEM_DEBUG
OPTIONS_FILE_SET+=SCHEMA
OPTIONS_FILE_UNSET+=THREAD_ALLOC
OPTIONS_FILE_SET+=VALID
OPTIONS_FILE_UNSET+=XMLLINT_HIST
"EOF"

mkdir -p /var/db/ports/textproc_libxslt
cat > /var/db/ports/textproc_libxslt/options << "EOF"
_OPTIONS_READ=libxslt-1.1.32
_FILE_COMPLETE_OPTIONS_LIST=MEM_DEBUG
OPTIONS_FILE_UNSET+=MEM_DEBUG
"EOF"

mkdir -p /var/db/ports/ftp_curl
cat > /var/db/ports/ftp_curl/options << "EOF"
_OPTIONS_READ=curl-7.59.0
_FILE_COMPLETE_OPTIONS_LIST=BROTLI CA_BUNDLE COOKIES CURL_DEBUG IDN METALINK PROXY PSL TLS_SRP CARES THREADED_RESOLVER GNUTLS NSS POLARSSL WOLFSSL DICT FTP GOPHER HTTP HTTP2 IMAP LDAP LDAPS LIBSSH2 POP3 RTMP RTSP SMB SMTP TELNET TFTP
OPTIONS_FILE_SET+=BROTLI
OPTIONS_FILE_SET+=CA_BUNDLE
OPTIONS_FILE_SET+=COOKIES
OPTIONS_FILE_UNSET+=CURL_DEBUG
OPTIONS_FILE_SET+=IDN
OPTIONS_FILE_SET+=METALINK
OPTIONS_FILE_SET+=PROXY
OPTIONS_FILE_SET+=PSL
OPTIONS_FILE_UNSET+=TLS_SRP
OPTIONS_FILE_UNSET+=CARES
OPTIONS_FILE_SET+=THREADED_RESOLVER
OPTIONS_FILE_UNSET+=GNUTLS
OPTIONS_FILE_UNSET+=NSS
OPTIONS_FILE_UNSET+=POLARSSL
OPTIONS_FILE_UNSET+=WOLFSSL
OPTIONS_FILE_UNSET+=DICT
OPTIONS_FILE_SET+=FTP
OPTIONS_FILE_UNSET+=GOPHER
OPTIONS_FILE_SET+=HTTP
OPTIONS_FILE_SET+=HTTP2
OPTIONS_FILE_SET+=IMAP
OPTIONS_FILE_UNSET+=LDAP
OPTIONS_FILE_UNSET+=LDAPS
OPTIONS_FILE_SET+=LIBSSH2
OPTIONS_FILE_SET+=POP3
OPTIONS_FILE_UNSET+=RTMP
OPTIONS_FILE_SET+=RTSP
OPTIONS_FILE_UNSET+=SMB
OPTIONS_FILE_SET+=SMTP
OPTIONS_FILE_UNSET+=TELNET
OPTIONS_FILE_UNSET+=TFTP
"EOF"

cd /usr/ports/ftp/curl
make config-recursive all install clean-depends clean

Wir installieren ports-mgmt/portupgrade und dessen Abhängigkeiten.

cd /usr/ports/ports-mgmt/portupgrade
make config-recursive all install clean-depends clean

Wir konfigurieren portupgrade.

cat > /usr/local/etc/pkgtools.conf << "EOF"
# -*- ruby -*-
#
# pkgtools.conf - the configuration file for the pkgtools suite
#
module PkgConfig
  ENV['PORTSDIR'] ||= '/usr/ports'
  ENV['PACKAGES'] ||= ENV['PORTSDIR'] + '/packages'
  ENV['PKG_PATH'] ||= ENV['PACKAGES'] + '/All'
  ENV['PKG_BACKUP_DIR'] ||= ENV['PKG_PATH']
  SANITY_CHECK = true
  IGNORE_CATEGORIES = [
    'arabic',
    'chinese',
    'french',
    'german',
    'hebrew',
    'hungarian',
    'japanese',
    'korean',
    'polish',
    'portuguese',
    'russian',
    'ukrainian',
    'vietnamese',
  ]
  EXTRA_CATEGORIES = [
  ]
  ALT_INDEX = [
  ]
  ALT_MOVED = [
  ]
  HOLD_PKGS = [
  ]
  IGNORE_MOVED = [
  ]
  USE_PKGS = [
  ]
  USE_PKGS_ONLY = [
  ]
  USE_PORTS_ONLY = [
    '*',
  ]
  ALT_PKGDEP = {
    'editors/emacs' => 'editors/emacs-nox11',
    'editors/vim' => 'editors/vim-lite',
    'emulators/open-vm-tools' => 'emulators/open-vm-tools-nox11',
    'emulators/virtualbox-ose' => 'emulators/virtualbox-ose-nox11',
    'emulators/virtualbox-ose-additions' => 'emulators/virtualbox-ose-additions-nox11',
    'games/freeciv' => 'games/freeciv-nox11',
    'games/nethack33' => 'games/nethack33-nox11',
    'games/nethack34' => 'games/nethack34-nox11',
    'games/nethack36' => 'games/nethack36-nox11',
    'graphics/ImageMagick' => 'graphics/ImageMagick-nox11',
    'graphics/ImageMagick7' => 'graphics/ImageMagick7-nox11',
    'graphics/libwmf' => 'graphics/libwmf-nox11',
    'lang/ocaml' => 'lang/ocaml-nox11',
    'math/ploticus' => 'math/ploticus-nox11',
    'net-p2p/qbittorrent' => 'net-p2p/qbittorrent-nox11',
    'net-p2p/zetacoin' => 'net-p2p/zetacoin-nox11',
    'net/mtr' => 'net/mtr-nox11',
    'net/unison' => 'net/unison-nox11',
    'print/ghostscript7-x11' => 'print/ghostscript7-base',
    'print/ghostscript8-x11' => 'print/ghostscript8-base',
    'print/ghostscript9-x11' => 'print/ghostscript9-agpl-base',
    'print/ghostscript9-base' => 'print/ghostscript9-agpl-base',
    'print/ghostscript9-agpl-x11' => 'print/ghostscript9-agpl-base',
  }
  MAKE_ARGS = {
  }
  MAKE_ENV = {
  }
  BEFOREBUILD = {
  }
  BEFOREDEINSTALL = {
  }
  AFTERINSTALL = {
  }
  PKG_SITES = [
    pkg_site_mirror(),
  ]
  PORTUPGRADE_ARGS = ENV['PORTUPGRADE'] || '-v -c -k -u -r -D -l /var/tmp/portupgrade.results -L /var/tmp/portupgrade-%s::%s.log'
end
"EOF"

Wir installieren ports-mgmt/portmaster und dessen Abhängigkeiten.

mkdir -p /var/db/ports/ports-mgmt_portmaster
cat > /var/db/ports/ports-mgmt_portmaster/options << "EOF"
_OPTIONS_READ=portmaster-3.19
_FILE_COMPLETE_OPTIONS_LIST=BASH ZSH
OPTIONS_FILE_UNSET+=BASH
OPTIONS_FILE_UNSET+=ZSH
"EOF"

cd /usr/ports/ports-mgmt/portmaster
make config-recursive all install clean-depends clean

Wir installieren sysutils/smartmontools und dessen Abhängigkeiten.

cd /usr/ports/sysutils/smartmontools
make config-recursive all install clean-depends clean

Wir konfigurieren smartmontools.

sed 's/^DEVICESCAN/#DEVICESCAN/' /usr/local/etc/smartd.conf.sample > /usr/local/etc/smartd.conf
echo '/dev/ada0 -a -o on -S on -s (S/../.././02|L/../../6/03)' >> /usr/local/etc/smartd.conf
echo '/dev/ada1 -a -o on -S on -s (S/../.././02|L/../../6/03)' >> /usr/local/etc/smartd.conf
echo 'smartd_enable="YES"' >> /etc/rc.conf

Die /etc/periodic.conf wird um folgenden Inhalt erweitert.

cat >> /etc/periodic.conf << "EOF"
daily_status_smart_enable="YES"
daily_status_smart_devices="/dev/ada0 /dev/ada1"
"EOF"

Wir installieren shells/bash und dessen Abhängigkeiten.

mkdir -p /var/db/ports/shells_bash
cat > /var/db/ports/shells_bash/options << "EOF"
_OPTIONS_READ=bash-4.4.19
_FILE_COMPLETE_OPTIONS_LIST=COLONBREAKSWORDS FDESCFS HELP STATIC SYSBASHRC SYSLOG
OPTIONS_FILE_SET+=COLONBREAKSWORDS
OPTIONS_FILE_SET+=FDESCFS
OPTIONS_FILE_SET+=HELP
OPTIONS_FILE_UNSET+=STATIC
OPTIONS_FILE_UNSET+=SYSBASHRC
OPTIONS_FILE_UNSET+=SYSLOG
"EOF"

cd /usr/ports/shells/bash
make config-recursive all install clean-depends clean

Wir installieren editors/nano und dessen Abhängigkeiten.

cd /usr/ports/editors/nano
make config-recursive all install clean-depends clean

Wir installieren www/w3m und dessen Abhängigkeiten.

mkdir -p /var/db/ports/www_w3m
cat > /var/db/ports/www_w3m/options << "EOF"
_OPTIONS_READ=w3m-0.5.3.20180125
_FILE_COMPLETE_OPTIONS_LIST=INLINE_IMAGE JAPANESE KEY_LYNX
OPTIONS_FILE_UNSET+=INLINE_IMAGE
OPTIONS_FILE_UNSET+=JAPANESE
OPTIONS_FILE_UNSET+=KEY_LYNX
"EOF"

cd /usr/ports/www/w3m
make config-recursive all install clean-depends clean

Wir installieren devel/subversion und dessen Abhängigkeiten.

mkdir -p /var/db/ports/www_serf
cat > /var/db/ports/www_serf/options << "EOF"
_OPTIONS_READ=serf-1.3.9
_FILE_COMPLETE_OPTIONS_LIST=MIT HEIMDAL HEIMDAL_BASE
OPTIONS_FILE_UNSET+=MIT
OPTIONS_FILE_UNSET+=HEIMDAL
OPTIONS_FILE_UNSET+=HEIMDAL_BASE
"EOF"

mkdir -p /var/db/ports/devel_apr1
cat > /var/db/ports/devel_apr1/options << "EOF"
_OPTIONS_READ=apr-1.6.3.1.6.1
_FILE_COMPLETE_OPTIONS_LIST=SSL NSS BDB GDBM LDAP MYSQL NDBM ODBC PGSQL SQLITE
OPTIONS_FILE_SET+=SSL
OPTIONS_FILE_UNSET+=NSS
OPTIONS_FILE_SET+=BDB
OPTIONS_FILE_SET+=GDBM
OPTIONS_FILE_UNSET+=LDAP
OPTIONS_FILE_UNSET+=MYSQL
OPTIONS_FILE_UNSET+=NDBM
OPTIONS_FILE_UNSET+=ODBC
OPTIONS_FILE_UNSET+=PGSQL
OPTIONS_FILE_UNSET+=SQLITE
"EOF"

mkdir -p /var/db/ports/devel_subversion
cat > /var/db/ports/devel_subversion/options << "EOF"
_OPTIONS_READ=subversion-1.10.0
_FILE_COMPLETE_OPTIONS_LIST=BDB FREEBSD_TEMPLATE GPG_AGENT MAINTAINER_DEBUG SASL SERF STATIC SVNSERVE_WRAPPER TOOLS
OPTIONS_FILE_UNSET+=BDB
OPTIONS_FILE_SET+=FREEBSD_TEMPLATE
OPTIONS_FILE_UNSET+=GPG_AGENT
OPTIONS_FILE_UNSET+=MAINTAINER_DEBUG
OPTIONS_FILE_UNSET+=SASL
OPTIONS_FILE_SET+=SERF
OPTIONS_FILE_UNSET+=STATIC
OPTIONS_FILE_SET+=SVNSERVE_WRAPPER
OPTIONS_FILE_UNSET+=TOOLS
"EOF"

cd /usr/ports/devel/subversion
make config-recursive all install clean-depends clean

Wir installieren devel/git und dessen Abhängigkeiten.

mkdir -p /var/db/ports/textproc_docbook-xsl
cat > /var/db/ports/textproc_docbook-xsl/options << "EOF"
_OPTIONS_READ=docbook-xsl-1.76.1
_FILE_COMPLETE_OPTIONS_LIST=ECLIPSE EPUB EXTENSIONS HIGHLIGHTING HTMLHELP JAVAHELP PROFILING ROUNDTRIP SLIDES TEMPLATE TOOLS WEBSITE XHTML11
OPTIONS_FILE_SET+=ECLIPSE
OPTIONS_FILE_SET+=EPUB
OPTIONS_FILE_SET+=EXTENSIONS
OPTIONS_FILE_SET+=HIGHLIGHTING
OPTIONS_FILE_SET+=HTMLHELP
OPTIONS_FILE_SET+=JAVAHELP
OPTIONS_FILE_SET+=PROFILING
OPTIONS_FILE_SET+=ROUNDTRIP
OPTIONS_FILE_SET+=SLIDES
OPTIONS_FILE_SET+=TEMPLATE
OPTIONS_FILE_SET+=TOOLS
OPTIONS_FILE_SET+=WEBSITE
OPTIONS_FILE_SET+=XHTML11
"EOF"

mkdir -p /var/db/ports/textproc_xmlto
cat > /var/db/ports/textproc_xmlto/options << "EOF"
_OPTIONS_READ=xmlto-0.0.28
_FILE_COMPLETE_OPTIONS_LIST=DBLATEX FOP PASSIVETEX
OPTIONS_FILE_UNSET+=DBLATEX
OPTIONS_FILE_UNSET+=FOP
OPTIONS_FILE_UNSET+=PASSIVETEX
"EOF"

mkdir -p /var/db/ports/devel_git
cat > /var/db/ports/devel_git/options << "EOF"
_OPTIONS_READ=git-2.17.0
_FILE_COMPLETE_OPTIONS_LIST=CONTRIB CURL CVS GITWEB GUI HTMLDOCS ICONV P4 PCRE PERL SEND_EMAIL SUBTREE SVN
OPTIONS_FILE_SET+=CONTRIB
OPTIONS_FILE_SET+=CURL
OPTIONS_FILE_SET+=CVS
OPTIONS_FILE_UNSET+=GITWEB
OPTIONS_FILE_UNSET+=GUI
OPTIONS_FILE_UNSET+=HTMLDOCS
OPTIONS_FILE_SET+=ICONV
OPTIONS_FILE_SET+=P4
OPTIONS_FILE_SET+=PCRE
OPTIONS_FILE_SET+=PERL
OPTIONS_FILE_SET+=SEND_EMAIL
OPTIONS_FILE_SET+=SUBTREE
OPTIONS_FILE_SET+=SVN
"EOF"

cd /usr/ports/devel/git
make config-recursive all install clean-depends clean

Wenn wir ein Programm nicht kennen, dann finden wir zu jedem Port eine Datei pkg-descr, die eine kurze Beschreibung sowie (meistens) einen Link zur Projekt-Homepage der Software enthält. Für smartmontools zum Beispiel würden wir die Beschreibung unter /usr/ports/sysutils/smartmontools/pkg-descr finden.

Software updaten

WICHTIG: Da wir die Pakete/Ports nicht als vorkompilierte Binary-Pakete installieren sondern selbst kompilieren, müssen wir natürlich auch die Updates der Ports selbst kompilieren. Um uns das dazu notwendige Auflösen der Abhängigkeiten und etwas Tipparbeit zu ersparen, überlassen wir dies künftig einfach einem kleinen Shell-Script. Dieses Script können wir einfach mittels update-ports ausführen und es erledigt dann folgende Arbeiten für uns:

  • Aktualisieren des Portstree mittels portsnap
  • Anzeigen neuer Einträge in /usr/ports/UPDATING
  • Ermitteln der zu aktualisierenden Ports und deren Abhängigkeiten
  • Aktualisieren der Ports und Abhängigkeiten mittels
  • Aufräumen des Portstree und der Distfiles mittels
cat > /usr/local/sbin/update-ports << "EOF"
#!/bin/sh

portsnap fetch update

printf "\v================================================================================\v\n"

pkg updating -d `date -u -v-3m "+%Y%m%d"`

printf "\v================================================================================\v\n"

read -p "Update ports now? [y/N] " REPLY

if [ "x$REPLY" != "xy" ]
then
  exit 0
fi

pkg check -Ba -da -sa -ra

portsdb -Fu

portmaster --no-confirm --no-term-title --index-first -d -w -a -y

portmaster --no-confirm --no-term-title --index-first --clean-distfiles -y

portmaster --no-confirm --no-term-title --index-first --clean-packages -y

portmaster --no-confirm --no-term-title --index-first --check-depends -y

portmaster --no-confirm --no-term-title --check-port-dbdir -y

portsclean -CDDL
"EOF"

chmod 0755 /usr/local/sbin/update-ports

Wie geht es weiter?

Viel Spass mit den neuen FreeBSD BaseTools.


Über den Autor