Ich werde folgende Software benutzen:
- Web Server: Apache 2.2
- Database Server: MySQL 5.0
- Mail Server: Postfix
- DNS Server: BIND9
- FTP Server: proftpd
- POP3/IMAP: Ich werde das Maildir-Format nutzen und deshalb Courier-POP3/Courier-IMAP installieren.
- Webalizer für Statistiken
downloaden (z.B. läuft ISPConfig sofort und ohne irgendwelche Änderungen!).Allerdings möchte ich an dieser Stelle darauf hinweisen, dass dies hier nicht der einzige Weg ist, ein solches System zu installieren. Es gibt viele Möglichkeiten – ich selbst habe mich für diese entschieden. Ich kann aber nicht garantieren, dass diese Lösung bei jedem funktioniert bzw. für jeden die richtige ist!
1 Voraussetzungen
Um dieses System zu installieren benötigt man:
- die Debian-Etch-Netinstall-CD (die Liste der Mirrors ist abrufbar unter
– Ich selbst habe diesen heruntergeladen:
). - eine schnelle Internetverbindung.
In dieser Installationsanleitung benutze ich den Hostnamen server1.example.com mit der IP-Adresse 192.168.0.100 und die Schnittstelle 192.168.0.1. Die Einstellungen können für jeden unterschiedlich sein, deshalb muss man sie gegebenenfalls anpassen.
3 Das Basissystem
Zuerst legt man die Debian-Etch-Netinstall-CD ein und bootet das System von dort. Um zu booten, muss man ENTER drücken:
Die Installation startet. Nun gibt man seinen Namen ein und wählt dann die Sprache aus:
Jetzt wählt man sein Land:
Nun wählt man das Tastatur-Layout:
Der Installer prüft Installations-CD und Hardware und konfiguriert das Netzwerk mit DHCP, wenn ein DHCP-Server vorhanden ist:
Nun gibt man den Hostnamen ein. In diesem Beispiel heißt mein System server1.example.com, deshalb gebe ich server1 ein:
Nun gibt man seinen Domainnamen ein. In diesem Beispiel also example.com:
Jetzt muss man seine Festplatte partitionieren. Der Einfachheit halber werde ich nur eine große Partition erstellen (mit dem Mount-Point /) und eine kleine Swap-Partition. Deshalb wähle ich Guided – use entire disk (natürlich bleibt jedem selbst überlassen, wie er partitioniert – wenn man möchte, kann man statt einer großen Partition auch mehrere erstellen oder LVM benutzen):
Nun wählt man die Festplatte, die man partitionieren möchte:
Dann wählt man das Partitionsschema. Wie bereits erwähnt, wähle ich hier der Einfachheit halber All files in one partition (recommended for new users). Jeder kann hier das wählen, was seinen Vorlieben entspricht:
Wenn man fertig ist wählt man: Finish partitioning and write changes to disk:
Dann: Yes, wenn Write changes to disks? erscheint:
Anschließend ist die neue Partition erstellt und formatiert:
Danch gibt man dem Root-User ein Passwort:
Nun bestätigt man das Passwort noch einmal, um Tippfehler zu vermeiden:
Jetzt legt man ein normales Benutzerkonto an, z. B. den Benutzer Administrator mit dem Benutzernamen administrator (auf keinen Fall den Benutzername admin verwenden – der ist ein reservierter Name auf Debian Etch!):
Nun wird das Basissystem installiert:
Als nächstes muss man apt konfigurieren. Da ich die Debian-Etch-Netinstall-CD benutze, die nur eine minimales Ausstattung an Paketen besitzt, muss man einen Netzwerk-Mirrow benutzen:
Nun wählt man das Land des gewünschten Netzwerk-Mirror aus, der einem am nächsten ist:
Jetzt wählt man den Mirror, den man benutzen möchte (z.B. ftp2.de.debian.org):
Sofern man nicht einen HTTP-Proxy verwendet, lässt man das folgende Feld leer und klickt auf Continue:
Apt aktualisiert nun die Paket-Datenbank:
Man kann die Paketnutzungsumfrage überspringen, indem man No wählt:
Eigentlich bräuchte man nun einen Web-Server, DNS-Server, Mail-Server und eine MySQL- Datenbank. Trotzdem wähle ich hier und jetzt nichts davon aus, weil ich die vollständige Kontrolle über das habe möchte, was auf mein System installiert wird. Ich werde die benötigten Pakete deshalb später manuell installieren.
Deshalb wähle ich jetzt Standard system und klicke auf Continue:
Die nötigen Pakete sind nun auf mein System installiert:
Wenn man gefragt wird Install the GRUB boot loader to the master boot record wählt man Yes:
Danach wird der GRUB-Boot-Loader installiert:
Dies Installation des Basissystems ist nun abgeschlossen. Jetzt entnimmt man die Debian-Etch-Netinstall-CD aus dem CD-Laufwerk und klickt auf Continue, um das System neu zu booten:
Auf geht’s zum nächsten Schritt…
4 Installation des SSH Servers
Debian Etch installiert OpenSSH nicht automatisch, deshalb werde ich dies nun manuell nachholen.
Man führt aus:
Code:
apt-get install ssh openssh-server
5 Konfiguration des Netzwerks
Da der Debian-Etch-Installer das System so konfiguriert hat, dass es seine Netzwerkeinstellungen via DHCP, muss man dies ändern, weil der Server eine statische IP-Adresse haben sollte. Man editiert /etc/network/interfaces und passt es an die eigenen Bedürfnisse an (in diesem Beispiel-Setup werde ich Die IP-Adresse 192.168.0.100 nutzen) (Achtung: Ich habe allow-hotplug eth0 gegen auto eth0 ausgetauscht – sonst würde der Neustart des Netzwerkes nicht funktionieren und das ganze System müsste neu gebootet werden!):
Code:
vi /etc/network/interfaces
Code:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
# The primary network interface
#allow-hotplug eth0
#iface eth0 inet dhcp
auto eth0
iface eth0 inet static
address 192.168.0.100
netmask 255.255.255.0
network 192.168.0.0
broadcast 192.168.0.255
gateway 192.168.0.1
Code:
/etc/init.d/networking restart
Code:
vi /etc/hosts
Code:
127.0.0.1 localhost.localdomain localhost 192.168.0.100 server1.example.com server1 # The following lines are desirable for IPv6 capable hosts ::1 ip6-localhost ip6-loopback fe00::0 ip6-localnet ff00::0 ip6-mcastprefix ff02::1 ip6-allnodes ff02::2 ip6-allrouters ff02::3 ip6-allhosts
Code:
echo server1.example.com > /etc/hostname
Code:
shutdown -r now
Code:
hostname hostname -f
Von jetzt an kann man einen SSH-Client wie
nutzen und ihn vom Arbeitsplatz-Rechner mit dem Debian-Etch-Server verbinden. Dann weiter dieser Anleitung mit den restlichen Schritten folgen.6 Editieren von /etc/apt/sources.list und Aktualisiern der Linux Installation
Nun editiert man /etc/apt/sources.list. und kommentiert die CD-Zeile aus (# einfügen). Es sollte dann so aussehen:
Code:
vi /etc/apt/sources.list
Code:
# # deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official i386 NETINST Binary-1 20070407-11:29]/ etch contrib main #deb cdrom:[Debian GNU/Linux 4.0 r0 _Etch_ - Official i386 NETINST Binary-1 20070407-11:29]/ etch contrib main deb http://ftp2.de.debian.org/debian/ etch main deb-src http://ftp2.de.debian.org/debian/ etch main deb http://security.debian.org/ etch/updates main contrib deb-src http://security.debian.org/ etch/updates main contrib
Code:
apt-get update
Code:
apt-get upgrade
7 Installieren von Software
Jetzt installiere ich einige Software-Pakete, die später gebraucht werden. Folgenden Befehl ausführen:
Code:
apt-get install binutils cpp fetchmail flex gcc libarchive-zip-perl libc6-dev libcompress-zlib-perl libdb4.3-dev libpcre3 libpopt-dev linux-kernel-headers lynx m4 make ncftp nmap openssl perl perl-modules unzip zip zlib1g-dev autoconf automake1.9 libtool bison autotools-dev g++
8 Quota
Achtung: Wenn man ein anderes Partitionsschema gewählt hat als ich, muss man dieses Kapitel entsprechend anpassen, damit die Quota für diese Partition stimmt.
Um die Quota zu installieren, führt man zunächst diesen Befehl aus:
Code:
apt-get install quota
Code:
vi /etc/fstab
Code:
# /etc/fstab: static file system information. # # <file system> <mount point> <type> <options> <dump> <pass> proc /proc proc defaults 0 0 /dev/sda1 / ext3 defaults,errors=remount-ro,usrquota,grpquota 0 1 /dev/sda5 none swap sw 0 0 /dev/hdc /media/cdrom0 udf,iso9660 user,noauto 0 0 /dev/fd0 /media/floppy0 auto rw,user,noauto 0 0
Code:
touch /quota.user /quota.group chmod 600 /quota.* mount -o remount / quotacheck -avugm quotaon -avug
9 DNS Server
Den Befehl ausführen:
Code:
apt-get install bind9
Code:
/etc/init.d/bind9 stop
Code:
vi /etc/default/bind9
Code:
OPTIONS="-u bind -t /var/lib/named" # Set RESOLVCONF=no to not run resolvconf RESOLVCONF=yes
Code:
mkdir -p /var/lib/named/etc mkdir /var/lib/named/dev mkdir -p /var/lib/named/var/cache/bind mkdir -p /var/lib/named/var/run/bind/run
Code:
mv /etc/bind /var/lib/named/etc
Code:
ln -s /var/lib/named/etc/bind /etc/bind
Code:
mknod /var/lib/named/dev/null c 1 3 mknod /var/lib/named/dev/random c 1 8 chmod 666 /var/lib/named/dev/null /var/lib/named/dev/random chown -R bind:bind /var/lib/named/var/* chown -R bind:bind /var/lib/named/etc/bind
Code:
vi /etc/default/syslogd
Code:
# # Top configuration file for syslogd # # # Full documentation of possible arguments are found in the manpage # syslogd(8). # # # For remote UDP logging use SYSLOGD="-r" # SYSLOGD="-a /var/lib/named/dev/log"
Code:
/etc/init.d/sysklogd restart
Code:
/etc/init.d/bind9 start
10 MySQL
Um MySQL zu installieren muss man Folgendes ausführen:
Code:
apt-get install mysql-server mysql-client libmysqlclient15-dev
Code:
vi /etc/mysql/my.cnf
Code:
[...] #bind-address = 127.0.0.1 [...]
Code:
/etc/init.d/mysql restart
Code:
netstat -tap
tcp 0 0 *:mysql *:* LISTEN 3281/mysqld
Nun:
Code:
mysqladmin -u root password yourrootsqlpassword mysqladmin -h server1.example.com -u root password yourrootsqlpassword
11 Postfix mit SMTP-AUTH und TLS
Um Postfix mit SMTP-AUTH und TLS zu installieren, sind folgende Schritte nötig:
Code:
apt-get install postfix libsasl2 sasl2-bin libsasl2-modules libdb3-util procmail
General type of configuration? <– Internet Site
Mail name? <– server1.example.com
Dann das ausführen:
Code:
dpkg-reconfigure postfix
General type of configuration? <– Internet Site
Where should mail for root go <– [blank]
Mail name? <– server1.example.com
Other destinations to accept mail for? (blank for none) <– server1.example.com, localhost.example.com, localhost.localdomain, localhost
Force synchronous updates on mail queue? <– No
Local networks? <– 127.0.0.0/8
Use procmail for local delivery? <– Yes
Mailbox size limit <– 0
Local address extension character? <– +
Internet protocols to use? <– all
Als nächstes dieses eingeben:
Code:
postconf -e ’smtpd_sasl_local_domain =’ postconf -e ’smtpd_sasl_auth_enable = yes’ postconf -e ’smtpd_sasl_security_options = noanonymous’ postconf -e ‘broken_sasl_auth_clients = yes’ postconf -e ’smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination’ postconf -e ‘inet_interfaces = all’ echo ‘pwcheck_method: saslauthd’ >> /etc/postfix/sasl/smtpd.conf echo ‘mech_list: plain login’ >> /etc/postfix/sasl/smtpd.conf
Code:
mkdir /etc/postfix/ssl cd /etc/postfix/ssl/ openssl genrsa -des3 -rand /etc/hosts -out smtpd.key 1024 chmod 600 smtpd.key openssl req -new -key smtpd.key -out smtpd.csr openssl x509 -req -days 3650 -in smtpd.csr -signkey smtpd.key -out smtpd.crt openssl rsa -in smtpd.key -out smtpd.key.unencrypted mv -f smtpd.key.unencrypted smtpd.key openssl req -new -x509 -extensions v3_ca -keyout cakey.pem -out cacert.pem -days 3650
Code:
postconf -e ’smtpd_tls_auth_only = no’ postconf -e ’smtp_use_tls = yes’ postconf -e ’smtpd_use_tls = yes’ postconf -e ’smtp_tls_note_starttls_offer = yes’ postconf -e ’smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key’ postconf -e ’smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt’ postconf -e ’smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem’ postconf -e ’smtpd_tls_loglevel = 1′ postconf -e ’smtpd_tls_received_header = yes’ postconf -e ’smtpd_tls_session_cache_timeout = 3600s’ postconf -e ‘tls_random_source = dev:/dev/urandom’ postconf -e ‘myhostname = server1.example.com’
Code:
cat /etc/postfix/main.cf
Code:
# See /usr/share/postfix/main.cf.dist for a commented, more complete version
# Debian specific: Specifying a file name will cause the first
# line of that file to be used as the name. The Debian default
# is /etc/mailname.
#myorigin = /etc/mailname
smtpd_banner = $myhostname ESMTP $mail_name (Debian/GNU)
biff = no
# appending .domain is the MUA's job.
append_dot_mydomain = no
# Uncomment the next line to generate "delayed mail" warnings
#delay_warning_time = 4h
# TLS parameters
smtpd_tls_cert_file = /etc/postfix/ssl/smtpd.crt
smtpd_tls_key_file = /etc/postfix/ssl/smtpd.key
smtpd_use_tls = yes
smtpd_tls_session_cache_database = btree:${queue_directory}/smtpd_scache
smtp_tls_session_cache_database = btree:${queue_directory}/smtp_scache
# See /usr/share/doc/postfix/TLS_README.gz in the postfix-doc package for
# information on enabling SSL in the smtp client.
myhostname = server1.example.com
alias_maps = hash:/etc/aliases
alias_database = hash:/etc/aliases
myorigin = /etc/mailname
mydestination = server1.example.com, localhost.example.com, localhost.localdomain, localhost
relayhost =
mynetworks = 127.0.0.0/8
mailbox_command = procmail -a "$EXTENSION"
mailbox_size_limit = 0
recipient_delimiter = +
inet_interfaces = all
inet_protocols = all
smtpd_sasl_local_domain =
smtpd_sasl_auth_enable = yes
smtpd_sasl_security_options = noanonymous
broken_sasl_auth_clients = yes
smtpd_recipient_restrictions = permit_sasl_authenticated,permit_mynetworks,reject_unauth_destination
smtpd_tls_auth_only = no
smtp_use_tls = yes
smtp_tls_note_starttls_offer = yes
smtpd_tls_CAfile = /etc/postfix/ssl/cacert.pem
smtpd_tls_loglevel = 1
smtpd_tls_received_header = yes
smtpd_tls_session_cache_timeout = 3600s
tls_random_source = dev:/dev/urandom
Code:
/etc/init.d/postfix restart
Code:
mkdir -p /var/spool/postfix/var/run/saslauthd
Code:
vi /etc/default/saslauthd
Code:
# # Settings for saslauthd daemon # # Should saslauthd run automatically on startup? (default: no) START=yes # Which authentication mechanisms should saslauthd use? (default: pam) # # Available options in this Debian package: # getpwent -- use the getpwent() library function # kerberos5 -- use Kerberos 5 # pam -- use PAM # rimap -- use a remote IMAP server # shadow -- use the local shadow password file # sasldb -- use the local sasldb database file # ldap -- use LDAP (configuration is in /etc/saslauthd.conf) # # Only one option may be used at a time. See the saslauthd man page # for more information. # # Example: MECHANISMS="pam" MECHANISMS="pam" # Additional options for this mechanism. (default: none) # See the saslauthd man page for information about mech-specific options. MECH_OPTIONS="" # How many saslauthd processes should we run? (default: 5) # A value of 0 will fork a new process for each connection. THREADS=5 # Other options (default: -c) # See the saslauthd man page for information about these options. # # Example for postfix users: "-c -m /var/spool/postfix/var/run/saslauthd" # Note: See /usr/share/doc/sasl2-bin/README.Debian OPTIONS="-c -m /var/spool/postfix/var/run/saslauthd -r"
Code:
/etc/init.d/saslauthd start
Code:
telnet localhost 25
Code:
ehlo localhost
250-STARTTLS
und
250-AUTH PLAIN LOGIN
sieht hat alles geklappt!
Die Anzeige auf meinem System sah so aus:
server1:/etc/postfix/ssl# telnet localhost 25
Trying 127.0.0.1…
Connected to localhost.localdomain.
Escape character is ‘^]’.
220 server1.example.com ESMTP Postfix (Debian/GNU)
ehlo localhost
250-server1.example.com
250-PIPELINING
250-SIZE 10240000
250-VRFY
250-ETRN
250-STARTTLS
250-AUTH PLAIN LOGIN
250-AUTH=PLAIN LOGIN
250-ENHANCEDSTATUSCODES
250-8BITMIME
250 DSN
quit
221 2.0.0 Bye
Connection closed by foreign host.
Jetzt
Code:
quit
12 Courier-IMAP/Courier-POP3
Für die Installation von Courier-IMAP/Courier-IMAP-SSL (für IMAPs auf dem Port 993) und Courier-POP3/Courier-POP3-SSL (für POP3s auf dem Port 995) sind folgende Eingaben nötig:
Code:
apt-get install courier-authdaemon courier-base courier-imap courier-imap-ssl courier-pop courier-pop-ssl courier-ssl gamin libgamin0 libglib2.0-0
Create directories for web-based administration ? <– No
SSL certificate required <– Ok
Wenn man ISPConfig nicht benutzen möchte, konfiguriert man Postfix, um die Emails an ein Email-Verzeichnis des Benutzers umzuleiten*:
Code:
postconf -e ‘home_mailbox = Maildir/’ postconf -e ‘mailbox_command =’ /etc/init.d/postfix restart
auf seinem System nutzen möchte – ISPConfig führt die nötige Konfiguration selbst aus, in dem es Procmail-Rezepte nutzt. Man sollte vorher sichergehen, dass Maildir aktiviert ist und zwar unter Management -> Server -> Settings -> EMail im ISPConfig-Web-Interface.13 Apache/PHP5
Jetzt wird Apache installiert:
Code:
apt-get install apache2 apache2-doc apache2-mpm-prefork apache2-utils libexpat1 ssl-cert
Code:
apt-get install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-idn php-pear php5-imagick php5-imap php5-json php5-mcrypt php5-memcache php5-mhash php5-ming php5-mysql php5-ps php5-pspell php5-recode php5-snmp php5-sqlite php5-tidy php5-xmlrpc php5-xsl
Es erscheint folgende Frage:
Continue installing libc-client without Maildir support? <– Yes
Nun editiert man /etc/apache2/mods-available/dir.conf:
Code:
vi /etc/apache2/mods-available/dir.conf
Code:
<IfModule mod_dir.c>
DirectoryIndex index.html index.htm index.shtml index.cgi index.php index.php3 index.pl index.xhtml
</IfModule> Nun /etc/apache2/ports.conf
Code:
vi /etc/apache2/ports.conf
Code:
Listen 80 Listen 443
Code:
a2enmod ssl a2enmod rewrite a2enmod suexec a2enmod include
Code:
/etc/init.d/apache2 force-reload
(Wenn man ISPConfig nicht auf dem Server installieren möchte, kann man diesen Abschnitt überspringen!)
Mit ISPConfig kann man PHP auf jeder einzelnen Website konfigurieren, d.h. man kann genau festlegen, welche Website mit PHP und welche ohne konfiguriert wird. Dies funktioniert nur, wenn PHP zunächst generell deaktiviert wird. Sonst würden alle Websites mit PHP ausgeführt werden – ungeachtet der zuvor spezifizierten Eingaben in der ISPConfig .
Um PHP ganz zu deaktiviern, editiert man /etc/mime.types und kommentiert die Zeile application/x-httpd-php aus:
Code:
vi /etc/mime.types
Code:
[...] #application/x-httpd-php phtml pht php #application/x-httpd-php-source phps #application/x-httpd-php3 php3 #application/x-httpd-php3-preprocessed php3p #application/x-httpd-php4 php4 [...]
Code:
vi /etc/apache2/mods-enabled/php5.conf
Code:
<IfModule mod_php5.c> # AddType application/x-httpd-php .php .phtml .php3 # AddType application/x-httpd-php-source .phps </IfModule>
Code:
/etc/init.d/apache2 restart
Um Proftpd zu installieren, dies ausführen:
Code:
apt-get install proftpd ucf
Run proftpd from inetd or standalone? <– standalone
Jetzt /etc/proftpd/proftpd.conf öffnen und UseIPv6 von on in off ändern – sonst erhält man eine Warnmeldung wie diese, sobald man Proftpd startet:
- IPv6 getaddrinfo ’server1.example.com’ error: Name or service not known
Code:
vi /etc/proftpd/proftpd.conf
Code:
[...] UseIPv6 off [...]
):Code:
vi /etc/proftpd/proftpd.conf
Code:
[...] DefaultRoot ~ IdentLookups off ServerIdent on "FTP Server ready." [...]
Code:
ln -s /etc/proftpd/proftpd.conf /etc/proftpd.conf
Code:
/etc/init.d/proftpd restart
Um webalizer zu installieren, jetzt dies ausführen:
Code:
apt-get install webalizer
Es ist gut, die Systemuhr über das Internet mit einem NTP-Server (Network Time Protocol) abzugleichen. Dafür dies ausführen:
Code:
apt-get install ntp ntpdate
17 Installation von Perl-Modulen für SpamAssassin (Mit ISPConfig)
Das ausführen:
Code:
apt-get install libhtml-parser-perl libdb-file-lock-perl libnet-dns-perl
Jetzt ist die Konfiguration auf dem Server abgeschlossen – wenn man möchte, kann man
nun installieren. Hierfür sollte man die ISPConfig-Installationsanleitung beachten – siehe: 
18.1 Anmerkung zu SuExec
Möchte man CGI-Scripts unter suExec ausführen, sollte man /var/www als Grundverzeichnis für Websites spezifizieren, die von ISPConfig erstellt werden und als Debian-suExec mit dem Pfad /var/www als Doc_Root kompiliert sind. Erst dies ausführen:
Code:
/usr/lib/apache2/suexec -V
server1:/etc/postfix/ssl# /usr/lib/apache2/suexec -V
-D AP_DOC_ROOT=”/var/www”
-D AP_GID_MIN=100
-D AP_HTTPD_USER=”www-data”
-D AP_LOG_EXEC=”/var/log/apache2/suexec.log”
-D AP_SAFE_PATH=”/usr/local/bin:/usr/bin:/bin”
-D AP_UID_MIN=100
-D AP_USERDIR_SUFFIX=”public_html”
Sofern man ISPConfig nicht im Expertmodus installiert und den voreingestellten Web-Root (der /var/www lautet) verändert, kann man CGI-Scripts unter suExec mit ISPConfig ausführen. Der nächste Screenshot zeigt eine ISPConfig-Installation im Expertenmodus. Wenn man ISPConfig verwenden möchte, darf man den voreingestellten Web-Root nicht ändern
:
Version 1.0
Autor: Falko Timme <ft [at] falkotimme [dot] com>
Stand: 09.04.2007
Quelle:






