CentOSにSenna(Tritton)インストール
今更ながらCentOSにSenna(Tritton)をインストールした際のメモ。
作業は基本的にyumでのインストールが基本となるので、近くのミラーサーバからパッケージを取得出来るように「yum-fastestmirror」のインストール。
yum -y install yum-fastestmirror
PHPに必要なパッケージをインストール
yum -y \ install \ httpd-devel \ pcre-devel \ libmcrypt-devel \ mysql-devel \ libjpeg-devel \ libpng-devel \ freetype-devel \ libtool-ltdl-devel
その他、今回の構成の為に必要なパッケージをインストール
yum -y \ install \ gcc-c++ \ gcc-java \ gcc-objc \ gcc4 \ gcc4-c++ \ autoconf \ ImageMagick-devel \ libtool \ automake \ bison \ ncurses-devel \ libtool-ltdl
MySQL用のユーザーグループとユーザーを作成する
groupadd mysql
useradd -g mysql mysql
mkdir ~/src
Mecabをソースからインストール
(ソースは「http://mecab.sourceforge.net/」より最新版の取得を推奨)
cd ~/src wget http://nchc.dl.sourceforge.net/sourceforge/mecab/mecab-0.97.tar.gz tar zxvf mecab-0.97.tar.gz cd mecab-0.97 ./configure --prefix=/usr --with-charset=utf8 make make install
Mecab-IPA辞書をソースからインストール
(ソースは「http://mecab.sourceforge.net/」より最新版の取得を推奨)
cd ~/src wget http://nchc.dl.sourceforge.net/sourceforge/mecab/mecab-ipadic-2.7.0-20070801.tar.gz tar zxvf mecab-ipadic-2.7.0-20070801.tar.gz cd mecab-ipadic-2.7.0-20070801 ./configure --prefix=/usr --with-charset=utf8 make make install
もしここで
libmecab.so.1: cannot open shared object file: No such file or directory
・・・・Error 127
と出た場合。
けどlibmecab.so.1はmecabを入れたらあるはず。
libmecab.so.1の存在を確認し、存在する場合は「/etc/ld.so.conf」にパス(/usr/lib等)を追加してldconfig実行するなり、パスの通ったところにリンクを張るなりコピーする等してからもう一度makeする。
Sennaをソースからインストール
(ソースは「http://qwik.jp/senna/Download.html」より最新版の取得を推奨)
cd ~/src wget http://globalbase.dl.sourceforge.jp/senna/33763/senna-1.1.4.tar.gz tar zxvf senna-1.1.4.tar.gz cd senna-1.1.4 ./configure --prefix=/usr make make install
Tritonnをソースからインストール
(ソースは「http://qwik.jp/tritonn/download.html」より最新版の取得を推奨)
cd ~/src wget http://osdn.dl.sourceforge.jp/tritonn/36449/tritonn-1.0.12-mysql-5.0.67.tar.gz tar zxvf tritonn-1.0.12-mysql-5.0.67.tar.gz cd tritonn-1.0.12-mysql-5.0.67 CC='gcc' CXX='gcc' \ ./configure \ '--prefix=/usr' \ '--localstatedir=/usr/data' \ '--libexecdir=/usr/bin' \ '--enable-thread-safe-client' \ '--enable-local-infile' \ '--enable-assembler' \ '--with-pic' \ '--with-fast-mutexes' \ '--with-client-ldflags=-static' \ '--with-mysqld-ldflags=-static' \ '--with-zlib-dir=bundled' \ '--with-big-tables' \ '--with-yassl' \ '--with-readline' \ '--with-archive-storage-engine' \ '--with-blackhole-storage-engine' \ '--with-ndbcluster' \ '--with-csv-storage-engine' \ '--with-example-storage-engine' \ '--with-federated-storage-engine' \ '--with-innodb' \ '--with-extra-charsets=complex' \ '--with-senna' \ '--with-mecab' make make install
サービスへ「mysqld」として登録
cp ./support-files/mysql.server /etc/init.d/mysqld chmod 755 /etc/init.d/mysqld chkconfig --add mysqld chkconfig mysqld on
/etc/my.cnfを修正
#各セクションの値を修正 [client] -socket = /tmp/mysql.sock +socket = /var/lib/mysql/mysql.sock [mysqld] -socket = /tmp/mysql.sock +datadir = /var/lib/mysql +socket = /var/lib/mysql/mysql.sock #以下のセクション情報を追加 [mysqld_safe] log-error=/var/log/mysqld.log pid-file=/var/run/mysqld/mysqld.pid
上記にて、「/etc/my.cnf」が無い場合は以下のコマンドにてコピー作成
mv /usr/local/mysql/share/mysql/my-medium.cnf /etc/my.cnf
DBを初期化し、ユーザーとグループを適切なものに変更
/usr/bin/mysql_install_db --user=mysql
/etc/init.d/mysqld start
MySQLのパスワード設定
mysqladmin password ********
PHPのインストール
cd ~/src wget http://museum.php.net/php5/php-5.2.9.tar.bz2 tar xjvf php-5.2.9.tar.bz2 cd php-5.2.9 ./configure \ --build=i686-redhat-linux-gnu \ --host=i686-redhat-linux-gnu \ --target=i386-redhat-linux-gnu \ --program-prefix= \ --prefix=/usr \ --exec-prefix=/usr \ --bindir=/usr/bin \ --sbindir=/usr/sbin \ --sysconfdir=/etc \ --datadir=/usr/share \ --includedir=/usr/include \ --libdir=/usr/lib \ --libexecdir=/usr/libexec \ --localstatedir=/var \ --sharedstatedir=/usr/com \ --mandir=/usr/share/man \ --infodir=/usr/share/info \ --cache-file=../config.cache \ --with-libdir=lib \ --with-config-file-path=/etc \ --with-config-file-scan-dir=/etc/php.d \ --disable-debug \ --with-exec-dir=/usr/bin \ --with-layout=GNU \ --enable-shared \ --with-pic \ --disable-rpath \ --with-pear \ --with-gd \ --with-freetype-dir=/usr \ --with-png-dir=/usr \ --with-jpeg-dir=/usr \ --enable-gd-native-ttf \ --with-pcre-regex=/usr \ --with-zlib \ --with-mime-magic=/usr/share/file/magic.mime \ --without-sqlite \ --without-pdo-sqlite \ --with-libxml-dir=/usr \ --with-apxs2=/usr/sbin/apxs \ --with-mysql=/usr \ --with-mysqli=/usr/bin/mysql_config \ --disable-dba \ --without-unixODBC \ --enable-mbstring \ --enable-mbregex \ --enable-zend-multibyte \ --enable-gd-jis-conv \ --with-mcrypt \ --with-apxs2=/usr/sbin/apxs make clean make make install
必要なPEARパッケージのインストール
pear update-channels pear_install Crypt_Blowfish-beta pear_install HTTP_Request pear_install Mail_mimeDecode pear_install Mail pear_install Net_SMTP
pecl install APC
PECL,memcacheのインストール
pecl install memcache
「/etc/php.ini」に読み込むextensionを記述
extension=apc.so extension=memcache.so
[apc] apc.enabled=1 apc.shm_segments=1 apc.shm_size=30 apc.optimization=0 apc.num_files_hint=1000 apc.ttl=0 apc.gc_ttl=3600 apc.cache_by_default=1 apc.filters=NULL apc.mmap_file_mask=NULL apc.slam_defense=0 apc.file_update_protection=2 apc.enable_cli=0 apc.max_file_size=1M apc.stat=0
「/etc/httpd/conf/httpd.conf」の以下の記述をコメントアウト
#LoadModule php5_module /usr/lib/httpd/modules/libphp5.so
「/etc/httpd/conf.d/php.conf」の設定(無い場合は新規作成)
LoadModule php5_module /usr/lib/httpd/modules/libphp5.so AddType application/x-httpd-php .php DirectoryIndex index.php
今回ハマったのはPHPのバージョンが5.2.10や5.2.11だったらAPCを有効にするとPHPの「session_set_save_handler」実行時にエラーが発生する件。
その為PHPは5.2.9で構築してます。
以上!