Created
October 31, 2013 12:22
-
-
Save choro3/7248776 to your computer and use it in GitHub Desktop.
mroongaとspiderをインストールするchef recipe。 ubuntu/linux mint用
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Cookbook Name:: mroonga | |
| # Recipe:: default | |
| # | |
| # Copyright 2013, YOUR_COMPANY_NAME | |
| # | |
| # All rights reserved - Do Not Redistribute | |
| # | |
| ["cmake", | |
| "libncurses5-dev", | |
| "pkg-config", | |
| "wget", | |
| "build-essential", | |
| "zlib1g-dev", | |
| "liblzo2-dev", | |
| "libmsgpack-dev", | |
| "libzmq-dev", | |
| "libevent-dev", | |
| "libmecab-dev", | |
| ].each do |package_name| | |
| package package_name do | |
| action :install | |
| end | |
| end | |
| bash "install mysql (with spider engine)" do | |
| user "root" | |
| cwd "/tmp" | |
| code <<-EOH | |
| groupadd mysql | |
| useradd -g mysql mysql | |
| wget https://launchpad.net/spiderformysql/spider-3.x/3.1-for-5.5.34/+download/mysql-5.5.34-spider-3.1-vp-1.0-hs-1.2-q4m-0.95.tgz | |
| tar xzvf mysql-5.5.34-spider-3.1-vp-1.0-hs-1.2-q4m-0.95.tgz | |
| cd mysql-5.5.34-spider-3.1-vp-1.0-hs-1.2-q4m-0.95 | |
| cmake . -DDEFAULT_CHARSET=utf8 -DDEFAULT_COLLATION=utf8_general_ci | |
| make && make install | |
| cd .. | |
| mkdir -p /usr/local/src | |
| mv ./mysql-5.5.34-spider-3.1-vp-1.0-hs-1.2-q4m-0.95 /usr/local/src/mysql | |
| chown -R mysql:mysql /usr/local/mysql | |
| mkdir -p /var/mysql/data | |
| chown -R mysql:mysql /var/mysql | |
| /usr/local/mysql/scripts/mysql_install_db --user=mysql --basedir=/usr/local/mysql --datadir=/var/mysql/data | |
| cp /usr/local/mysql/support-files/mysql.server /etc/init.d/mysql | |
| sed -i'' -e "s:^basedir=$:basedir=/usr/local/mysql:" /etc/init.d/mysql >& /home/vagrant/log | |
| sed -i'' -e "s:^datadir=$:datadir=/var/mysql/data:" /etc/init.d/mysql | |
| chmod 755 /etc/init.d/mysql | |
| sudo update-rc.d mysql defaults | |
| mkdir /etc/mysql | |
| cp /usr/local/mysql/support-files/my-medium.cnf /etc/my.cnf | |
| chown -R mysql:mysql /etc/mysql | |
| service mysql start | |
| cd /tmp | |
| wget https://launchpad.net/spiderformysql/spider-3.x/3.1-for-5.5.34/+download/spider-init-3.1-for-5.5.34.tgz | |
| tar xzvf spider-init-3.1-for-5.5.34.tgz | |
| /usr/local/mysql/bin/mysql -uroot < ./install_spider.sql | |
| EOH | |
| end | |
| bash "install groonga" do | |
| user "root" | |
| cwd "/tmp" | |
| code <<-EOH | |
| wget http://packages.groonga.org/source/groonga/groonga-3.0.9.tar.gz | |
| tar xzvf groonga-3.0.9.tar.gz | |
| cd groonga-3.0.9 | |
| ./configure | |
| make && make install | |
| EOH | |
| end | |
| bash "install mroonga" do | |
| user "root" | |
| cwd "/tmp" | |
| code <<-EOH | |
| wget http://packages.groonga.org/source/mroonga/mroonga-3.09.tar.gz | |
| tar xzvf mroonga-3.09.tar.gz | |
| cd mroonga-3.09 | |
| PKG_CONFIG_PATH=/usr/local/lib/pkgconfig ./configure \ | |
| --with-mysql-source=/usr/local/src/mysql \ | |
| --with-mysql-config=/usr/local/mysql/bin/mysql_config | |
| make && make install | |
| ldconfig | |
| /usr/local/mysql/bin/mysql -uroot -e "INSTALL PLUGIN mroonga SONAME 'ha_mroonga.so';" | |
| /usr/local/mysql/bin/mysql -uroot -e "CREATE FUNCTION last_insert_grn_id RETURNS INTEGER SONAME 'ha_mroonga.so';" | |
| /usr/local/mysql/bin/mysql -uroot -e "CREATE FUNCTION mroonga_snippet RETURNS STRING SONAME 'ha_mroonga.so';" | |
| /usr/local/mysql/bin/mysql -uroot -e "CREATE FUNCTION mroonga_command RETURNS STRING SONAME 'ha_mroonga.so';" | |
| EOH | |
| end |
choro3
commented
Oct 31, 2013
Author
- メモリがあまり載ってないマシンだとgroongaのビルドでエラーを吐く
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment