2011年8月7日日曜日

[LAMP][CentOS]さくらVPSセットアップ

■概要
さくらVPSにLAMP環境を構築します。

■基本情報
OS   : CentOS 5(2011/8時点の最小構成)
ディスク: 20GB
メモリ : 512MB

■パッケージ確認
Apache、MySQL、PHPそれぞれのインストールパッケージを確認します。
# yum list | grep httpd
httpd.x86_64 2.2.3-45.el5.centos.1 updates
httpd-devel.i386 2.2.3-45.el5.centos.1 updates
httpd-devel.x86_64 2.2.3-45.el5.centos.1 updates
httpd-manual.x86_64 2.2.3-45.el5.centos.1 updates
system-config-httpd.noarch 5:1.3.3.3-1.el5 base

# yum list | grep mysql
apr-util-mysql.x86_64 1.2.7-11.el5_5.2 base
bytefx-data-mysql.x86_64 1.2.4-2.el5.centos extras
freeradius-mysql.x86_64 1.1.3-1.6.el5 base
freeradius2-mysql.x86_64 2.1.7-7.el5 base
libdbi-dbd-mysql.x86_64 0.8.1a-1.2.2 base
mod_auth_mysql.x86_64 1:3.0.0-3.2.el5_3 base
mysql.i386 5.0.77-4.el5_6.6 updates
mysql.x86_64 5.0.77-4.el5_6.6 updates
mysql-bench.x86_64 5.0.77-4.el5_6.6 updates
mysql-connector-odbc.x86_64 3.51.26r1127-1.el5 base
mysql-devel.i386 5.0.77-4.el5_6.6 updates
mysql-devel.x86_64 5.0.77-4.el5_6.6 updates
mysql-server.x86_64 5.0.77-4.el5_6.6 updates
mysql-test.x86_64 5.0.77-4.el5_6.6 updates
pdns-backend-mysql.x86_64 2.9.21-4.el5.centos extras
php-mysql.x86_64 5.1.6-27.el5_5.3 base
php-pear-MDB2-Driver-mysql.noarch 1.4.1-3.el5.centos extras
php53-mysql.x86_64 5.3.3-1.el5_6.1 updates
qt4-mysql.x86_64 4.2.1-1 base
rsyslog-mysql.x86_64 3.22.1-3.el5_6.1 updates

# yum list | grep php
php.x86_64 5.1.6-27.el5_5.3 base
php-bcmath.x86_64 5.1.6-27.el5_5.3 base
php-cli.x86_64 5.1.6-27.el5_5.3 base
php-common.x86_64 5.1.6-27.el5_5.3 base
php-dba.x86_64 5.1.6-27.el5_5.3 base
php-dbase.x86_64 5.1.6-15.el5.centos.1 extras
php-devel.x86_64 5.1.6-27.el5_5.3 base
php-gd.x86_64 5.1.6-27.el5_5.3 base
php-imap.x86_64 5.1.6-27.el5_5.3 base
php-ldap.x86_64 5.1.6-27.el5_5.3 base
php-mbstring.x86_64 5.1.6-27.el5_5.3 base
php-mcrypt.x86_64 5.1.6-15.el5.centos.1 extras
php-mhash.x86_64 5.1.6-15.el5.centos.1 extras
php-mssql.x86_64 5.1.6-15.el5.centos.1 extras
php-mysql.x86_64 5.1.6-27.el5_5.3 base
php-ncurses.x86_64 5.1.6-27.el5_5.3 base
php-odbc.x86_64 5.1.6-27.el5_5.3 base
php-pdo.x86_64 5.1.6-27.el5_5.3 base
php-pear.noarch 1:1.4.9-6.el5 base
php-pear-Auth-SASL.noarch 1.0.2-4.el5.centos extras
php-pear-DB.noarch 1.7.13-1.el5.centos extras
php-pear-Date.noarch 1.4.7-2.el5.centos extras
php-pear-File.noarch 1.2.2-1.el5.centos extras
php-pear-HTTP-Request.noarch 1.4.2-1.el5.centos extras
php-pear-Log.noarch 1.9.13-1.el5.centos extras
php-pear-MDB2.noarch 2.4.1-2.el5.centos extras
php-pear-MDB2-Driver-mysql.noarch 1.4.1-3.el5.centos extras
php-pear-Mail.noarch 1.1.14-1.el5.centos extras
php-pear-Mail-Mime.noarch 1.4.0-1.el5.centos extras
php-pear-Net-SMTP.noarch 1.2.10-1.el5.centos extras
php-pear-Net-Sieve.noarch 1.1.5-2.el5.centos extras
php-pear-Net-Socket.noarch 1.0.8-1.el5.centos extras
php-pear-Net-URL.noarch 1.0.15-1.el5.centos extras
php-pecl-Fileinfo.x86_64 1.0.4-3.el5.centos extras
php-pecl-memcache.x86_64 2.2.3-1.el5_2 extras
php-pgsql.x86_64 5.1.6-27.el5_5.3 base
php-readline.x86_64 5.1.6-15.el5.centos.1 extras
php-snmp.x86_64 5.1.6-27.el5_5.3 base
php-soap.x86_64 5.1.6-27.el5_5.3 base
php-tidy.x86_64 5.1.6-15.el5.centos.1 extras
php-xml.x86_64 5.1.6-27.el5_5.3 base
php-xmlrpc.x86_64 5.1.6-27.el5_5.3 base
php53.x86_64 5.3.3-1.el5_6.1 updates
php53-bcmath.x86_64 5.3.3-1.el5_6.1 updates
php53-cli.x86_64 5.3.3-1.el5_6.1 updates
php53-common.x86_64 5.3.3-1.el5_6.1 updates
php53-dba.x86_64 5.3.3-1.el5_6.1 updates
php53-devel.x86_64 5.3.3-1.el5_6.1 updates
php53-gd.x86_64 5.3.3-1.el5_6.1 updates
php53-imap.x86_64 5.3.3-1.el5_6.1 updates
php53-intl.x86_64 5.3.3-1.el5_6.1 updates
php53-ldap.x86_64 5.3.3-1.el5_6.1 updates
php53-mbstring.x86_64 5.3.3-1.el5_6.1 updates
php53-mysql.x86_64 5.3.3-1.el5_6.1 updates
php53-odbc.x86_64 5.3.3-1.el5_6.1 updates
php53-pdo.x86_64 5.3.3-1.el5_6.1 updates
php53-pgsql.x86_64 5.3.3-1.el5_6.1 updates
php53-process.x86_64 5.3.3-1.el5_6.1 updates
php53-pspell.x86_64 5.3.3-1.el5_6.1 updates
php53-snmp.x86_64 5.3.3-1.el5_6.1 updates
php53-soap.x86_64 5.3.3-1.el5_6.1 updates
php53-xml.x86_64 5.3.3-1.el5_6.1 updates
php53-xmlrpc.x86_64 5.3.3-1.el5_6.1 updates

Apache2.2系、MySQL5.0系、PHP5.1系がインストール可能です。

■Apache
# yum -y install httpd
# httpd -v
Server version: Apache/2.2.3
Server built: May 4 2011 06:51:15

■MySQL

今回、MySQLは5.5系、PHPは5.3系をインストールしたい為、サードパーティのリポジトリを指定してインストールします。

リポジトリの登録
# rpm -ivh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm
# rpm -ivh http://rpms.famillecollet.com/enterprise/remi-release-5.rpm
# yum --enablerepo=remi install mysql mysql-server

MySQLサーバ起動
# /etc/rc.d/init.d/mysqld start
MySQL Daemon failed to start.
Starting mysqld: [FAILED]

失敗する。ログを確認してみる。
# cat /var/log/mysqld.log
110807 20:03:29 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
110807 20:03:29 [ERROR] Error message file '/usr/share/mysql/english/errmsg.sys' had only 480 error messages,
but it should contain at least 712 error messages.
Check that the above file is the right version for this program!
110807 20:03:29 [Note] Plugin 'FEDERATED' is disabled.
/usr/libexec/mysqld: Unknown error 1146
110807 20:03:29 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
110807 20:03:29 InnoDB: The InnoDB memory heap is disabled
110807 20:03:29 InnoDB: Mutexes and rw_locks use GCC atomic builtins
110807 20:03:29 InnoDB: Compressed tables use zlib 1.2.3
110807 20:03:29 InnoDB: Using Linux native AIO
110807 20:03:29 InnoDB: Initializing buffer pool, size = 128.0M
110807 20:03:29 InnoDB: Completed initialization of buffer pool
InnoDB: The first specified data file ./ibdata1 did not exist:
InnoDB: a new database to be created!
110807 20:03:29 InnoDB: Setting file ./ibdata1 size to 10 MB
InnoDB: Database physically writes the file full: wait...
110807 20:03:30 InnoDB: Log file ./ib_logfile0 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile0 size to 5 MB
InnoDB: Database physically writes the file full: wait...
110807 20:03:30 InnoDB: Log file ./ib_logfile1 did not exist: new to be created
InnoDB: Setting log file ./ib_logfile1 size to 5 MB
InnoDB: Database physically writes the file full: wait...
InnoDB: Doublewrite buffer not found: creating new
InnoDB: Doublewrite buffer created
InnoDB: 127 rollback segment(s) active.
InnoDB: Creating foreign key constraint system tables
InnoDB: Foreign key constraint system tables created
110807 20:03:31 InnoDB: Waiting for the background threads to start
110807 20:03:32 InnoDB: 1.1.8 started; log sequence number 0
110807 20:03:32 [ERROR] Aborting

110807 20:03:32 InnoDB: Starting shutdown...
110807 20:03:33 InnoDB: Shutdown completed; log sequence number 1595675
110807 20:03:33 [Note]
110807 20:03:33 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

メッセージファイル(/usr/share/mysql/english/errmsg.sys)の競合が発生しているようです。

該当ファイルの競合を確認
# rpm -q --whatprovides /usr/share/mysql/english/errmsg.sys
mysql-libs-5.5.15-1.el5.remi
mysql-5.0.77-4.el5_6.6

2つのバージョンが競合していることが分かりました。現状のmysqlをいったん削除します。
# yum -y remove mysql mysql-server mysql-libs

明示的にバージョン指定
# yum --enablerepo=remi install mysql-server.x86_64
# yum --enablerepo=remi install mysql-devel.x86_64

# mysql_install_db

# /etc/rc.d/init.d/mysqld start

因みにMySQL5.5系ではmy.cnfに以下の設定を記述すると起動しない。innodbがデフォルトエンジンだからかも。 
設定内容:skip_innodb

■PHP
# yum install -y --enablerepo=remi php
# php -v
PHP 5.3.6 (cli) (built: May 16 2011 19:18:05)
Copyright (c) 1997-2011 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2011 Zend Technologies

以上です。

0 件のコメント:

コメントを投稿