Centos環境下Sphinx的安裝

2021-07-27 18:06:48 字數 2251 閱讀 4590

解壓 $ tar -zxvf name.tar.gz 

gcc-c++  

libstdc++-devel

ncurses-devel

bison

autoconf

automake

libtool-2.*

expat-dev*

expat-2*

mysql-devel

安裝命令: yum -y install 包名(支援*) :自動選擇y,全自動

$ cd cmake-cmake-2.8.9 

$ ./bootstrap

$ make && make install

預設安裝在 /usr/local/bin 下面,要改變安裝路徑,在bootstrap命令中加入'--prefix=path'選項。

$ cp -r sphinx-version/mysqlse mysql-version/storage/sphinx  

$ cd mysql-version

$ sh build/autorun.sh

$ ./configure --with-plugins=sphinx

$ make && make install

$ cd /usr/local/mysql-version

$ mkdir -p /var/log/mysql /usr/local/mysql/etc

$ cp support-files/my-default.cnf /usr/local/mysql/etc/my.cnf

#然後修改my.cnf

[mysqld]

basedir = /usr/local/mysql

datadir = /usr/local/mysql/data

user = root

#初使化資料庫

$ scripts/mysql_install_db --user=root --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data/ --defaults-file=/usr/local/mysql/etc/my.cnf

#起動並登入

$ ./bin/mysqld_safe --defaults-extra-file=/usr/local/mysql/etc/my.cnf --user=root &

$ mysql -uroot

$ ln -s /usr/local/mysql/bin/mysql /usr/bin (when mysql: command not found)

$ cp /usr/local/mysql/etc/my.cnf /etc/my.cnf

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

$ service mysql start|stop|restart

/*新增服務到自啟動項*/

$ chkconfig --level 3 mysql on

mysql>install plugin sphinx soname "ha_sphinx.so";  

mysql>show engines; #engine列表顯示出sphinx表示安裝成功

安裝sphinx

$ ./configure --prefix=/usr/local/sphinx --with-mysql 

$ make && make install

mysql編碼設定 

編輯mysql的配置檔案/etc/my.cnf 

–在 [mysqld] 標籤下加上三行 

character_set_server = utf8 

lower_case_table_names = 1 表名不區分大小寫(此與編碼無關) 

–在 [mysql] 標籤下加上一行 

default-character-set = utf8 

–在 [mysql.server]標籤下加上一行 

default-character-set = utf8 

–在 [mysqld_safe]標籤下加上一行 

default-character-set = utf8 

–在 [client]標籤下加上一行 

default-character-set = utf8 

CentOS 環境下 搭建 LNMP環境

關掉防火牆,避免實驗中出現伺服器無法訪問的情況 chkconfig iptables off安裝lnmp環境所需的開發包和庫檔案 yum y install ntp make openssl openssl devel pcre pcre devel libpng libpng devel libj...

CentOS下搭建nginx php環境

參見 不再贅述 wget 解壓 tar zxvf php 5.6.7.tar.gz 編譯 configure prefix usr local php enable fpm with fpm user www with fpm group www with mysql u01 mysql5.6.23...

centos 下安裝lnmp環境

使用 yum 安裝 nginx yum install nginx yms 修改 etc nginx conf.d default.conf,去除對 ipv6 位址的監聽 示例 etc nginx conf.d default.conf server error page 404 404.html ...