Blogs

Plesk root email delivery

To receive local root email to an externally monitored email address:

  • Login to plesk control panel and set the admin contact email address for the server which should update "/var/qmail/alias/.qmail-root" file and add an alias for root.
  • Either add the hostname (FQDN) to the qmail control locals file or to the virtualdomains file located in "/var/qmail/control/".
  • Also add the hostname (FQDN) to the "/var/qmail/control/rcpthosts" file if not already present so local mails get delivered.
  • Restart inetd and qmail:
    /etc/init.d/inetd restart
    /etc/init.d/qmail restart
  • Check with:
    /var/qmail/bin/qmail-showctl

    This should show:

    ...
    locals:
    ...
    Messages for host.domain.tl are delivered locally.
    ...
    rcpthosts:
    ...
    SMTP clients may send messages to recipients at host.domain.tld.
    ...

Munin-node Plugin Configurations

HDD Temperature

You can usually identify which hard disks are on your system by looking in "/proc/ide" and in "/proc/scsi".

# cat /proc/scsi/scsi
Attached devices:
Host: scsi0 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: WDC WD2500YS-01S Rev: 20.0
  Type:   Direct-Access                    ANSI SCSI revision: 05
Host: scsi1 Channel: 00 Id: 00 Lun: 00
  Vendor: ATA      Model: WDC WD2500YS-01S Rev: 20.0
  Type:   Direct-Access                    ANSI SCSI revision: 05

`fdisk -l` lists the two drives as "sda" and "sdb".

Drupal 5.14 upgrade fixes

With the upgrade to drupal-5.14 and using the SecurePages 5.x-1.7-beta1 module:

Error:

PHP Fatal error:  Call to undefined function drupal_urlencode() in /path/to/drupal/sites/all/modules/securepages/securepages.module on line 323

Solution:
Added the below code to the beginning of the securepages_init function in "securepages.module" so function gets loaded.

  if (!function_exists('drupal_urlencode')) {
    include_once 'includes/common.inc';
  }

Reference:
http://drupal.org/node/330171

highlight grep search string

Default to highlighting search string when using grep by adding the below alias to ~/.bashrc file:

alias grep='grep --color=auto'

Share screen session

  1. Start screen using the command:

    $ screen -S <SessionName>

    The -S switch gives the session a name, which makes multiple screen sessions easier to manage.

  2. Allow multiuser access in the screen session:

    CTRL-A
    :multiuser on

  3. Grant permission to the guest user to access the screen session:

    CTRL-A
    :acladd <guest_user>

  4. The guest user can now connect via:

    $ screen -x <host_user>/<SessionName>

c-client library version skew with uw-imap

With the recent update of uw-imap from epel repository to uw-imap-2007d-1.el5, I was getting the below error which indicated that uw-imap required 2007d version of c-client.

Below was the error message as logged in "/var/log/messages":

IMAP toolkit crash: c-client library version skew, app=2007d library=2007b

Adding "libc-client2007" to the list of "includepkgs" in yum conf for epel repository and doing a `yum update` resolved the issue by updating libc-client2007-2007b to libc-client2007-2007d.

Installation of Munin and Munin-Node

Munin is network monitoring tool for servers. It uses RRDTool, an open source used to generate graphics and logging server activities.

I am installing and configuring munin on centos 5 x86_64 using yum.
1)First of all, we need to add a RPMforge repository.

rpm -Uhv http://apt.sw.be/redhat/el5/en/x86_64/rpmforge/RPMS//rpmforge-release-0.3.6-1.el5.rf.x86_64.rpm

2)Installing yum

yum -y install munin

3)chaning the ownership of munin web docroot to munin, as by default it goes to root.

chown -R munin:munin /var/www/munin/

Convert / root filesytem to use lvm over raid

I have outlined below the steps taken to move from a normal single disk system and convert to a raid1 using an additional drive:

Note: /boot cannot be on lvm nor any other raids other than raid1 partition.

Don't forget to make the essential backups prior.

Convert / to raid/lvm

  1. fdisk /dev/sdb and make clone of sda (convert partition type to "Linux raid autodetect")
  2. add /dev/sdb1 -- /boot - 13 blocks (100Mb) - type raid
  3. add /dev/sdb2 -- rest - type raid
  4. Create raid partitions:
    partprobe
    mdadm -C /dev/md0 --auto=yes -l 1 -n 2 missing /dev/sdb1
    mdadm -C /dev/md1 --auto=yes -l 1 -n 2 missing /dev/sdb2
  5. Create logical volume and copy / partition and /dev files over:
    pvcreate /dev/md1
    vgcreate vg0 /dev/md1
    lvcreate -L 4G -n lv0 vg0
    mke2fs -j /dev/vg0/lv0
    mkdir /mnt/lv0
    mount /dev/vg0/lv0 /mnt/lv0
    find / -xdev | cpio -pvmd /mnt/lv0
    cp -aux /dev /mnt/lv0
  6. Edit /mnt/lv0/etc/fstab to reflect the new root
    /dev/vg0/lv0            /                       ext3    defaults        1 1
  7. Chroot to new filesystem and create initrd with raid and lvm support
    mount --bind /dev /mnt/lv0/dev
    chroot /mnt/lv0
    mount -t proc /proc /proc
    mount -t sysfs /sys /sys
    vgscan
    vgchange -ay
    mkinitrd -v /boot/initrd-`uname -r`.lvm.img `uname -r`
    umount /sys
    umount /proc
    exit
    mv /mnt/lv0/boot/initrd-`uname -r`.lvm.img /boot
  8. Edit grub.conf to point to new root /dev/vg0/lv0
  9. reboot

Convert /boot to raid1

SATA disks as AHCI

When converting from IDE to AHCI in the BIOS to include additional drives, I would get a kernel panic... as by default the bios was setup with the drives as IDE.

Booted using existing IDE and created a new kernel image with support for AHCI via the --preload option to manually specify modules support:

# mkinitrd --allow-missing --preload=ahci --force-scsi-probe /boot/initrd-`uname -r`-custom.img `uname -r`

Then create a new grub boot option to load the new custom kernel image and select it when grub boots up using AHCI.

Forcing apache to listen to ipv4

Recently, I've noticed that in ubuntu (6.06) dapper server with apache-2.0.55, apache by default listens to IPv6, thus was causing slow response times. The response times was much improved by having apache listen to IPv4 instead.

Edit /etc/apache2/ports.conf and specify an IPv4 address on all Listen directives:

Listen 0.0.0.0:80
Listen 0.0.0.0:443

Syndicate content
Comment