How To Install 3ware Tools on Debian Lenny

Problem

In order to manage the 3ware raid controller under Linux, an embedded web server needs to be installed. 3ware provides a download-able tarball on their site, however, the installation on Lenny is problematic. The following steps explain how to get the install and the configuration done.

Solution

  • Edit /etc/apt/sources.list and add the following lines:
    # 3Ware
    deb http://jonas.genannt.name/debian lenny restricted
  • # wget -O - http://jonas.genannt.name/debian/jonas_genannt.pub | apt-key add -
  • # apt-get update
  • # apt-cache search 3ware
  • # aptitude install 3ware-3dm2-binary 3ware-cli-binary
  • # cd /etc/3dm2
  • # cp 3dm2.conf 3dm2.conf-dist
  • Edit 3dm2.conf set :
    RemoteAccess 1
  • # /etc/init.d/3dm2 restart
  • Browse to https://yourhost:888/
  • Select 3DM 2 Settings and change the default password 3ware to something secure. If you lock yourself out, you can copy the original config file back in place as it has the default password.

References


OpenVZ shared directory mounting from host to guest systems

Problem

An OpenVZ host can share any part of its filesystem with any guest operating system running on it. This post describes how to manually mount a filesystem tree from the host OpenVZ box to a guest, and how to automate the process. We will also address an error that can happen with a correctly configured file preventing the automated mount process.

Solution

Manual mount

To mount a filesystem tree to any guest from the host, run the following:
mount --bind /path/to/tree/on/host ${VE_ROOT}/path/to/tree/on/guest

You need to replace ${VE_ROOT} with /var/lib/vz/root/<guest id>

Automate the mount

There is two options to automate the mount: automation for each guest and automation for a specific guest. The file looks the same either way. For setting up a mount on each guest, use vps.mount and vps.umount as the file names. To use automated mount for a specific guest, use the the filename that is <guest id>.mount and <guest id>.umount. For example, if your container id for your virtual private server (guest) is 123, then the specific files to set the mount and unmount code for are 123.mount and 123.umount. This is how the .mount file needs to look:

#!/bin/bash
source /etc/vz/vz.conf
source ${VE_CONFFILE}
echo "Starting ${VEID}.mount..."
mount --bind /path/to/tree/on/host ${VE_ROOT}/path/to/tree/on/guest
echo "...${VEID}.mount complete"

And this is how the .umount file needs to look:

#!/bin/bash
source /etc/vz/vz.conf
source ${VE_CONFFILE}
echo "Starting ${VEID}.umount..."
umount ${VE_ROOT}/path/to/tree/on/guest
echo "...${VEID}.umount done"

Note that the echo is necessairy, otherwise, the filesystem will most likely not mount correctly. This is due to the fact that on start and restart the vzctl program will call umount first, and if that script fails (returns a non zero exit code) the .mount script isn’t called. Thus, if the directory isn’t mounted and there isn’t an echo at the end of the script, the script returns the exit code of the last command which in this case is the exit code from the failed umount command.

References


Cacti Install on RHEL 5 or CentOS 5

Introduction

Cacti is a great tool to graph performance of the various hardware components of a network. With the use of the yum repository manager, it is very simple to install on Red Hat Enterprise Linux 5 or CentOS 5.

Install steps

  • First make sure that you have the dag repository configured in yum. Edit or create the file /etc/yum.repos.d/dag.repo:
    [dag]
    name=Dag RPM Repository for Red Hat Enterprise Linux
    baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag
    gpgcheck=0
    enabled=1
    protect=0
  • Now install the required packages:
    sudo yum install net-snmp mysql mysql-server cacti
  • Edit the /etc/httpd/conf.d/cacti.conf file to allow access to cacti as needed.
  • Make sure Apache and MySQL are started and set to start automatically:
    sudo service mysqld start
    sudo service httpd start
    sudo chkconfig –level 345 mysqld on
    sudo chkconfig –level 345 httpd on
  • Set up the cacti database in MySQL:
    sudo mysqladmin –user=root create cacti
    cd /var/www/cacti
    sudo mysql cacti < cacti.sql sudo mysql --user=root mysql mysql> GRANT ALL ON cacti.* TO cactiuser@localhost IDENTIFIED BY ‘cactiuser’;
    mysql> SET PASSWORD FOR cactiuser = PASSWORD('my_super_secret_cacti_password');
    mysql> flush privileges;
    mysql> exit
    sudo mysqladmin –user=root password "my_super_secret_root_password"
  • Setup the cacti poll schedule in /etc/crontab:
    */5 * * * * cacti php /var/www/cacti/poller.php > /dev/null 2>&1
  • Run the cacti installer in the browser:
    http://your.server.com/cacti/index.php
    provide the user and password for the database, you can accept all defaults and just click next
  • That is it, you are good to go.

References

Installing Cacti on CentOS with yum


Setting up shared VMWare Fusion host folders on CentOS and RHEL guest

Problem

How to view folders from the Mac that hosts the VMWare Fusion guest operating system CentOS or Red Hat Linux?

Solution

  • First, make sure that the VMWare Tools are installed. That always helps.
  • Next, in the WMWare configuration menu of the guest, set up the desired shared folders. There might be already a default shared folder pointing to the user’s home directory.
  • Next, in the guest OS, ls -ld /mnt/hgfs will display the available shared folders.

References

[CentOS-virt] CentOS 5.1 guide for VMware Fusion


Directing all VPN traffic through the OpenVPN concentrator

Problem

It is necessary for some users to have all their traffic directed through the OpenVPN concentrator. The number one reason for such a configuration is to protect the HTTP traffic over unsecured WiFi (a.k.a. hotspots).

Solution

Add to the bottom of the connecting client’s configuration file (typically under /etc/openvpn/clients.d the following line:
push "redirect-gateway"


Installing RHEL from an AIX NIM master

Summary

The AIX NIM server allows a very flexible automated installation process to deploy hundreds or AIX nodes as well as LPARs in a matter of hours. It is possible to achieve similar results using the RHEL kickstart system. This article is about a way of automating the RHEL 5 deployment directly from AIX 6.1 NIM.

Process

  • Copy the RHEL 5 DVD to an NFS file system. E.g. /nfs/rhel5
  • Configure the NIM server to offer the correct boot image in /etc/bootptab:

    rhel-host1.domain.com:bf=/nfs/rhel5/images/netboot.img:ip=xxx.xxx.xxx.xxx:ht=ethernet::sa=xxx.xxx.xxx.yyy:sm=255.255.255.0:
    rhel-host2.domain.com:bf=/nfs/rhel5/images/netboot.img:ip=xxx.xxx.xxx.zzz:ht=ethernet::sa=xxx.xxx.xxx.yyy:sm=255.255.255.0
  • Configure TFTP on the NIM server in /etc/tftpaccess.ctl:

    # NIM access for network boot
    allow:/usr/lpp/sysback/netinst/boot
    allow:/tftpboot
    allow:/nfs/rhel5/images
  • Restart TFTP and reload INETD:

    stopsrc -s tftpd
    startsrc -a -n -s tftpd
    refresh -s inetd
  • Boot the network client with SMS: remote ip setup (with client ip, server ip, router ip, subnet mask, ping test), multiboot setup (with ethernet as first boot device)
  • Follow the regular RHEL install process. (This is where you can get kickstart going.)
  • Reboot the system and reset the boot order.

Fixing Yum dependency problems on RedHat Linux and CentOS

Yum update fails

I see the question of failed dependencies come up on forums quite a bit. Users post errors like:

Missing Dependency: bind-utils = 9.3.4-10.P1.el5_3.1 is needed bind-sdb-9.3.4-10.P1.el5_3.1

or

ImageMagick-perl-6.2.8.0-4.el5_1.1.x86_64 from installed has depsolving problems
--> Missing Dependency: /usr/lib64/perl5/vendor_perl/5.8.8/x86_64-linux-thread-multi is needed by package ImageMagick-perl-6.2.8.0-4.el5_1.1.x86_64

or

httpd-2.2.3-22.el5.centos.2.x86_64 from updates has depsolving problems
--> Missing Dependency: /usr/share/magic.mime is needed by package httpd-2.2.3-22.el5.centos.2.x86_64 (updates)

In all these cases, the solution is to clean yum:
yum clean all

References


Mount CD/DVD in an AIX or Linux LPAR

To mount a CD or DVD in an LPAR, first you need to use the media library to assign one of the CDs in the library to the LPAR. For example, using the ivm inteface:

  1. Click on the lpar name in the “View/Modify Partitions” section
  2. Select the optical devices tab
  3. Create a virtual optical device if there isn’t one yet
  4. Click modify under current media
  5. Select the CD or DVD from the library
  6. Click OK

Then, you need to mount the media inside the AIX or Linux partition:

  1. Create the /mnt/cdrom directory if it doens’t exist yet: mkdir /mnt/cdrom
  2. Mount the media device: mount -v cdrfs -r /dev/cd0 /mnt/cdrom (on Linux the mount command is slightly different)

Note: on AIX you can edit the file “/etc/cdromd.conf” and add the line “device cd0 /mnt/cdrom” to have the CD or DVD mounted automatically.


Setting up Apache Authentication with htpasswd / htaccess

Authentication in Apache is done through htaccess, either from the configuration file, or from the .htaccess file in a given directory. Note that only full directories can be easily protected with this method.
Here is how: (first log in to the shell, as this method only works if
you have shell access)

$ cd .../html/protected_dir

$ cat > .htaccess

AuthType Basic

Authname "Protected KLC directory"

AuthUserFile ../../control/htpasswd

AuthGroupFile /dev/null

Require valid-user

+d

$ htpasswd -c ../../control/htpasswd user_name

[give passwd]

After the file is created for the first time, to
add more users:

$ htpasswd ../../control/htpasswd user_name

There are also more sophisticated authentication schemes available, that allow database driven authentication. Feel free to contact me for more information about those solutions.


Qmail Autoresponder

Installation

 $ make
 # ./installer
 # ./instshow
 # vi /etc/vmailmgr/vdeliver-postdeliver

And make sure it contains:

 #!/bin/sh
 if test -s $MAILDIR/autoresponse/message.txt
 then
   qmail-autoresponder $MAILDIR/autoresponse/message.txt $MAILDIR/autoresponse
 fi

Then

 # /etc/vmailmgr/vdeliver-predeliver

and make sure it contains:

 #!/bin/sh
 /usr/local/bin/vcheckquota

Then

 # chmod a+x /etc/vmailmgr/*

Usage

Put

 |qmail-autoresponder MESSAGE_FILE DIRECTORY

into your

 .qmail

file before other delivery instructions. MESSAGE_FILE is a pre-formatted response, including headers, and DIRECTORY is the directory into which rate-limiting information will be stored. Any instance of “%S” in MESSAGE_FILE will be replaced with the original subject.

Follow these instructions from the vautoresponder file:

  1. set MAILDIR to the (virtual) user’s mail directory
  2. create a directory “autoresponse” within the user’s mail directory
  3. create a file “message.txt” within the users autoresponse directory