Category Archives: Server

Linux Software RAID1 defekte Platte tauschen

Posted on in How-Tos, Linux, Server

Da auf meinem Rootserver zum wiederholten Mal Probleme mit der zweiten Festplatte (/dev/sdb) auftraten, wurde diese soeben im Rechenzentrum getauscht (ein Lob an Hetzner für den schnellen Support). Da die Platte Bestandteil eines Software RAID1-Verbunds ist, kurz die Schritte zum Entfernen und anschließenden Reaktivieren der Platte.

Zuerst alle Partitionen der Platte auf faulty setzen und anschließend aus dem jeweiligen Array entfernen:

mdadm /dev/md0 --set-faulty /dev/sdb1
mdadm /dev/md0 --remove /dev/sdb1
mdadm /dev/md1 --set-faulty /dev/sdb2
mdadm /dev/md1 --remove /dev/sdb2
mdadm /dev/md2 --set-faulty /dev/sdb6
mdadm /dev/md2 --remove /dev/sdb6

Nach dem Tausch der Platte muss zuerst die Partitionstabelle auf die neue Platte kopiert werden:

sfdisk -d /dev/sda | sfdisk /dev/sdb 

Anschließend können die Partitionen wieder zu den jeweiligen Arrays hinzugefügt werden:

mdadm /dev/md0 --add /dev/sdb1
mdadm /dev/md1 --add /dev/sdb2
mdadm /dev/md2 --add /dev/sdb6

Über folgende Ausgaben kann der Resync der Arrays dann überprüft werden:

mdadm --detail /dev/md2
cat /proc/mdstat

Debian logcheck ignore file for sSMTP

Posted on in Linux, Server

On a server, I use logcheck to get an email based on logfile analysis if anything goes wrong and doesn’t fit the usual patterns. In addition, I use sSMTP to forward all sent mails to my mailserver. Unfortunately, this solution ends up in sending a mail like the following every hour because of a bug in logcheck’s ignorefile for sSMTP.

Dec 12 22:02:06 hostname sSMTP[22391]: Sent mail for logcheck@hostname (221 2.0.0 Bye) uid=101 username=logcheck outbytes=639

To fix this, I replaced the contents of the file /etc/logcheck/ignore.d.server/ssmtp with the following lines:

^w{3} [0-9]{2} [0-9]{2}:[0-9]{2}:[0-9]{2} [a-zA-Z0-9]+ sSMTP[[0-9]+]: Sent mail for logcheck@.*$
^w{3}  [0-9] [0-9]{2}:[0-9]{2}:[0-9]{2} [a-zA-Z0-9]+ sSMTP[[0-9]+]: Sent mail for logcheck@.*$

I removed the other lines, because sSMTP shouldn’t do anything else on the system and if it would, I’d like to be informed. If you need more ignore patterns you might have to keep/edit some of the original lines.

Debootstrap a Ubuntu Hardy DomU on a Debian Etch Xen Dom0

Posted on in How-Tos, Linux, Server

Lately, I wanted set up a Ubuntu Hardy DomU on an existing Debian Etch Dom0 box. Usually, setting up Debian-based DomUs is very simple with xen-create-image and debootstrap (there are tons of tutorials out there dealing with this topic), but unfortunately Etch’s version of debootstrap doesn’t support Ubuntu Hardy. I spent a surprisingly long time on searching the net until I found a solution for this problem on a french site: Installer et configurer Xen sur Debian 4.0 Etch (it’s a complete howto for Xen on Debian Etch, but it deals with the Hardy part too). The author created a backport of the debootstrap package, which enables you to debootstrap Hardy.

First, you have to create the hardy.d directory (symlink) for xen-tools.

$ cd /usr/lib/xen-tools
$ ln -s ubuntu.d hardy.d

There’s a debian repository holding the backport package, however I got problems to use that repository on an amd64 box, so I downloaded and installed the package manually.

$ wget http://falcon.landure.fr/pool/etch/debootstrap/debootstrap_1.0.10_all.deb
$ dpkg -i debootstrap_1.0.10_all.deb

Now you should be able to debootstrap a Hardy DomU.

$ xen-create-image
--hostname=hardy
--ip=xxx.xxx.xxx.xxx
--size=5Gb
--memory=256Mb
--dist=hardy
--mirror=http://archive.ubuntu.com/ubuntu/

Fetchmail and Sieve with Virtual Mail on Debian Etch

Posted on in Development, How-Tos, Linux, Server

Update: This post is quite old and does not work out of the box with the current ISPMail tutorials. I posted an update here.

When it comes to mail servers, I really like the setup Christoph Haas describes in his Document Howto: ISP-style Email Server with Debian-Etch and Postfix 2.3. One thing I was missing on a server was the ability to automatically generate config files for fetchmail and sieve from the database in order to get mail from other servers and being able to apply server side filters on incoming mail. This howto is based on the mentioned tutorial.

The additional setup is quite simple: 2 more database tables hold the data for fetchmail and sieve rules and a set of PHP scripts called by cron every few minutes fetches the data and writes it into the appropriate config files. For fetchmail, a script creates a .fetchmailrc file in /home/vmail/. For sieve, another script creates a .dovecot.sieve config file for every user who got sieve rules in the database.

Continue reading →

Quick and dirty: set up a local PHP and Ruby development environment on Ubuntu Hardy Heron (8.04)

Posted on in Development, How-Tos, Linux, Server

This is a quick and dirty tutorial how to set up a local development stack on a fresh Ubuntu Hardy Heron (8.04) install.

Here is what we will install:

  • Apache 2.2
  • PHP 5 as apache module
  • Ruby 1.8 as apache module & Rails 2.0.2
  • MySQL 5
  • phpMyAdmin

Continue reading →

Set up multiple virtual hosts on XAMPP for windows

Posted on in How-Tos, Server, Windows

As I work on many projects and experiments on my local windows development environment (XAMPP), I normally put all web stuff in the htdocs directory and usually I’m happy with it. For several projects (like CMS installations or experiments with frameworks) it’s very handy to have a separated virtual host in order to be able to have an own document root for that application. You just don’t have to bug with different paths and subdirectories and can focus on developing instead of setting base URLs etc.

For example, if I develop MVC applications which are meant to run in a host’s document root, I want to work with paths like http://<host>/<controller>/<action> without having to deal with subdirectories like http://<host>/directory/subdirectory/public/<controller>/<action>.
It just facilitates developing and even tough it’s a little more work at setting up a new project, usually it’s worth it. Here’s a quick and dirty how to achieve this in two steps.

Continue reading →

Ruby On Rails auf Ubuntu 8.04

Posted on in How-Tos, Linux, Server

Ich wollte soeben auf meinem frisch installierten Ubuntu 8.04 folgendermaßen Ruby On Rails installieren, um mal wieder zu versuchen, mich darin einzuarbeiten ;-)

maff@mafftop:~$ sudo apt-get install ruby rubygems irb ri rdoc
> ruby1.8-dev build-essential
maff@mafftop:~$ sudo gem install rails --include-dependencies

Die Installation der Pakete über apt verlief gewohnt problemlos, aber gems erwartete mich mit einer netten Fehlermeldung:

maff@mafftop:~$ sudo gem install rails --include-dependencies
Bulk updating Gem source index for: http://gems.rubyforge.org
ERROR:  While executing gem ... (Gem::GemNotFoundException)
    Could not find rails (> 0) in any repository

Hmm, komisch. Gerade Rails wird nicht gefunden? Das kanns doch fast nicht sein. Also hab ich ein bisschen gesucht und einen Post gefunden, der das Problem beheben soll. Also hab ich mal schön Schritt für Schritt alles nachgemacht :-) Durch ein gem env wird das Installationsverzeichnis von gems ausgespuckt, in dem der cache-Pfad gelöscht werden soll:

maff@mafftop:~$ sudo gem env
RubyGems Environment:
  - VERSION: 0.9.4 (0.9.4)
  - INSTALLATION DIRECTORY: /var/lib/gems/1.8
  - GEM PATH:
     - /var/lib/gems/1.8
  - REMOTE SOURCES:
     - http://gems.rubyforge.org
maff@mafftop:~$ sudo rm -f /var/lib/gems/1.8/source_cache

Ok, und nun? Ein erneuter Versuch, rails zu installieren scheiterte mit der selben Fehlermeldung. Also hab ichs mit einem Update von gems versucht:

maff@mafftop:~$ sudo gem update
Updating installed gems...
Bulk updating Gem source index for: http://gems.rubyforge.org
Gems: [] updated

Et voilà:

maff@mafftop:~$ sudo gem install rails --include-dependencies
INFO:  `gem install -y` is now default and will be removed
INFO:  use --ignore-dependencies to install only the gems you list
Bulk updating Gem source index for: http://gems.rubyforge.org
Successfully installed rake-0.8.1
Successfully installed activesupport-2.0.2
Successfully installed activerecord-2.0.2
Successfully installed actionpack-2.0.2
Successfully installed actionmailer-2.0.2
Successfully installed activeresource-2.0.2
Successfully installed rails-2.0.2
7 gems installed
Installing ri documentation for rake-0.8.1...
Installing ri documentation for activesupport-2.0.2...
Installing ri documentation for activerecord-2.0.2...
Installing ri documentation for actionpack-2.0.2...
Installing ri documentation for actionmailer-2.0.2...
Installing ri documentation for activeresource-2.0.2...
Installing RDoc documentation for rake-0.8.1...
Installing RDoc documentation for activesupport-2.0.2...
Installing RDoc documentation for activerecord-2.0.2...
Installing RDoc documentation for actionpack-2.0.2...
Installing RDoc documentation for actionmailer-2.0.2...
Installing RDoc documentation for activeresource-2.0.2...

Jetzt gehts ans Doku und Tutorials lesen ;-)

Wieder zum Indianer zurück

Posted on in General, Server

Im Laufe einer Servererweiterung bin ich von Lighttpd wieder auf Apache zurück. Nicht dass ich mit Lighty nicht zufrieden gewesen wäre (v.A. in Bezug auf Geschwindigkeit, Speicherauslastung und einfacher Konfiguration), aber der Apache kann einfach mehr, speziell wenn es um DAV und SVN geht. Hab jetzt Apache mit PHP über mod-fcgid laufen und dazu endlich meines eigenes SVN-Repository + Trac :-)