######### MYSQL für Debian Server ######### Die openssl Headerfiles nicht vergessen zu installieren // Gruppe mysql anlegen addgroup --system mysql // Benutzer mysql anlegen adduser --system --home /usr/local/mysql --shell /bin/false --no-create-home --group mysql --disabled-password --disabled-login mysql ## Mysql4 herunterladen und entpacken. Ins Verzeichnis wechseln. CFLAGS="-O3 -mpentiumpro" CXX=gcc CXXFLAGS="-O3 -mpentiumpro -felide-constructors -fno-exceptions -fno-rtti" ./configure \ --with-unix-socket-path=/var/run/mysqld/mysqld.sock \ --prefix=/usr/local/mysql \ --bindir=/usr/bin \ --sysconfdir=/etc \ --with-charset=latin1 \ --with-collation=latin1_german1_ci \ --with-extra-charsets=complex \ --with-mysqld-user=mysql \ --with-openssl=/usr/ \ --without-comment \ --without-debug \ --without-bench \ --without-man \ --without-docs \ --with-isam \ --enable-local-infile \ --enable-thread-safe-client \ --enable-assembler ## Nach dem Configure ein make und make install make su -c 'make install' ## init.d Script kopieren Ordner erstellen und Systemtabellen erstellen cp support-files/mysql.server /etc/init.d/mysqld chmod 700 /etc/init.d/mysqld mkdir /var/run/mysqld chown mysql:mysql /var/run/mysqld mkdir /usr/local/mysql/var chown mysql:mysql /usr/local/mysql/var /usr/bin/mysql_create_system_tables ## /etc/my.cnf cp support-files/my-medium.cnf /etc/my.cnf ## Anpassen wie benötigt ## Nicht wichtig aber offtmals nützlicher Symlink für rcmysqld ln -s /etc/init.d/mysqld /sbin/rcmysqld ## Sollte der mysql-Server noch nicht gestartet sein rcmysqld start ######### APACHE für Debian Server ######### ## Eventuell den Benutzer und die Gruppe www-data anlegen CFLAGS="-O2 -mcpu=i686 -Wall -fPIC -Wall -fno-strict-aliasing -D_LARGEFILE_SOURCE"; export CFLAGS \ CPPFLAGS="-DMAX_SERVER_LIMIT=200000"; export CPPFLAGS ./configure \ --enable-layout=GNU \ --enable-so \ --prefix=/usr/local/apache2 \ --sysconfdir=/etc/apache2 \ --with-program-name=apache2 \ --with-mpm=worker \ --with-perl=/usr/bin/perl \ --enable-modules="auth so http logio" \ --enable-mods-shared="speling include rewrite \ file-cache cache mem-cache disk-cache \ status info unique-id expires mime-magic auth-dbm \ cgi asis ext-filter authn-dbm authn-anon authz-dbm auth-digest \ vhost-alias actions" \ --with-ssl=/usr/include/openssl \ --enable-ssl=shared \ --enable-deflate \ --enable-suexec \ --with-suexec-bin=/usr/sbin/suexec \ --with-suexec-caller=www-data \ --with-suexec-docroot=/var \ --with-suexec-userdir=www \ --with-suexec-uidmin=100 \ --with-suexec-gidmin=100 \ --with-suexec-logfile=/var/log/apache2/suexec.log \ --with-suexec-safepath=/usr/local/bin:/usr/bin:/bin ## Nach dem Configure ein make und make install make su -c 'make install' #### Weitere configurationen mkdir /var/log/apache2 mkdir /var/run/apache2/ chown www-data:www-data /var/run/apache2/ chmod 750 /var/run/apache2/ ## Datei /etc/default/apache2 erstellen echo -en "# 0 = start on boot, 1 = don't start on boot\nNO_START=0" > /etc/default/apache2 ## Wir benötigen noch ein init.d Script wget -O /etc/init.d/apache2 http://www.schlayer.org/apache2 chmod 700 /etc/init.d/apache2 ## Nicht wichtig aber offtmals nützlich Symlink für rcapache ln -s /etc/init.d/apache2 /sbin/rcapache ln -s /usr/local/apache2/sbin/apache2 /usr/sbin/apache2 ln -s /usr/local/apache2/sbin/apachectl /usr/sbin/apachectl ln -s /usr/local/apache2/sbin/suexec /usr/sbin/suexec ## Zusatzmodul mod_mysql_auth ## Download von http://modauthmysql.sourceforge.net/ ## Entpacken und ins Verzeichnis wechseln. /usr/local/apache2/sbin/apxs -c -L/usr/local/mysql/lib/mysql -I/usr/local/mysql/include/mysql -lmysqlclient -lm -lz mod_auth_mysql.c ## Das Modul sollte gebaut sein als Root kann es nun installiert werden: /usr/local/apache2/sbin/apxs -i mod_auth_mysql.la ## Configuration von /etc/apache2/apache2.conf anpassen LoadModule mysql_auth_module libexec/mod_auth_mysql.so ## Obere Zeile einfügen und gut ist. Die configuration und verwendung bitte der Documentation entnehmen ## TIPP Alle Logdateien werden nun unter /usr/local/apache2/var/apache2/log/ # geschrieben. Ich habe meine configuration soweit abgeändert das diese nach /var/log/apache2 geschrieben werden # Auch die SOCK und PID sollte angepasst werden. Beispielconfiguration ./apache2.conf ## SSL einrichten # Hierfür habe ich das kleine Script make_keys.sh geschrieben. # Downloaden und im oberen Teil die variablen anpassen. wget http://www.schlayer.org/make_keys.sh chmod +x make_keys.sh # make_keys.sh editieren und ausführen ./make_keys.sh# anschliesend die ssl.conf nach /etc/apache2/ssl.conf verschieben mv ssl.conf /etc/apache2/ssl.conf # /etc/apache2/apache2.conf anpassen # am Ende der apache2.conf folgendes einfügen include /etc/apache2/ssl.conf ## Apache starten. # normalerweise solltest du nun den Apache ohne Fehlermeldungen starten können rcapache start # oder /etc/init.d/apache2 start ### php5_cgi erstellen ### #Hierbei kann es zu etlichen abbrüchen kommen, #da einige Header Files nachinstalliert werden müssen. #Den configurestring bitte selbst überfliegen und eventuell kürzen;) apt-get install flex libbz2-dev \ libcurl3-dev libidn11-dev pkg-config \ libgdbm-dev libjpeg62 libjpeg62-dev libpng12-0 libpng12-dev \ libfreetype6 libfreetype6-dev \ comerr-dev libc-client-dev libc-client2002edebian libkadm55 libkrb5-dev libkrb53 libpam0g-dev mlock \ libltdl3 libltdl3-dev libmcrypt-dev libmcrypt4 libmhash2 libmhash-dev ./configure \ --prefix=/usr/php5 \ --datadir=/usr/php5/share/php \ --bindir=/usr/bin/php5 \ --includedir=/usr/include/php5 \ --sysconfdir=/etc/php5 \ --libdir=/usr/share/php5 \ --with-_lib=lib \ --with-config-file-path=/etc/php5 \ --disable-all \ --with-regex=php \ --with-pcre-regex \ --with-mcrypt \ --with-mhash \ --with-pic \ --with-layout=GNU \ --with-bz2 \ --with-iconv \ --with-gettext \ --with-sqlite \ --with-sqlite-utf8 \ --with-zlib=yes \ --with-gd \ --with-gdbm \ --with-dba \ --with-openssl=/usr \ --with-zip=/usr \ --with-mysql=/usr/local/mysql \ --with-mysqli=/usr/bin/mysql_config \ --with-freetype-dir=/usr \ --with-jpeg-dir=/usr \ --with-png-dir=/usr \ --with-tiff-dir=/usr \ --with-ttf \ --without-pear \ --without-mm \ --without-snmp \ --without-sybase-ct--enable-cgi \ --enable-calendar \ --enable-track-vars \ --enable-mbstring \ --enable-inline-optimization \ --enable-mbstr-enc-trans \ --enable-gd-native-ttf \ --enable-trans-sid \ --enable-session \ --enable-exif \ --enable-filepro \ --enable-bcmath \ --enable-ctype \ --enable-ftp \ --enable-gd-imgstrttf \ --enable-gd-native-ttf \ --enable-mbregex \ --enable-maintainer-zts make make install # ln -s /usr/bin/php5/php /usr/bin/php mkdir /etc/php5 cp php.ini-dist /etc/php5/php.ini ### Suphp 0.6 bauen ### ## gegebenfalls den Pfad zu 'apxs' anpassen wget http://www.suphp.org/download/suphp-0.6.1.tar.gz tar -xzf suphp-0.6.1.tar.gz cd suphp-0.6.1 ## WICHTIG!! autoconf muss installiert sein ./configure \ --with-min-uid=100 \ --with-min-gid=100 \ --with-apache-user=www-data \ --with-php=/usr/bin/php5/php \ --with-logfile=/var/log/apache2/suphp.log \ --with-setid-mode=paranoid \ --with-apxs=/usr/local/apache2/sbin/apxs make su -c 'make install' cp doc/suphp.conf-example /etc/suphp.conf ## Wichtig: 'mkdir /usr/local/etc' erstellen ## oder mit einem Link nach /etc ln -s /etc/suphp.conf /usr/local/etc/suphp.conf ## oder eben cp doc/suphp.conf-example /usr/local/etc/suphp.conf ## Die suphp.conf wie folgt anpassen: ## Bitte logfile anpassen ########## BEGIN /etc/suphp.conf ############ [global] ;Path to logfile logfile=/var/log/apache2/suphp.log ;Loglevel loglevel=info ;User Apache is running as webserver_user=www-data ;Path all scripts have to be in docroot=/ ; Security options allow_file_group_writeable=false allow_file_others_writeable=false allow_directory_group_writeable=false 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-php=php:/usr/bin/php5/php application/x-httpd-php=php:/usr/bin/php5/php ;Handler for CGI-scripts x-suphp-cgi=execute:!self ########## END /etc/suphp.conf ############ # /etc/apache2/apache2.conf wie folgt anpassen: # SuPhp-Modul Laden LoadModule suphp_module libexec/mod_suphp.so suPHP_ConfigPath /etc/php5 AddType application/x-httpd-php .php .php4 .php3 .phtml AddType application/x-httpd-php-source .phps SuPHP_AddHandler application/x-httpd-php SuPHP_AddHandler x-httpd-php .php # In den Jeweiligen Vhost muss nur noch eingetragen werden: suPHP_Engine on suPHP_UserGroup USER GROUP # USER und GROUP durch den tasächlichen Benutzer und dessen Gruppe ersetzen