Category Archives: Server

Provide Source Files


title: “Provide Source Files”
date: 2016-01-13T15:47:56
slug: provide-source-files


Add allow * to grant access right for all to the filestore
vi /etc/puppet/fileserver.conf

[files]
 path /etc/puppet/files
 allow \*

Copy the content of the provided file to the created file:

file { '/etc/apache2/sites-enabled/mysite':
 owner => root, group => root, mode => 0644,
 source => "puppet:///files/mysite/mysite\_apache.conf",
}

Resource User


title: “Resource User”
date: 2016-01-13T10:15:13
slug: resource-user


root@host1:/home/ubuntu# puppet resource user root
user { 'root':
 ensure => 'present',
 comment => 'root',
 gid => '0',
 home => '/root',
 password => '\*',
 password\_max\_age => '99999',
 password\_min\_age => '0',
 shell => '/bin/bash',
 uid => '0',
}

Modify Resource (/bin/bash to /bin/sh):

puppet resource user root > user.pp
vi user.pp

user { 'root':
 shell => '/bin/sh',
}
root@host1:/home/ubuntu# puppet apply user.pp
Notice: Compiled catalog for host1.nyc2.example.com in environment production in 0.05 seconds
Notice: /Stage[main]/Main/User[root]/shell: shell changed '/bin/bash' to '/bin/sh'
Notice: Finished catalog run in 0.13 seconds

Apache SEO Rewrite Rule


title: “Apache SEO Rewrite Rule”
date: 2015-01-29T12:33:27
slug: apache-seo-rewrite-rule


Für http://domain.de/page1

RewriteRule ^([^\.]\*)$ index.php?menu=$1

$1 entspricht dann “page1” (bis vorm ersten .)

Für http://domain.de/page1.html

RewriteRule ^(.\*)\.html$ index.php?menu=$1

$1 entspricht dann “page1” (bis vor .html)

HP Proliant DL160 G7, B110i RAID und SLES11-SP3 X84_64 Installation (Remote / KVM)


title: “HP Proliant DL160 G7, B110i RAID und SLES11-SP3 X84_64 Installation (Remote / KVM)”
date: 2014-12-15T14:44:56
slug: hp-proliant-dl160-g7-b110i-raid-und-sles11-sp3-x84_64-installation-remote-kvm


1. ISO Datei im Anhang downloaden
2. SLES11 SP3 booten und F6 (Treiber) auf Ja stellen
3. Setup SLES11SP3 mit folgendem Kernel Boot Parameter starten broken_modules=ahci
4. Modul laden (Device vom Remote KVM angeben)

PHP Version updaten (Debian, als fcgid)


title: “PHP Version updaten (Debian, als fcgid)”
date: 2014-10-23T13:34:46
slug: php-version-updaten-debian-als-fcgid


Gewünschte PHP Version downloaden, kompilieren und installieren.

Beispiel:

./configure --prefix=/usr/share/php56 --datadir=/usr/share/php56 --mandir=/usr/share/man --bindir=/usr/bin/php56 --with-libdir=lib/x86\_64-linux-gnu --includedir=/usr/include/php56 --sysconfdir=/etc/php56/apache2 --with-config-file-path=/etc/php56/apache2 --with-config-file-scan-dir=/etc/php56/conf.d --enable-libxml --enable-session --with-pcre-regex=/usr --enable-xml --enable-simplexml --enable-filter --disable-debug --enable-inline-optimization --disable-rpath --disable-static --enable-shared --with-pic --with-gnu-ld --with-mysql --with-gd --with-jpeg-dir --with-png-dir --with-xpm-dir --enable-exif --with-zlib --with-bz2 --with-curl --with-mysqli --with-freetype-dir --enable-soap --enable-sockets --enable-calendar --enable-ftp --enable-mbstring --enable-gd-native-ttf --enable-bcmath --enable-zip --with-pear --with-openssl --with-imap --with-imap-ssl --with-kerberos --enable-phar --enable-pdo --with-pdo-mysql --with-mysqli --enable-intl --with-mcrypt

make
make install

Alte PHP Version disablen (wenn noch die originale vom OS am Laufen ost)

a2dismod php5

Mod FCGI für Apache installieren

apt-get install libapache2-mod-fcgid

In FCGI Config folgendes eintragen:

<IfModule mod\_fcgid.c>
 DirectoryIndex index.php
 <FilesMatch "\.php$">
 AddHandler fcgid-script .php
 FCGIWrapper /usr/bin/php56/php-cgi .php
 Options +ExecCGI
 </FilesMatch>

 FcgidConnectTimeout 20
 SocketPath /var/lib/apache2/fcgid/sock
</IfModule>

Bei MySQL Umlaut Problemen


title: “Bei MySQL Umlaut Problemen”
date: 2014-09-09T19:57:20
slug: bei-mysql-umlaut-problemen


Folgender Eintrag in die my.cnf:

init-connect='SET NAMES utf8'
skip-character-set-client-handshake
character-set-server = utf8
collation-server = utf8\_unicode\_ci

Open Firewall Port on Hyper-V Core Server for RDP


title: “Open Firewall Port on Hyper-V Core Server for RDP”
date: 2014-08-13T09:59:09
slug: open-firewall-port-on-hyper-v-core-server-for-rdp


Execute the following command in a shell:

netsh advfirewall firewall set rule group="Remote Desktop" new enable=yes

To enable File and Printer Sharing in command prompt you must type:

netsh advfirewall firewall set rule group=”File and Printer Sharing” new enable=Yes

multiple timeslots


title: “multiple timeslots”
date: 2014-07-11T08:10:15
slug: multiple-timeslots


vi /usr/local/nagios/etc/objects/timeperiod.cfg
define timeperiod{
 timeperiod\_name multiple-time-slots
 alias Multiple Time Slots
 sunday 00:00-18:00,20:00-24:00
 monday 00:00-18:00,20:00-21:00,23:00-24:00
 tuesday 00:00-24:00
 wednesday 00:00-24:00
 thursday 00:00-24:00
 friday 00:00-20:00,22:00-24:00
 saturday 00:00-23:00
}

Verschiedene PHP Versionen für FCGI compilieren (Debian7)


title: “Verschiedene PHP Versionen für FCGI compilieren (Debian7)”
date: 2014-03-04T11:19:46
slug: verschiedene-php-versionen-fur-fcgi-compilieren-debian7


Als erstes laden wir die folgenden Quellpakete auf unseren Server:

apt-get install libapache2-mod-fcgid apache2-suexec libpcre3-dev libpcre++-dev libpng12-dev libbz2-dev libcurl4-openssl-dev libc-client2007e-dev libjpeg8-dev libgif-dev libgif4 libpthread-stubs0 libpthread-stubs0-dev libx11-dev libxau-dev libxcb1-dev libxdmcp-dev libxpm-dev x11proto-core-dev x11proto-input-dev x11proto-kb-dev xtrans-dev libxml2-dev libmysqlclient-dev libfreetype6-dev

Als nächstes wird das Source Paket der gewünschten PHP Version benötigt, dieses kann hier geladen werden:

php-5.5.8.tar
php-5.2.17.tar
php-5.3.27.tar
php-5.4.24.tar

Die Source Pakete können jetzt nach /usr/local/src/phpXXXXX entpackt werden

Beim Compilieren der PHP Pakete muss zwischen einem 32 Bit und 64 Bit OS unterschieden werden.
Mit folgendem Befehl kann die OS Version angezeigt werden:

root@Server:~# uname -a
Linux Server 2.6.32-5-amd64 #1 SMP Mon Feb 25 00:26:11 UTC 2013 x86\_64 GNU/Linux

In diesem Beispiel verrät das x86_64 in der Ausgabe das ein 64Bit OS installiert ist.
Bei i386 oder i686 handelt es sich um ein 32 Bit Betriebssystem.

Für 32Bit und PHP Version 5.3

./configure --prefix=/usr/share/php53 --datadir=/usr/share/php53 --mandir=/usr/share/man --bindir=/usr/bin/php53 --with-libdir=lib/i386-linux-gnu --includedir=/usr/include/php53 --sysconfdir=/etc/php53/apache2 --with-config-file-path=/etc/php53/apache2 --with-config-file-scan-dir=/etc/php53/conf.d --enable-libxml --enable-session --with-pcre-regex=/usr --enable-xml --enable-simplexml --enable-filter --disable-debug --enable-inline-optimization --disable-rpath --disable-static --enable-shared --with-pic --with-gnu-ld --with-mysql --with-gd --with-jpeg-dir --with-png-dir --with-xpm-dir --enable-exif --with-zlib --with-bz2 --with-curl --with-ldap --with-mysqli --with-freetype-dir --enable-soap --enable-sockets --enable-calendar --enable-ftp --enable-mbstring --enable-gd-native-ttf --enable-bcmath --enable-zip --with-pear --with-openssl --with-imap --with-imap-ssl --with-kerberos --enable-phar --enable-pdo --with-pdo-mysql --with-mysqli --enable-intl --with-mcrypt

Für 64Bit und PHP Version 5.3

./configure --prefix=/usr/share/php53 --datadir=/usr/share/php53 --mandir=/usr/share/man --bindir=/usr/bin/php53 --with-libdir=lib/x86\_64-linux-gnu --includedir=/usr/include/php53 --sysconfdir=/etc/php53/apache2 --with-config-file-path=/etc/php53/apache2 --with-config-file-scan-dir=/etc/php53/conf.d --enable-libxml --enable-session --with-pcre-regex=/usr --enable-xml --enable-simplexml --enable-filter --disable-debug --enable-inline-optimization --disable-rpath --disable-static --enable-shared --with-pic --with-gnu-ld --with-mysql --with-gd --with-jpeg-dir --with-png-dir --with-xpm-dir --enable-exif --with-zlib --with-bz2 --with-curl --with-ldap --with-mysqli --with-freetype-dir --enable-soap --enable-sockets --enable-calendar --enable-ftp --enable-mbstring --enable-gd-native-ttf --enable-bcmath --enable-zip --with-pear --with-openssl --with-imap --with-imap-ssl --with-kerberos --enable-phar --enable-pdo --with-pdo-mysql --with-mysqli --enable-intl --with-mcrypt

Falls es zu einen Fehler beim kompilieren der ssl Komponente kommt (php5.2.17), kann diese deaktiviert werden. Beim Configure dann einfach den Parameter

--with-openssl

weglassen.

Ein weiterer Fehler kann sein:

configure: error: Cannot find imap library (libc-client.a). Please check your c-client installation.

Abhilfe schafft hier bei einem 32 Bit OS:

ln -s /usr/lib/libc-client.a /usr/lib/i386-linux-gnu/libc-client.a

Bei einem 64 Bit OS:

ln -s /usr/lib/libc-client.a /usr/lib/x86\_64-linux-gnu/libc-client.a

Für die anderen PHP Versionen muss jeweils der Parameter :

--prefix=/usr/share/php52
--datadir=/usr/share/php52
--bindir=/usr/bin/php52
--includedir=/usr/include/php52
--sysconfdir=/etc/php52/apache2
--with-config-file-path=/etc/php52/apache2
--with-config-file-scan-dir=/etc/php52/conf.d

auf die jeweilige Version angepasst werden (52, 53, 54 oder 55).

Mit:

make
make install

wird die PHP Version kompiliert und installiert.

Anschließend können die php Binaries noch getestet werden:

/usr/bin/php52/php -v
PHP 5.2.17 (cli) (built: Feb 9 2014 17:04:22)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.2.0, Copyright (c) 1998-2010 Zend Technologies
/usr/bin/php53/php -v
PHP 5.3.27 (cli) (built: Feb 9 2014 16:29:10)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2013 Zend Technologies
/usr/bin/php54/php -v
PHP 5.4.24 (cli) (built: Feb 9 2014 16:43:53)
Copyright (c) 1997-2013 The PHP Group
Zend Engine v2.4.0, Copyright (c) 1998-2013 Zend Technologies

Die Datei “/etc/apache2/mods-enabled/fcgid.conf” wiefolgt anpassen:

<IfModule mod\_fcgid.c>
 AddHandler fcgid-script .fcgi
 FcgidConnectTimeout 180
 FcgidIOTimeout 600
 FcgidMaxRequestLen 134217728
 MaxRequestLen 134217728
 MaxRequestsPerProcess 1500
</IfModule>