天天看点

在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来修改其属性就可以了。

继续阅读