アーカイブ - 2月, 2009



2009 2月17日

phpmyadminインストール

yum install phpmyadmin

/usr/share/phpmyadmin にインストールされる。
/usr/share/phpmyadmin/config.inc.phpを編集
$cfg['blowfish_secret']を設定。

/*
* This is needed for cookie based authentication to encrypt password in
* cookie
*/
$cfg['blowfish_secret'] = ‘*************’; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

「mcrypt 拡張をロードできません。PHP の設定を確認してください」というエラーが出たのでインストール。

yum -y install php-mbstring
yum -y install php-mcrypt

phpでマルチバイト処理をするには「php-mbstring」が必要.
CentOS5だと上記でよいが、CentOS4だとインストールされない。

CentOS4での手順
1.mcryptを組み込むのに必要なlibmcryptをrpmforgeからインストールします。

# yum -y –enablerepo=rpmforge install libmcrypt-devel

2.php用のmcrypt拡張モジュールをPHPRPMsよりダウンロードします。

# cd /usr/src/redhat/RPMS/i386/
# wget http://jaist.dl.sourceforge.net/sourceforge/phprpms/php-mcrypt-4.3.9-3.2.1.i386.rpm

最新版は http://phprpms.sourceforge.net/mcrypt で確認して下さい。
CentOSはRHEL互換なのでRHEL4の物を落としました。
X86_64で無いならばi386で問題ありません。

3.ダウンロードしたrpmをインストールします。

# rpm -Uvh php-mcrypt-4.3.9-3.2.1.i386.rpm

参考: http://centossrv.com/bbshtml/webpatio/364.shtml

・・・が、http://phprpms.sourceforge.net/mcryptは現在無い…。
しょうがないので、http://rpm.pbone.net/で探す。
キーワード「php-mcrypt」CentOS 4 とRedHat EL 4 にチェックを入れサーチ。

# php -v

でPHP 4.3.9dだったので、
RedHat EL 4 ftp.sourceforge.net/pub/sourceforge/p/project/ph/phprpms/RHEL4 PHP RPMs/4.3.9-3.2/php-mcrypt-4.3.9-3.2.1.i386.rpm
http://rpm.pbone.net/index.php3/stat/4/idpl/12753489/com/php-mcrypt-4.3.9-3.2.1.i386.rpm.html

が、見つかったのでこれを使ってみる。

# wget ftp://ftp.pbone.net/mirror/ftp.sourceforge.net/pub/sourceforge/p/project/ph/phprpms/RHEL4%20PHP%20RPMs/4.3.9-3.2/php-mcrypt-4.3.9-3.2.1.i386.rpm

rpm -ivh php-mcrypt-4.3.9-3.2.1.i386.rpm

成功した。

Apacheの設定。
/etc/httpd/conf.d/phpmyadmin.conf が作成されるので適時修正。
Apache再起動。







2009 2月17日

MySQL4.12が稼働しているサーバにMySQL5.0.67(Ttitonn)をインストールする
(MySQL4.12はYUMでインストール済)

my.cnf (MySQL4.12)

[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Default to using old password format for compatibility with mysql 3.x
# clients (those using the mysqlclient10 compatibility package).
old_passwords=1

[mysql.server]
user=mysql
basedir=/var/lib

[mysqld_safe]
err-log=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

1)mecabのインストール

mecabのインストール

2)sennaのインストール

senna 1.1.4のインストール

3)インストールするのはTritonn(MySQL5.0.67)
/usr/local/mysql5にインストールする
※mecab sennaはインストール済み

wget http://iij.dl.sourceforge.jp/tritonn/36449/tritonn-1.0.12-mysql-5.0.67.tar.gz
tar xzf tritonn-1.0.12-mysql-5.0.67.tar.gz
cd tritonn-1.0.12-mysql-5.0.67
su–
./configure –prefix=/usr/local/mysql5 –localstatedir=/usr/local/mysql5/data –with-unix-socket-path=/usr/local/mysql5/data/mysql5.sock –with-tcp-port=3307 –with-charset=utf8 –with-extra-charsets=all –with-mysqld-user=mysql –with-senna –with-mecab
make
mkdir /usr/local/mysql5
make install
cd /usr/local/mysql5
mkdir /usr/local/mysql5/data
chown -R mysql:mysql /usr/local/mysql5
su mysql
./bin/mysql_install_db –datadir=/usr/local/mysql5/data

複数インストールしない場合のconfigureオプションはこんな感じ

CC=’gcc’ CFLAGS=’-g’ CXX=’gcc’ CXXFLAGS=’-g’ LDFLAGS=” ASFLAGS=” \
./configure \
‘–prefix=/usr/local/mysql’ \
‘–localstatedir=/usr/local/mysql/data’ \
‘–libexecdir=/usr/local/mysql/bin’ \
‘–with-comment=MySQL Community Server (GPL)’ \
‘–with-server-suffix=’ \
‘–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-charset=utf8′ \
‘–with-extra-charsets=all’ \
‘–with-senna’ ‘–with-mecab’

configure時に以下のエラーが出た時の対処

checking for termcap functions library… configure: error: No curses/termcap library found

curses/termcapのライブラリが無いらしい

yum install ncurses-devel

4)データベースの初期化

/usr/local/mysql/bin/mysql_install_db –user=mysql

5)初期ユーザー作成
MySQL起動後に初期ユーザーrootでログイン。
このrootはローカルから接続出来るユーザー。

初期ユーザーを全て削除し、新規ユーザーを作成する。

./bin/mysqld_safe –defaults-file=/etc/my5.cnf –pid-file=/var/run/mysqld/mysqld5.pid &
/usr/local/mysql5/bin/mysql –user=root

MySQLに接続後、既存ユーザー削除

/usr/local/mysql5/bin/mysql –user=root
mysql> TRUNCATE TABLE mysql.user;

mysql> FLUSH PRIVILEGES;

管理ユーザー作成( 管理ユーザー:root パスワード:password)

mysql> GRANT ALL PRIVILEGES ON *.* TO ‘root’@'localhost’ IDENTIFIED BY ‘password’ WITH GRANT OPTION;

補足:シンボリックリンクを貼って「mysql5」でアクセスする

su –
ln -s /usr/local/mysql5/bin/mysql /usr/bin/mysql5

$ mysql5 –user=***** –password=************
でアクセス可能。







2009 2月16日

CentOS 4.4

wget http://iij.dl.sourceforge.jp/senna/33763/senna-1.1.4.tar.gz
tar xzf senna-1.1.4.tar.gz
cd senna-1.1.4
./configure --prefix=/usr/local
make
su--
make install