Der perfekte Server – CentOS 6.0 x86_64 [ISPConfig 3]
11 Installation von Postfix
Postfix lässt sich wie folgt installieren:
yum install postfix
Deaktivieren Sie dann Sendmail und starten Sie Postfix und MySQL:
chkconfig –levels 235 mysqld on
/etc/init.d/mysqld start
chkconfig –levels 235 sendmail off
chkconfig –levels 235 postfix on
/etc/init.d/sendmail stop
/etc/init.d/postfix start
12 Installation von Getmail
Da es kein rpm Paket für Getmail gibt, müssen Sie es von den Quellen installieren. Dies kann wie folgt erreicht werden:
cd /tmp
wget http://pyropus.ca/software/getmail/old-versions/getmail-4.20.3.tar.gz
tar xvfz getmail-4.20.3.tar.gz
cd getmail-4.20.3
python setup.py build
python setup.py install
13 MySQL Passwortbestimmung und Konfiguration von phpMyAdmin
Benutzen Sie folgenden Befehl um dem MySQL root Konto ein Passwort zuzuweisen:
mysql_secure_installation
[[email protected] tmp]# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MySQL
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MySQL to secure it, we’ll need the current
password for the root user. If you’ve just installed MySQL, and
you haven’t set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on…
Setting the root password ensures that nobody can log into the MySQL
root user without the proper authorisation.
Set root password? [Y/n] <– ENTER
New password: <– IhrrootsqlPasswort
Re-enter new password: <– IhrrootsqlPasswort
Password updated successfully!
Reloading privilege tables..
… Success!
By default, a MySQL installation has an anonymous user, allowing anyone
to log into MySQL without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] <– ENTER
… Success!
Normally, root should only be allowed to connect from ‚localhost‘. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] <– ENTER
… Success!
By default, MySQL comes with a database named ‚test‘ that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] <– ENTER
– Dropping test database…
… Success!
– Removing privileges on test database…
… Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] <– ENTER
… Success!
Cleaning up…
All done! If you’ve completed all of the above steps, your MySQL
installation should now be secure.
Thanks for using MySQL!
[[email protected] tmp]#
Nun konfigurieren Sie phpMyAdmin. Hierzu ändern Sie die Apache Konfiguration, sodass phpMyAdmin auch Verbindungen von außerhalb von localhost zulässt (durch Auskommentieren des Blocks beginnend mit der Zeile <Directory „/usr/share/phpmyadmin“> ):
vi /etc/httpd/conf.d/phpmyadmin.conf
# # Web application to manage MySQL # #<Directory "/usr/share/phpmyadmin"> # Order Deny,Allow # Deny from all # Allow from 127.0.0.1 #</Directory> Alias /phpmyadmin /usr/share/phpmyadmin Alias /phpMyAdmin /usr/share/phpmyadmin Alias /mysqladmin /usr/share/phpmyadmin
Als nächstes ändern Sie den Authentication Type in phpMyAdmin und benutzen statt cookie http:
vi /usr/share/phpmyadmin/config.inc.php
[...] /* Authentication type */ $cfg['Servers'][$i]['auth_type'] = 'http'; [...]
Danach erstellen Sie die Systemstartlinks für Apache und starten dieses:
chkconfig –levels 235 httpd on
/etc/init.d/httpd start
Nun können Sie mit Ihrem Internetbrowser auf http://server1.example.com/phpmyadmin/ or http://192.168.0.100/phpmyadmin/ gehen und sich mit dem Benutzernamen root und Ihrem neuen MySQL Passwort einloggen.
14 Installation von Amavisd-new, SpamAssassin und ClamAV
Um amavisd-new, spamassassin und clamav zu installieren, benutzen Sie folgenden Befehl:
yum install amavisd-new spamassassin clamav clamd
unzip bzip2 unrar perl-DBD-mysql
Danach starten Sie freshclam, amavisd und clamd:
sa-update
chkconfig –levels 235 amavisd on
chkconfig –levels 235 clamd on
/usr/bin/freshclam
/etc/init.d/amavisd start
/etc/init.d/clamd start
15 Installation von Apache2 With mod_php, mod_fcgi/PHP5 und suPHP
ISPConfig 3 erlaubt Ihnen mod_php, mod_fcgi/PHP5, cgi/PHP5 und suPHP auf einer pro Website Basis zu benutzen.
Installieren Sie Apache2 mit mod_php5, mod_fcgid und PHP5 wie folgt:
yum install php php-devel php-gd php-imap php-ldap
php-mysql php-odbc php-pear php-xml php-xmlrpc php-eaccelerator
php-mbstring php-mcrypt php-mssql php-snmp php-soap php-tidy curl
curl-devel perl-libwww-perl ImageMagick libxml2 libxml2-devel mod_fcgid
php-cli httpd-devel
Als nächstes, öffnen Sie /etc/php.ini…
vi /etc/php.ini
… ändern das Error Reporting (sodass keine Meldungen mehr angezeigt werden) und kommentieren cgi.fix_pathinfo=1 aus:
[...] ;error_reporting = E_ALL & ~E_DEPRECATED error_reporting = E_ALL & ~E_NOTICE [...] ; cgi.fix_pathinfo provides *real* PATH_INFO/PATH_TRANSLATED support for CGI. PHP's ; previous behaviour was to set PATH_TRANSLATED to SCRIPT_FILENAME, and to not grok ; what PATH_INFO is. For more information on PATH_INFO, see the cgi specs. Setting ; this to 1 will cause PHP CGI to fix its paths to conform to the spec. A setting ; of zero causes PHP to behave as before. Default is 1. You should fix your scripts ; to use SCRIPT_FILENAME rather than PATH_TRANSLATED. ; http://www.php.net/manual/en/ini.core.php#ini.cgi.fix-pathinfo cgi.fix_pathinfo=1 [...]
Als nächstes installieren Sie suPHP (es gibt ein mod_suphp Paket in den Repositories, dies ist jedoch leider nicht mit ISPConfig kompatibel, deshalb müssen Sie suPHP selbst erstellen):
cd /tmp
wget http://suphp.org/download/suphp-0.7.1.tar.gz
tar xvfz suphp-0.7.1.tar.gz
cd suphp-0.7.1/
./configure –prefix=/usr –sysconfdir=/etc
–with-apr=/usr/bin/apr-1-config –with-apxs=/usr/sbin/apxs
–with-apache-user=apache –with-setid-mode=owner
–with-php=/usr/bin/php-cgi –with-logfile=/var/log/httpd/suphp_log
–enable-SUPHP_USE_USERGROUP=yes
make
make install
Danach fügen Sie das suPHO Modul zu Ihrer Apache Konfiguration hinzu…
vi /etc/httpd/conf.d/suphp.conf
LoadModule suphp_module modules/mod_suphp.so
… und erstellen wie folgt die /etc/suphp.conf Datei:
vi /etc/suphp.conf
[global] ;Path to logfile logfile=/var/log/httpd/suphp.log ;Loglevel loglevel=info ;User Apache is running as webserver_user=apache ;Path all scripts have to be in docroot=/ ;Path to chroot() to before executing script ;chroot=/mychroot ; Security options allow_file_group_writeable=true allow_file_others_writeable=false allow_directory_group_writeable=true allow_directory_others_writeable=false ;Check wheter script is within DOCUMENT_ROOT check_vhost_docroot=true ;Send minor error messages to browser errors_to_browser=false ;PATH environment variable env_path=/bin:/usr/bin ;Umask to set, specify in octal notation umask=0077 ; Minimum UID min_uid=100 ; Minimum GID min_gid=100 [handlers] ;Handler for php-scripts x-httpd-suphp="php:/usr/bin/php-cgi" ;Handler for CGI-scripts x-suphp-cgi="execute:!self"
Danach starten Sie Apache neu:
/etc/init.d/httpd restart
15.1 Ruby
Ab der Version 3.0.3 unterstützt ISPConfig 3 Ruby. Anstatt CGI/FastCGI zu benutzen, ist ISPConfig abhängig davon, dass mod_ruby auf Apache verfügbar ist.
Für CentOS 6.0 ist kein mod_ruby Paket verfügbar, deshalb müssen Sie es selbst kompilieren. Zuerst brauchen Sie dafür einige Voraussetzungen:
yum install httpd-devel ruby ruby-devel
Als nächstes laden Sie mod_ruby herunter und installieren es:
cd /tmp
wget http://www.modruby.net/archive/mod_ruby-1.3.0.tar.gz
tar zxvf mod_ruby-1.3.0.tar.gz
cd mod_ruby-1.3.0/
./configure.rb –with-apr-includes=/usr/include/apr-1
make
make install
Als letztes fügen Sie das mod_ruby Modul zu Ihrer Apache Konfiguration hinzu, deshalb erstellen Sie die Datei /etc/httpd/conf.d/ruby.conf…
vi /etc/httpd/conf.d/ruby.conf
LoadModule ruby_module modules/mod_ruby.so RubyAddPath /1.8
… und starten Apache neu:
/etc/init.d/httpd restart
(Sollten Sie die RubyAddPath /1.8 Zeile weglassen, werden Sie Fehlermeldungen ähnlich den folgenden in Apaches Errorlog finden, wenn Sie Rubydateien aufrufen:
[Thu May 26 02:05:05 2011] [error] mod_ruby:
ruby:0:in `require‘: no such file to load — apache/ruby-run (LoadError)
[Thu May 26 02:05:05 2011] [error] mod_ruby: failed to require
apache/ruby-run
[Thu May 26 02:05:05 2011] [error] mod_ruby: error in ruby
)
15.2 WebDAV
WebDAV sollte bereits aktiviert sein, doch um dies zu kontrollieren, öffnen Sie /etc/httpd/conf/httpd.conf und vergewissern Sie sich, dass die folgenden drei Module aktiviert sind:
vi /etc/httpd/conf/httpd.conf
[...] LoadModule auth_digest_module modules/mod_auth_digest.so [...] LoadModule dav_module modules/mod_dav.so [...] LoadModule dav_fs_module modules/mod_dav_fs.so [...]
Sollten Sie /etc/httpd/conf/httpd.conf editieren müssen, vergessen Sie nicht Apache danach neu zu starten:
/etc/init.d/httpd restart
16 Installation von PureFTPd
PureFTPd kann mit dem folgenden Befehl installiert werden:
yum install pure-ftpd
Erstellen Sie dann die Systemstartlinks und starten Sie PureFTPd:
chkconfig –levels 235 pure-ftpd on
/etc/init.d/pure-ftpd start
Sie müssen nun PureFTPd konfigurieren, um FTP und TLS Sitzungen zu erlauben. FTP ist ein sehr unsicheres Protokoll, weil alle Passwörter und Daten in reinem Text übertragen werden. Durch die Benutzung von TLS kann die gesamte Kommunikation verschlüsselt werden, um so FTP sehr viel sicherer zu machen.
Für TLS wird OpenSSL gebraucht; um dieses zu installieren benutzen sie einfach:
yum install openssl
Öffnen Sie /etc/pure-ftpd/pure-ftpd.conf…
vi /etc/pure-ftpd/pure-ftpd.conf
Wenn Sie FTP und TLS Sitzungen erlauben wollen, setzen Sie TLS auf 1:
[...] # This option can accept three values : # 0 : disable SSL/TLS encryption layer (default). # 1 : accept both traditional and encrypted sessions. # 2 : refuse connections that don't use SSL/TLS security mechanisms, # including anonymous sessions. # Do _not_ uncomment this blindly. Be sure that : # 1) Your server has been compiled with SSL/TLS support (--with-tls), # 2) A valid certificate is in place, # 3) Only compatible clients will log in. TLS 1 [...]
Um TLS verwenden zu können, müssen Sie ein SSL Zertifikat erstellen. Ich erstelle es im /etc/ssl/private/ Verzeichnis, welches ich erst selbst erstellen muss:
mkdir -p /etc/ssl/private/
Darauf folgend können Sie das SSL Zertifikat wie folgt generieren:
openssl req -x509 -nodes -days 7300 -newkey rsa:2048
-keyout /etc/ssl/private/pure-ftpd.pem -out
/etc/ssl/private/pure-ftpd.pem
Country Name (2 letter code) [XX]: <– Geben Sie den Namen Ihres Landes ein (z.B. „DE“).
State or Province Name (full name) []: <–
Geben Sie den Namen Ihres Bundesstaates oder Ihrer Provinz ein.
Locality Name (eg, city) [Default City]: <–
Geben Sie Ihre Stadt ein.
Organization Name (eg, company) [Default Company Ltd]: <– Geben Sie den Namen Ihrer Organisation ein (z.B. den Namen Ihrer Firma).
Organizational Unit Name (eg, section) []: <– Geben Sie Ihre Organisationsabteilung ein (z.B. „IT Department“).
Common Name (eg, your name or your server’s hostname) []: <– Geben Sie den vollen Domainnamen Ihres Systems ein (z.B. „server1.example.com“).
Email Address []: <– Geben Sie Ihre Email Adresse ein.
Ändern Sie die Zugriffsberechtigungen des SSL Zertifikats folgendermaßen:
chmod 600 /etc/ssl/private/pure-ftpd.pem
Starten Sie PureFTPd neu:
/etc/init.d/pure-ftpd restart
Sie können nun versuchen den FTP Client zur Verbindung zu benutzen, sollten diesen jedoch so konfigurieren, dass er TLS verwendet.