实环境:ubuntu 10.04编译安装SPHINX (可能有人已经做过,这里就厚着脸皮再贴一次)

Web、Mail、Ftp、DNS、Proxy、VPN、Samba、LDAP 等基础网络服务
回复
xf22cn
帖子: 75
注册时间: 2007-08-01 12:35
送出感谢: 0
接收感谢: 0

实环境:ubuntu 10.04编译安装SPHINX (可能有人已经做过,这里就厚着脸皮再贴一次)

#1

帖子 xf22cn » 2013-05-11 20:23

1、安装干净系统,设定好IP以便连接外网。
2、安装OPEN-SSH,以便远程登录安装。
apt-get install ssh
3、远程登录后,设定网易163为源
cp /etc/apt/sources.list /etc/apt/sources.list.old
nano /etc/apt/sources.list

删除其中所有内容,复制进163 源:
deb http://mirrors.163.com/ubuntu/ lucid main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ lucid-security main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ lucid-updates main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ lucid-proposed main restricted universe multiverse
deb http://mirrors.163.com/ubuntu/ lucid-backports main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid-security main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid-updates main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid-proposed main restricted universe multiverse
deb-src http://mirrors.163.com/ubuntu/ lucid-backports main restricted universe multiverse
然后,更新源列表
apt-get update
3、安装编译套件和依赖包
apt-get install build-essential
apt-get install binutils-doc gcc-4.4-locales debian-keyring debian-maintainers g++-multilib g++-4.4-multilib gcc-4.4-doc libstdc++6-4.4-dbg gcc-multilib autoconf automake1.9 libtool flex bison gdb gcc-doc
apt-get install libncurses5-dev
apt-get install cmake
4、上传和展开2个必须文件
由于使用的是SecureCRT,所以上传很简单
apt-get install lrzsz
cd /root
rz -be
下载是 sz
选中2个文件,上传。
然后,展开:
tar xzvf coreseek-4.1.tar.gz
tar xzvf mysql-5.5.31.tar.gz

5、设置mysql用户
groupadd mysql
useradd -g mysql mysql
mkdir -p /home/mysql
chown -R mysql:mysql /home/mysql

6、将sphinx引擎源码拷贝到mysql源码包storage目录下
cp -R coreseek-4.1/csft-4.1/mysqlse mysql-5.5.31/storage/sphinx

7、编译安装
cd mysql-5.5.31
cmake . -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_INSTALL_PREFIX:PATH=/usr/local/mysql -DMYSQL_DATADIR:PATH=/home/mysql -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci -DWITH_EXTRA_CHARSETS:STRING=all -DMYSQL_UNIX_ADDR=/tmp/mysqld.sock -DWITH_DEBUG=0 -DWITH_INNOBASE_STORAGE_ENGINE=1 -DWITH_SPHINX_STORAGE_ENGINE=1
make
make install

8、完成安装

cd /usr/local/mysql/
./scripts/mysql_install_db --datadir=/home/mysql --user=mysql
cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf



查看配置文件:
nano /etc/my.cnf

在 [mysqld] 段增加
datadir = /home/mysql

9、设置MYSQL开机自启动

cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysqld

编辑 /etc/init.d/mysqld

nano /etc/init.d/mysqld

把basedir=编辑成basedir=/usr/local/mysql

把datadir=编辑成datadir=/home/mysql


chmod 755 /etc/init.d/mysqld

配置/etc/rc.local文件,加入命令使MYSQL开机自启动
nano /etc/rc.local
在 EXIT 0 前加入一行
service mysqld start



9、启动mysql
service mysqld start

bin/mysqladmin -u root password “password_for_root”

其中引号内的password_for_root是要设置的root密码

service mysqld restart

ln -s /usr/local/mysql/bin/mysql /usr/bin
ln -s /usr/local/mysql/bin/mysqladmin /usr/bin
ln -s /usr/local/mysql/bin/mysqldump /usr/bin




10、安装sphinx引擎
进入Mysql

bin/mysql -uroot -p
输入上面设置的密码后,
在mysql>提示符后面,输入
install plugin sphinx soname "ha_sphinx.so";
然后
show engines;
回复

回到 “服务器基础应用”