Monday, January 29, 2007

中毒

近來聽到有個朋友電腦常常中毒,令到上網等也變得很慢,問我怎解決。我也不知怎好,雖然我讀計算機科學,但我讀的東西真的是幾科學,而不是一般應用的層面。要修理電腦,還是街邊的電腦鋪專業一點。

尤其中毒這問題,還是重裝Windows是最易解決的方去。當然,要是我的電腦中毒,我並不會即刻重裝,而要先試其他方法。但好幾年來,我好像也未試過中毒。或許因為我懂得小心使用我的電腦,這包括:
  1. 要經常更新Windows。
  2. 不要亂開其他人傳來可執行的檔案,即通常是.exe尾的。
  3. 使用Firefox來瀏覽網頁。IE與Windows太緊密連繫,容易受攻擊。有時甚至用舊版本的IE來瀏覽某些網站亦會中招。
其實我建議了我朋友使用GNU/Linux。這個作業系統較Windows安全,不容易受到攻擊。不過我又怕他有什麼問題也會來找我,因為相信他的朋友一般也不使用這個免費兼自由的作業系統(OS)。但如果Windows 突然有事,但又想上網的話,或者可以試用一下這個OS。Ubuntu提供了Live CD讓人在不影響現有的OS下仍可一試使用它的感覺。方法如下:
  1. Ubuntu 下載網站找一個近自己的mirror,再下載供PC用的CD Image,如這裏
  2. 用這個CD Image 燒錄到一個光碟上。(不是將這檔案抄到CD上)
  3. 將這CD放入電腦,再重新開機。如果你的電腦容許用CD開機的話,你便會看到Ubuntu了。可以用Firefox 來瀏覽網頁,Gaim來MSN/ICQ,OpenOffice來修改MS Office的文件。但小心,修改了的文件要儲進自己的硬碟或傳到自己的電郵。
如果堅持要使用正版的朋友更加要試用一下這系統。因為它是完全免費的,用了後可省回數百至數千元的軟件費用!

Linux on FreeBSD 6.2

As I mentioned before, I love FreeBSD, without any particular reason. I want to migrate from Ubuntu to FreeBSD, but two Linux applications are holding me back. They are Flash 9 and Gnucash2.

The Flash 9 is required to see some NBA highlights video clips on ESPN.com, but Adobe haven't released version 9 for FreeBSD. It released one for Linux but I heard that (and found that) it crashes often on FreeBSD even it is available in the "port".

Another application is Gnucash. Gnucash 2 is a significant upgrade from version 1.8, since it uses version 2 of Gtk/Gnome instead of version 1. I think it is more user-friendly than the old version and I have been using it for some time on Ubuntu. However, I didn't find Gnucash 2 in the port. There is a unofficial port in the mailing list, as noted by the Wiki on Gnucash site, but I couldn't get it to run.

So I tried to use run the Linux version of Gnucash 2 on FreeBSD. The Linux base availabe on FreeBSD is Fedora Core 4. I have installed it for some time, since it is needed for the acroread7. So I downloaded the Gnucash2 RPM from the Fedora Core 6 site. When I installed using RPM, it failed, saying that the dependencies failed. However, I did find those depended files under /compat/linux (e.g. /bin/sh was reported as missing but I could find it at /compat/linux/bin/sh). After trying for some time, I found that there is a nodeps option for RPM. And later, I found that when the linux_base-fc4 installs the Fedora Core 4 on my FreeBSD, it just extracted the files to /compat/linux using rpm2cpio, but didn't register the installed RPM on the RPM database under /compat/linux/var/lib/rpm. So I tried to install the RPM for the Fedora Core again. But it was tedious due to the dependencies, and I needed to download many other RPM like glibc2, ORBit, etc. finally, when I tried to install the glibc2 or something similar on the system, it says it requires a Linux 2.6 kernel! But I read that FreeBSD is only compatible for the kernel 2.4. So the whole RPM experiment failed. Nevertheless, I have learned how to use the RPM system, and here are some tips for using it on FreeBSD:
  • It is better to set an alias for rpm with a root option to /compat/linux, so that it won't accidentally modified the files on the FreeBSD system. It can be set in .cshrc as
    alias rpm rpm --root /compat/linux
I once didn't set it and accidentally modified a system lib. So I have to go to "make installworld" to restore it.
  • I tried to install the RPM for the FC4 base system. But I think it is better to just register the RPM without modifying the file system. There is a --justdb option which modifies only the DB without touching the file system. So something like this can be used (with the --root /compat/linux set as alias already):
    rpm -Uhv --justdb --nodeps /usr/ports/distfiles/rpm/i386/fedora/4/*.rpm