linux下安装sphinx

一、

wget http://sphinxsearch.com/files/sphinx-1.10-beta.tar.gz
tar zxvf ./sphinx-0.9.9.tar.gz
cd /sphinx-0.9.9/
./configure --prefix=/usr/local/sphinx/
make 
make install

好像不需要make install 直接make就可以了

二、
在/ect/init.d/创建searchd 文件
内容如下
#!/bin/bash
#
# Init file for searchd
#
# chkconfig: 2345 55 25
#
# description: searchd 
#
# USE "chkconfig --add searchd" to configure Sphinx searchd service
#
# by Vladimir Fedorkov Mar 1, 2006, [email protected]
# public domain

SUDO_USER=searchd

BASE_PATH=/usr/local/sphinx
PID_FILE=$BASE_PATH/var/log/searchd.pid
CONFIG_FILE=$BASE_PATH/etc/sphinx.conf

EXEC_PATH=$BASE_PATH/bin
DATA_PATH=$BASE_PATH/var/data
LOG_PATH=$BASE_PATH/var/log

RETVAL=0
prog="searchd"

do_config() {
  mkdir -p $DATA_PATH
  mkdir -p $LOG_PATH
  chown -R $SUDO_USER $DATA_PATH
  chown -R $SUDO_USER $CONFIG_FILE
  chown -R $SUDO_USER $LOG_PATH

  chmod 600 $CONFIG_FILE
  chmod u+rwx $EXEC_PATH/*
  chmod -R u+rw,go-rwx $DATA_PATH
  chmod -R u+rw,go-rwx $LOG_PATH
}

do_start() {
  echo "Starting $prog"
  sudo -u $SUDO_USER $EXEC_PATH/$prog --config $CONFIG_FILE
  RETVAL=$?
  echo
  return $RETVAL
}

do_stop() {
  echo "Stopping $prog"
  if [ -e $PID_FILE ] ; then
    kill -15 `cat $PID_FILE`
    sleep 5
    if [ -e $PID_FILE ] ; then
      kill -9 `cat $PID_FILE`
    fi
  fi
  RETVAL=$?
  echo
  return $RETVAL
}

case $* in

config)
  do_config
  ;;

start)
  do_start
  ;;

stop)
  do_stop
  ;;

restart)
  do_stop
  do_start
  ;;

*)
  echo "usage: $0 {start|stop|restart|config}" >&2

  exit 1
  ;;
esac

exit $RETVAL
 
先将sphinx.conf  配好,然后启动/etc/init.d/searchd start,就可以了。
 
三、sphinx.conf  配置文件  自己从网上查!
四、用程序测试,自己从网上查!
 

 

 

你可能感兴趣的:(linux,职场,sphinx,休闲)