Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!


[GUIDE/SCRIPT] MySQL 5.5.23 + Sphinx 2.0.4
New on LowEndTalk? Please Register and read our Community Rules.

All new Registrations are manually reviewed and approved, so a short delay after registration may occur before your account becomes active.

[GUIDE/SCRIPT] MySQL 5.5.23 + Sphinx 2.0.4

WilliamWilliam Member
edited June 2012 in Tutorials

After it took me weeks, if not months, to figure out how to do it correctly here is a guide (well, script) to do it.
(DEBIAN 6 ONLY - DO NOT SIMPLY RUN THIS - READ AND EDIT)

groupadd mysql
useradd -r -g mysql mysql
echo "deb http://packages.dotdeb.org stable all" >> /etc/apt/sources.list
echo "deb-src http://packages.dotdeb.org stable all" >> /etc/apt/sources.list
wget http://www.dotdeb.org/dotdeb.gpg && cat dotdeb.gpg | apt-key add - && rm dotdeb.gpg
apt-get update
apt-get install libncurses5-dev unzip screen -y
apt-get build-dep mysql-server-5.5 -y
apt-get source mysql-server-5.5 -y
wget http://sphinxsearch.com/files/sphinx-2.0.4-release.tar.gz
wget "http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.23.tar.gz/from/http://mirror.leaseweb.com/mysql/" -O mysql-5.5.23.tar.gz
tar -xvzf mysql-5.5.23.tar.gz
tar -xvzf sphinx-2.0.4-release.tar.gz
rm *.tar.gz
rm mysql-5.5_5.5.23-1~dotdeb.0.dsc
mv mysql-5.5.23 mysql-5.5.23-ORG
cp -a mysql-5.5.23-ORG/Docs mysql-5.5-5.5.23/
cp -R /root/sphinx-2.0.4-release/mysqlse /root/mysql-5.5-5.5.23/storage/sphinx
cd mysql-5.5-5.5.23/
sh BUILD/autorun.sh
./configure --build=x86_64-linux-gnu --host=x86_64-linux-gnu --prefix=/usr --exec-prefix=/usr --libexecdir=/usr/sbin --datadir=/usr/share --localstatedir=/var/lib/mysql --includedir=/usr/include --infodir=/usr/share/info --mandir=/usr/share/man --with-server-suffix="williams-finest-blent" --with-comment="(Debian6)" --with-system-type="debian-linux-gnu" --enable-shared --enable-thread-safe-client --enable-assembler --enable-local-infile --with-pstack --with-fast-mutexes --with-big-tables --with-unix-socket-path=/var/run/mysqld/mysqld.sock --with-mysqld-user=mysql --with-libwrap --without-readline --with-ssl --without-docs --with-extra-charsets=all --without-ndbcluster --with-embedded-server --with-embedded-privilege-control
make
make install
make install scripts
mkdir /etc/mysql
cd /etc/mysql/
######add my.cnf download/creation here######
cd
######download mysql dumps and sphinx config here if available######
cd sphinx-2.0.4-release/
apt-get install libmysqlclient-dev -y
./configure
make
make install
cd /usr/local/etc/
cp /root/sphinx.conf sphinx.conf
mkdir /var/data/
mkdir /var/data/sphinx/
mkdir /var/lib/mysql/
mkdir /var/run/mysqld/
chown -R mysql:mysql /var/run/mysqld/
mkdir /usr/share/mysql/
cd /usr/share/mysql/
wget http://fr.edis.at:8080/william/mysqldocs.zip
unzip mysqldocs.zip && rm mysqldocs.zip
chown -R mysql:mysql /var/lib/mysql/
cd /usr/
/usr/scripts/mysql_install_db
/usr/bin/mysqld_safe --skip-grant-tables &
mysql -uroot -hIP mysql
#update user set Password=PASSWORD('NEWPASS') WHERE User='root';
#flush privileges;
for pid in $(ps aux | grep mysql | grep -v grep | awk '{print $2}'); do kill -9 $pid; done
screen -S mysqld
mysqld
#CTRL+AD
mysql -uroot -pNEWPASS mysql
#CREATE USER 'USER'@'%' IDENTIFIED BY 'NEWPASS';
#CREATE USER 'USER'@'mysql' IDENTIFIED BY 'NEWPASS';
#CREATE USER 'USER'@'127.0.0.1' IDENTIFIED BY 'NEWPASS';
#CREATE USER 'USER'@'localhost' IDENTIFIED BY 'NEWPASS';
#create database predb;
#GRANT ALL PRIVILEGES ON *.* TO 'USER'@'%';
#GRANT ALL PRIVILEGES ON *.* TO 'USER'@'mysql';
#GRANT ALL PRIVILEGES ON *.* TO 'USER'@'127.0.0.1';
#GRANT ALL PRIVILEGES ON *.* TO 'USER'@'localhost';
#INSTALL PLUGIN sphinx SONAME 'ha_sphinx.so';
#flush privileges;
cd /etc/init.d/
wget -O mysql-sphinx http://fr.edis.at:8080/william/mysqlinit
wget -O searchd http://fr.edis.at:8080/william/searchdinit
chmod +x mysql-sphinx
chmod +x searchd
mkdir /var/log/mysql
mkdir /var/log/sphinx
cd /root
#IMPORT DB
indexer --all --rotate
searchd
/usr/local/bin/indexer --rotate delta

Comments

  • DerekDerek Member

    Smart Cookie

  • @Derek said: Smart Cookie

    ....?

  • miTgiBmiTgiB Member

    @William said: ....?

    Like a SmartBomb, but tastes better?

  • yomeroyomero Member

    @William

    Sorry, I am noob, but what is the purpose of Sphinx? I've read the homepage/about page, but what can I do exactly with this software? :P

  • KairusKairus Member

    @yomero said: Sorry, I am noob, but what is the purpose of Sphinx? I've read the homepage/about page, but what can I do exactly with this software? :P

    It's a really good search engine/server. I used to use it on a large IPB forum, it cuts load down a LOT and returns queries extremely fast.

  • AdamAdam Member
    edited June 2012

    @Kairus said: It's a really good search engine/server. I used to use it on a large IPB forum, it cuts load down a LOT and returns queries extremely fast.

    ^This. Quick full-text searches! And it's useful when doing partial keyword matching, as it returns a sorted array with a 'likeness' score.

  • yomeroyomero Member
    edited June 2012

    @Kairus said: I used to use it on a large IPB forum

    So, there is a way to integrate it with the forum... interesting.

    @Adam said: it returns a sorted array with a 'likeness' score.

    This may help me for something... hmmm

  • All popular forum implementations either support it natively, or have plugins for doing the same.

    Fact is, anywhere you have a large search load (that deals with mysql), you should be using sphinx.

    Thanks William for the guide, I'm sure it'll be useful for lots :)

  • yomeroyomero Member

    @Wintereise said: All popular forum implementations either support it natively, or have plugins for doing the same.

    Ty n_n
    I am a SMF user, and it seems there is a mod around for this. Maybe I will try it :P

    Thanked by 1djvdorp
  • WilliamWilliam Member
    edited June 2012

    As note:
    The initscripts are by me and (c) William under GPL (since i'm required by law to use some license here)

    Thanked by 1djvdorp
  • @William said: since i'm required by law to use some license here

    I'm curious: If you don't, won't it default to a regular all-rights-reserved kind of thing?

  • Well, it should, but better be on the safe side :)

  • @Wintereise said: Fact is, anywhere you have a large search load (that deals with mysql), you should be using sphinx

    or google which supports operators, saves server load, has networks around the world, and even supports cached pages when you site is down.

  • WilliamWilliam Member
    edited July 2012

    Google is not usable when you need mysql or similar.

    Also:

    Free quota

    Usage is free for all users, up to 100 queries per day.

  • bobbybobby Member
    edited July 2012

    "create database predb;"

    lol :)

  • great guide,any site for this like gide shareing?

  • WilliamWilliam Member
    edited July 2012

    @bobby said: "create database predb;"

    Eh, lets pretend no one has seen it :p

  • manmamanma Member

    @ynzheng said: great guide,any site for this like gide shareing?

    I don't know, but someone should really buy lowendscript.com and put some kinda wiki up.

  • lowendscript.com is gone

Sign In or Register to comment.