Friday, 26 June 2009

Debian upgrade from Etch(4.0) to Lenny (5.0) problem

Debian upgrade is easy, just follow this tutorial.

However something don't work after upgrade :

Apache
Problem : virtual host does not work. After apache start, console will show this message
"Apache Warn NameVirtualHost *:80 Has No VirtualHosts Error When Start".

Reason : the parameter "NameVirtualHost" format is changed. See this.

Solution : edit the file /etc/apache2/ports.conf
default
NameVirtualHost *:80
change to
NameVirtualHost *

restart apache : #/etc/init.d/apache2 restart

Samba
Problem : Windows NT/XP(or above) can connect to samba, but win98 fail.

Reason : some default value is changed from "yes" to "no" (They said that it is for security reason). Read the file /usr/share/doc/samba/NEWS.Debian.gz for detail.

Solution : edit the file /etc/samba/smb.conf and add these two lines under [global] section :
client lanman auth = yes
lanman auth = yes
restart samba : #/etc/init.d/samba restart

Important : If the samba user already exist, you have to create it again :
#smbpasswd -a username

Thursday, 25 June 2009

Linux compress filesystem

Our designer who use Photoshop and Illustrator very often. Her data file usually over 500Mbyte each and we don't backup data. She wants to backup data files regularly and ask me some solution.

Nowadays a hard-drive size is very large(1TB/1.5TB/2TB). It is suitable for her. Since we have some out-dated PC so I want to build a linux backup server for all users in office. I use Debian in office over 5 years and I will use Debin Lenny 5.0 to build the backup server.

My initial plan is use a on-the-fly compress filesystem so that we can keep a few day copies of user data files. After search google, I only found two compress file system : compFUSEd and FuseCompress.

There are many information on internet talk about compFUSEd. This article at linux.com is a good one. Howerver the compFUSEd has not beed updated over a year, I don't know whether it is still alive.

I found FuseCompress in Debian sid and I want to try it. However there is no Lenny package so I have to compile it.

Pre-request
Before compile, the following packages must installed:
- libboost*
- pkg-config
- libmagic-dev
- libfuse2
- liblzo2
- libbz2

Download source code and compile
1. goto the website (http://github.com/tex/fusecompress/tree/master), click the 'download' to get source code.
2. #tar -zxvf tex-fusecompress-55c971535363d7bd7656871b8524a13524818cb3.zip
#cd tex-fusecompress-55c971535363d7bd7656871b8524a13524818cb3
#./configure
#make
#make install

Usage
It is easy to use the cmopress filesystem.

fusecompress device mountpoint
e.g.
#fusecompress /tmp/fc /mnt/fc
That means we read/write files at /mnt/fc directory. The directory /mnt/fc will show actual file size and directory /tmp/fc will show compress size.

If you want to write in same location, add -o nonempty option
e.g.
#fusecompress -o nonempty /tmp/fc /tmp/fc
That mans we read/write files at /tmp/fc directory. The directory will only show actual file size.

For more information, you can type :
#man fusecompress
or just run fusecompress command :
#fusecompress (it will show more options)
Note :
- The default compression method is zlib
- It don't compress photo/video/audio file. If you copy file to compress volume, it just copy and no compression.

Benchmark
Before run the backup server in production, I made a little test. The server is AMD Duron 1G CPU, 256M ram, 40G IDE hard-drive and Debian Lenny 5.0 i386.

I copy 2 files from USB thumb drive to hard-drive and compressd volume (default compression method zlib), run cp command in console(text mode, not in X window). Here is the result :

11M text file :
- to Hard-drive : duration 1 second , file size 11M
- to compress volume : duration 3 second, file size 1.2M

2G photoshop file :
- to Hard-drive : duration 1 mintue, file size 2G
- to compress volume : duration 17 mintues, file size 1.3G

The result is good, it really save hard-drive space. I will run the backup server in office.

Tuesday, 23 June 2009

Linux Distribution

在newsgroup經常有人問:作為 desktop(或server) 應該選擇那個 Linux Distribution ?

其實只要選一些有名氣的Distribution 便可, 例如:Fedora, Ubuntu, openSUSE, Mandriva。至於它們有什麼分別, 現在可不必理會, 反正它們是免費的, 第一個不好用, 轉用第二個, 第二個不好用, 轉用第三個...

初學Linux一定會遇到困難, 我建議買一本書要含Linux CD的,跟著書一步一步做便不會有錯。遇到問題很多人會在網上發問, 但發問也要問得smart, 例如時常有人問:"help, 我的linux不能play mp3 !" 你應該說明你是用那個 distribution 和版本, 例如說 "我是用 fedora 10"。

如果你在問題前加"請問"或問題後加"謝謝", 我相信會有更多人樂意解答。

Thursday, 18 June 2009

Linux - bash (3)

尋找 ... 然後 ...

例 1 : 尋找 sub-folder , 然後改 permission 為 755
#find . type d -exec chmod 0755 {} \;

例 2 : 尋找檔案日期是30 天前 , 然後 delete
#find . -mtime +30 -daystart -exec rm -i {} \;

Wednesday, 17 June 2009

ireport 3.5.2 is released

ireport 3.5.2 is released. The most expected feature is print barcode(This feature was exist in old version).

There are 2 barcode modules : Barbecue and Barcode4J. What's the different ?



Linux - bash (2)

檔案名稱由大楷轉小楷 :

for i in `ls`
do mv $i `echo $i | tr '[A-Z]' '[a-z]'`
done

Monday, 15 June 2009

Portable Windows

My friend make a software called "Portable Linux Embracing Windows (PLEW)". It save the whole Windows (XP/ME) into USB drive so that the Windows is portable. That means you can use the USB drive to boot any computer. Click here to see the details.

Linux - bash (1)

很喜歡寫 bash script, 因為功能很強. 但初學 bash 時, 覺得它太笨 , 例如 :

#/!bin/bash
theday = 'today'

第二行是錯的, 因為 "=" 前後不可有空格

#/!bin/bash
theday='today'

要這樣才對 !

Wednesday, 3 June 2009

千與千尋——久石讓 • 宮崎駿動漫視聽大型交響音樂會

昨天在網上訂購音樂會門票 : 『千與千尋——久石讓 • 宮崎駿動漫視聽大型交響音樂會』, 我是買最平的$198元. 雖然$198元門票只得二十多個坐位, 但不夠三十分鐘便訂購一空了. 最貴$638 元有十多個座位, 也在一小時內賣清. 香港人真喜歡宮崎駿電影.

但是音樂會演出地點是深圳呀 ! 一來一回除了浪費時間, 也浪費車錢.

第一次學人寫 blog

第一次學人寫 blog, 請多多指教