天天看點

在Linux fedora 5上安裝本地dictd server的方法

1.  使用root登入後,在指令行提示符下用:

[[email protected] ~]# yum install dictd

安裝上dictd,你可以在指令行上使用如下三個指令:

a.   [[email protected] ~]# dictd  結果是:

      [[email protected] ~]#

b.   [[email protected] ~]# dict 結果為:

dict 1.9.15/rf on Linux 2.6.15-1.2054_FC5smp

Copyright 1997-2002 Rickard E. Faith ([email protected])

Use --help for help

[[email protected] ~]#

c. [[email protected] ~]# dictfmt 結果為:

[[email protected] ~]# dictfmt

dictfmt v. 1.9.15 December 2000

Copyright 1997-2000 Rickard E. Faith ([email protected])

Usage: dictfmt [-c5|-t|-e|-f|-h|-j|-p] -u url -s name [options] basename

Create a dictionary databse and index file for use by a dictd server

-c5       headwords are preceded by a line containing at least

                5 underscore (_) characters

。。。。。。

以上結果表明dictd 安裝正确。

    說明:1.  在/usr/bin/下有dict、dictfmt指令;在/usr/sbin/下有dictd指令;在/etc/init.d/目錄下有dictd檔案用來啟動dictd server,後面我會談到如何啟動。

                2. 你可以到ftp://ftp.dict.org/pub/dict/下載下傳 dictd-1.9.15.tar.gz 解壓縮,照着檔案中的去做,但我在make的時候出現了編譯錯誤,是以沒法分享

2. 編寫配置檔案和下載下傳字典資料庫

  現在本地dictd server還不能工作,你必須寫兩個配置檔案dictd.conf和dict.conf(存儲到/etc/目錄下)他們的内容如下:

dictd.conf:

  access {allow localhost allow *}

  database web1913   { data "/usr/local/lib/dict/web1913.dict.dz"

                           index "/usr/local/lib/dict/web1913.index" }

dict.conf:

server localhost

從dictd.conf檔案中可以看到web1913.dict.dz和web1913.index是兩個檔案,這就是字典資料庫檔案,你可以從

ftp://ftp.dict.org/pub/dict/pre下載下傳 dict-web1913-1.4-pre.tar.gz後,解壓縮到/usr/local/lib/dict/目錄下。他們的名字分别為:web1913.dict.dz和web1913.index

Note:如果你想要配置成可以從其他機器查詢dictd server,可以參考:http://www.newsmth.net/pc/pccon.php?id=6147&nid=152430

            我上面的配置檔案及有關内容,你還可以參考:

http://docs.kde.org/stable/en/kdenetwork/kdict/obtaining-databases.html

3. 測試和啟動你的本地dictd server

1. 首先用這些指令:dictd --test-show-info web1913 顯示有關資料庫web1913的資訊,如果沒有錯誤的話,表明一切正常,你可以啟動你的dictd server了。

2. 啟動

[[email protected] ~]# /etc/init.d/dictd start

接下來:

你可以

[[email protected] ~]# dict word

查找到單詞了吧,恭喜你,成功了。

Note:也許你會在執行dictd --test-show-info web1913或任何其他測試有關web1913時,碰到這個錯誤:

:I: 3817 starting dictd 1.9.15/rf on Linux 2.6.15-1.2054_FC5smp Sun Jul 30 10:06:21 2006

:E: /usr/local/lib/dict/web1913.index is not readable (index file)

:E: /usr/local/lib/dict/web1913.dict.dz is not readable (data file)

:E: for security, this program will not run as root.

:E: if started as root, this program will change to "dictd" or "nobody".

:E: currently running as user 99/nobody, group 99/nobody

:E: config and db files must be readable by that user

dictd (sanity): :E: terminating due to errors. See log file

(sanity) :E: terminating due to errors. See log file

[[email protected] ~]#

恭喜你,你跟我一樣慘,還好,我已經知道了,你可以用chmod 777 /usr/local/lib/dict/web1913.index來修改其屬性就可以了。

繼續閱讀