Wednesday, November 18, 2009

Upgrade Debian 3.1(sarge) to 4.0(etch)

It look like that to upgrade from Debian 3.1 to 4.0 should be fairly easy; however, the truth is that you will somehow trap by "libc6" loop. Here is a note to solve the problem.


  1. Update 3.1 as best as possible. Modified the /etc/apt/sources.list
    #OldStable
    #deb http://security.debian.org/ lenny/updates main contrib non-free
    #deb http://ftp.us.debian.org/debian/ oldstable main contrib non-free

    sudo apt-get update

    sudo apt-get upgrade

  2. Switch to the etch sources, and update the kernel.
    #etch
    deb http://security.debian.org/ etch/updates main contrib non-free
    deb http://ftp.us.debian.org/debian/ etch main contrib non-free

    sudo apt-get update

    sudo apt-get install linux-image-2.6.18-6-686

  3. Pre-Processing
    apt-get install locales

    Make sure we handle all the dependency issue:
    apt-get install -f

  4. Install the kernel.

    sudo apt-get install linux-image...

  5. Update Grub by running: update-grub

    Edit /boot/grub/menu.lst, set the Default to correct kernel

  6. Edit the tow links to the right kernel:
    /boot/initrd.img initrd.img -> initrd.img-2.6.8-3-686-smp
    /boot/vmlinuz -> vmlinuz-2.6.8-3-686-smp
    , and then Reboot


Tuesday, November 10, 2009

Install Postfix on Ubuntu

A step by step instruction to install a postfix server on ubuntu 8.10:

  1. Install package.
    sudo apt-get install postfix

    1. type of mail configuration: Internet Site

    2. enter your domain name: e.g. not.exist.edu (You have to register a domain name first) Free Register



  2. Install mail utilities if you want to send a email through command line.
    sudo apt-get install mailutils

  3. Write a testing email.
    echo testing_message | mail -s Subject_Not_Important youremail@some.domain.name
    You should get your email in a second. If not, check your SPAM filter/box.

  4. By default, the log files locate at /var/log
    ls -l /var/log | grep mail
    Check log files if you encounter any errors.

Monday, November 9, 2009

How to move mysql datadir to new location

By default the mysql install the datadir at /var/lib/mysql. Unfortunately, people usually did partition their hard disk, or buy a new hard drive later. In such a case, you would like to move the *huge* datadir to another disk to both boost the speed by parallel in I/O and utilize space smartly. Here's what you should do:


  1. Stop your mysql service.
    sudo /etc/init.d/mysql stop

  2. Copying all files from old location to new location and preserver the ownership and timestamp information.
    sudo cp -r -p /var/lib/mysql /newlocation/

  3. Update your mysql configuration file:
    sudo vim /etc/mysql/my.cnf
    datadir     = /newlocation/mysql #old: /var/lib/mysql

  4. Update the second configuration file for apparmor:
      /newlocation/mysql/ r, #/var/lib/mysql/ r,
    /newlocation/mysql/** rwk, #/var/lib/mysql/** rwk,

  5. (Optional) Rename the old folder to prevent confusing.
    sudo mv /var/lib/mysql /var/lib/mysql.bak

  6. Restart your apparmor & mysql service.
    sudo /etc/init.d/apparmor reload
    sudo /etc/init.d/mysql start

  7. Delete the old location
    sudo rm -rf /var/lib/mysql.bak