Thursday, January 25, 2007

On a quest to get a 3D desktop

I'm very excited with 3D desktop after watching AIGLX and XGL in action with beryl or compiz window manager. I haven't been able to get it run on my computer with my video card since it is not supported composite extension and DRI simultaneously. The ATI's proprietary driver (fglrx) I use, doesn't support dri and composite extension simultaneously. I downloaded kororaa live CD to try it out and I was amazed.

At one point, I downloaded xorg, compiz and Mesa from cvs and I managed to get Xorg compiled with Xgl enabled but I couldn't get compiz to run because there was no composite extension.

Picture above is a screenshot of my desktop running dropline GNOME on Slackware and Xgl running in a window with KDE as the window manager. It's like running X in X or nested X.

However, I'm still trying... :)

Other links:
Xgl,compiz and Mesa - http://www.freedesktop.org/wiki/Software_2fXgl
Dropline GNOME - http://www.droplinegnome.org/

Monday, January 15, 2007

Upgrading dbmail

Last week, I upgraded my production imap server from dbmail 2.0.9 to the latest stable 2.2.1. I need to upgrade because there are features I need to use. They are:

1. server-side sorting (fixed after 2.1.7)
2. sieve server-side filter (using dbmail-timsieved daemon)

The upgrade was a risky one. It was a leapfrog from 2.0.x to 2.2.1 by skipping 2.1.x. Many changes since 2.0. Since I did not have a test server so it was important to backup all emails. After too much thought, I decided to give it a go.

Stopping the mail server
These stops all necessary mail-related services. You may not want to stop httpd services to make announcement to users on the website. You have to stop services in order to migrate your system smoothly without bothering emails coming in and out and slow down the whole process.

service postfix stop
service dbmail-imapd stop
service dbmail-lmtpd stop


Backing up all emails
It is important to backup all emails before upgrading process. At least you can revert to previous dbmail if something go wrong.

mysql -u dbmail -p dbmail > dbmail-2.0.9.sql

Source
Download the source from dbmail.org and untar it.

tar xzvf dbmail-2.2.1.tar.gz
./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var --with-mysql --with-sieve

Note: If you want to use sieve filter (--with-sieve), you have to download libsieve at http://libsieve.sourceforge.net/. Compile it and install.

make
make install

Migrate the database
Use the provided script in sql dir to migrate dbmail tables to make it suitable for 2.2.x

mysql -u dbmail -p dbmail <>

Fix the header

/usr/sbin/dbmail-util -by

If you do not run this command, you will get unknown (for sender) and (no subject) (for subject) for all mails in mail header. Please make sure it is the latest binary you're running by issuing dbmail-util -V.

Please watch any error coming out of the upgrade process. If any, you should consult dbmail mailing list.

That's all there is to it. Restart all the process (or you may want to restart your server). Make sure all the related services start during startup with chkconfig.

dbmail-timsieved init-script
This is a script I make for dbmail-timsieved by modifying dbmail-imapd script. Clever huh? :P


#!/bin/bash
#
# Startup script for the DBMail TimSieve Server
#
# chkconfig: - 81 19
# description: DBMail is a mail server with a database backend. Unlike \
# WUimapd it does not run through inetd.
# processname: dbmail-timsieved
# pidfile: /var/run/dbmail-timsieved.pid
# config: /etc/dbmail.conf

# Source function library.
. /etc/rc.d/init.d/functions

if [ -f /etc/sysconfig/dbmail ]; then
. /etc/sysconfig/dbmail
fi

# Path to the dbmail script.
dbmail=/usr/sbin/dbmail-timsieved
prog=dbmail-timsieved
RETVAL=0

start() {
pid=`pidof $prog`
if [ -n "$pid" ]
then
echo "dbmail timsieved daemon is already running, PID $pid"
else
echo -n $"Starting $prog: "
daemon $dbmail
RETVAL=$?
echo
[ $RETVAL = 0 ] && touch /var/lock/subsys/$prog
return $RETVAL
fi
}
stop() {
echo -n $"Stopping $prog: "
killproc $dbmail
RETVAL=$?
echo
[ $RETVAL = 0 ] && rm -f /var/lock/subsys/$prog /var/run/$prog.pid
}
reload() {
echo -n $"Reloading $prog: "
killproc $dbmail -HUP
RETVAL=$?
echo
}

# See how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status $dbmail
RETVAL=$?
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/run/$prog.pid ] ; then
stop
start
fi
;;
reload)
reload
;;
*)
echo $"Usage: $prog {start|stop|restart|condrestart|reload|status}"
exit 1
esac

exit $RETVAL

Monday, January 8, 2007

How to make VCD with K3B using Linux




If you have a video file ie .avi, or .mp3 and you would like to burn to CD in VCD format so that you can play it with your vcd player. This is how I did it.

avi file

Let's say you have a .avi video file named myvideo.avi. You have to convert it
to mpg.

ffmpeg -i myvideo.avi -target pal-vcd myvideo.mpg

(Note: the -target command requires at least version 0.4.9 of ffmpeg)

Burn it!
Using k3b, a KDE burning software, you can burn it to cd in vcd format by selecting File -> New -> New Project -> New Video CD Project menu. Please make sure the file size does not exceed the storage size of the CD. If there is an error indicating vcdxbuild binary not found, you need to install vcdimager package.

Problem: There is no vcdimager package for Slackware as I know of. After searching high and low (even using slapt-get was no help), I opted to download sources: vcdimager, libpopt and libcdio source packages.

For all this source,

./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var

and as usual,

make; make install

After compiling and installing all of these packages, k3b should be able to find vcdxbuild binary and successfully burn the file to cd in vcd format.

Links
vcdimager : http://www.vcdimager.org
popt library : http://directory.fsf.org/libs/popt.html
libcdio : http://www.gnu.org/software/libcdio/

Friday, January 5, 2007

Happy New Year 2007

We are now in 2007. Happy New Year for everybody. The time seems running fast.

Let us hope this year will bring us happiness and success. 

Sunday, December 24, 2006

Setting up name-based virtual host on apache

I just finished setting up name-based virtual host for one of my clients. The server is Red Hat Linux Enterprise 4 update 4 (RHEL) with public IP. After I have successfully setting up DNS server correctly in particular to access to this server, this is how I setup name-based virtual host for it.

What is name-based virtual host?
A feature for webserver (ie apache,IIS etc) to serve many websites with one IP. The server will serve webpages accordingly based on the name of the site (ie www.example.com , mail.example.com , blog.example.com etc2).

Let's do it.
This tip is for Red Hat and maybe the same for Fedora Core (FC). On Mandriva and other distros, the directive to change may be in different files and different folders.

Step 1
Open up /etc/httpd/conf/httpd.conf with your favorite text editor (I personally use joe in console).

Step 2
Coment out this line:

NameVirtualHost *:80


Step 3
Comment out these lines (in the VirtualHost containers and change accordingly to your server name:

ServerAdmin testuser@example.com
DocumentRoot /var/www/html/
ServerName www.example.com
ErrorLog /var/log/www.example.com.log
CustomLog /var/log/www.example.com.common.log common


ServerAdmin testuser2@example.com
DocumentRoot /var/www/html/email
ServerName mail.example.com
ErrorLog /var/log/mail.example.com.log
CustomLog /var/log/mail.example.com.common.log common


Note:
See the DocumentRoot directive in each VirtualHost container. It is different. And also see the difference of ServerName directive. It is used by Apache to differentiate the website served based on the name.

Step 4
Restart apache by issuing "service httpd restart" in console (without the double quote). Notice any error if any.

Step 5
Now you can try accessing your server with www.example.com and mail.example.com. See if it serves the right page. If yes, congratulations. You have successfully done it.

That's all there is to it. Have fun.

Wednesday, December 13, 2006

The new ShoutMix ShoutBox v2



At last the long awaited ShoutMix ShoutBox v2 is ready for prime time now and this time AJAX is used for real time update. It has many new features though. To know more, please register at shoutmix site and explore yourselve. For heavy or corporate users, you are encouraged to register as a premium user with affordable price and enjoy more features.

More news here and here.

Thursday, November 2, 2006

connecting to SSH server passwordless

If you have to connect to an SSH server frequently or you want to make a shell script using ssh, you might want to consider connecting to it passwordless. This trick is now new. I have heard about this long time ago but didn't have any necessity for it so I ignored it until recently.

by the time of this writing, I have just completed my script for backup using SSH passwordless. Here I want to share the way I did it in a simple way. I hope it benefits others. Bear in mind that, all ssh utilities like sftp, scp and ssh can use passwordless connection once we complete setup one.

Step 1
  • Connect to SSH server and open up sshd_config in /etc/ssh or equivalent. Check your distro documentation.
  • Make sure you have the following entries:
    # Allow Identity Auth for SSH1?
    RSAAuthentication yes

    # Allow Identity Auth for SSH2?
    PubkeyAuthentication yes

    # Authorized Keys File
    AuthorizedKeysFile ~/.ssh/authorized_keys
Step 2
  • Make RSA keys using ssh-keygen in your home directory of ssh client.
    $ cd ~  
    $ mkdir identity-test
    $ cd identity-test
    $ ssh-keygen -f id_rsa -t rsa
    Generating public/private rsa key pair.
    Enter passphrase (empty for no passphrase):
    Enter same passphrase again:

    Your identification has been saved in id_rsa.
    Your public key has been saved in id_rsa.pub.
    The key fingerprint is:
    c3:af:e9:6c:2f:19:4d:b5:1a:a9:40:06:54:e6:60:08 me@localhost
  • look at the created files
    $ ls
    id_rsa id_rsa.pub

    The id_rsa.pub contains the public key and id_rsa contains private key.
  • copy the content of id_rsa.pub to ~/.ssh/authorized_keys
    Two ways to achieve this
    1. login to ssh server and paste the content into the file
    2. using scp to copy the content into the file
  • So, let's test logging in with this key. Since we have put the test key in a non-standard place, we will need to reference it explicitly on the command line:
    $ ssh username@server -i ~/identity_test/id_rsa
    $username@server$ hostname
    $server
    $username@server$ exit

    $ ssh username@server -i $HOME/identity_test/id_rsa "echo Success!"
    Success!
    $
  • In the above examples, if you can login without password then the setup is a success. If not, please recheck the setup.
Have fun ssh'ing :)

Nvidia new hotplug feature on Linux

 If you use nvidia driver for your GPU, you probably wonder why in some config, you can't hotplug your second monitor. You need to reboo...