以 Linux(FreeBSD) 操作系统为例1. 取得 scws-1.2.3 的代码wget http://www.xunsearch.com/scws/down/scws-1.2.3.tar.bz22. 

解开压缩包[hightman@d1 ~]$ tar xvjf scws-1.2.3.tar.bz23. 进入目录执行配置脚本和编译[hightman@d1 ~]$ cd scws-1.2.3

[hightman@d1 ~/scws-1.2.3]$ ./configure --prefix=/usr/local/scws ;

make ;

make install注:这里和通用的 GNU 软件安装方式一样,具体选项参数执行 ./configure --help 查看。

常用选项为:--prefix=<scws的安装目录>4. 顺利的话已经编译并安装成功到 /usr/local/scws 中了,

执行下面命令看看文件是否存在[hightman@d1 ~/scws-1.2.3]$ ls -al /usr/local/scws/lib/libscws.la5.

试试执行 scws-cli 文件[hightman@d1 ~/scws-1.2.3]$ /usr/local/scws/bin/scws -hscws (scws-cli/1.2.3)

Simple Chinese Word Segmentation - Command line usage.Copyright (C)2007 by hightman....

6 用 wget 下载并解压词典,或从主页下载然后自行解压再将 *.xdb 放入 /usr/local/scws/etc 目录中

[hightman@d1 ~/scws-1.2.3]$ cd /usr/local/scws/etc

[hightman@d1 /usr/local/scws/etc]$ wget http://www.xunsearch.com/scws/down/scws-dict-chs-gbk.tar.bz2

[hightman@d1 /usr/local/scws/etc]$ wget http://www.xunsearch.com/scws/down/scws-dict-chs-utf8.tar.bz2

[hightman@d1 /usr/local/scws/etc]$ tar xvjf scws-dict-chs-gbk.tar.bz2

[hightman@d1 /usr/local/scws/etc]$ tar xvjf scws-dict-chs-utf8.tar.bz27.

写个小程序测试一下[hightman@d1 ~]$ cat > test.c#include <scws.h>#include <stdio.h>main(){ scws_t s; s = scws_new(); scws_free(s); printf("test ok!\n");}8. 编译测试程序gcc -o test -I/usr/local/scws/include -L/usr/local/scws/lib test.c -lscws -Wl,--rpath -Wl,/usr/local/scws/lib./test9. 这样就好顺利安装完毕可以使用 libscws 这套 C-API 了10. 如果您需要在 php 中调用分词,建议继续阅读本文安装 php 扩展,否则可跳过不看。 假设您已经将 scws 按上述步骤安装到 /usr/local/scws 中。 安装此扩展要求您的 php 和系统环境安装了相应的 autoconf automake 工具及 phpize 。 1) 进入源码目录的cd /home/scws-1.2.3/phpext/ 目录 ( cd ~/scws-1.2.3 )
    2) 执行 /usr/local/php/bin/phpize #写全phpize的路径 (在PHP安装目录的bin/目录下)
3) 执行 ./configure --with-php-config=/usr/local/php/bin/php-config --with-scws=/usr/local/scws
       若 php 安装在特殊目录 $php_prefix, 则请在 configure 后加上 --with-php-config=$php_prefix/bin/php-config    

4) 执行 make 然后用 root 身份执行 make install

5) 在 php.ini 中加入以下几行[scws];; 注意请检查 php.ini 中的 extension_dir 的设定值是否正确, 否则请将 extension_dir 设为空,;

再把 extension = scws.so 指定绝对路径。;extension = scws.soscws.default.charset = gbkscws.default.fpath = /usr/local/scws/etc

6) 命令行下执行 php -m 就能看到 scws 了或者在 phpinfo() 中看看关于 scws 的部分,记得要重启 web 服务器 才能使新的 php.ini 生效。