EC-CUBEのための環境設定

法律や届出関連の調査がひとまず済んだのでとりあえず、環境を構築する。
ようやく、システムよりのことになった。ヽ(´▽`)ノ


有名どころのフリーのショップのフレームワークといえば、
EC-CUBEとZenCartだろう。
自分的には、ZenCartを使おうと思っていた。
なぜなら、EC-CUBEを使ったことがなかったから。
もっと言えば、OSCommerce知ってたからZEN-CARTにしようぐらいだった。
でも、ある縁でEC-CUBEに触れてみたらびっくり。
驚きの使いやすさ。
驚きのカスタマイズしやすさ。


ということで、EC-CUBE採用。
ライセンスの問題とかあるけど、とりあえずインスコ
ライセンスについては、ちゃんとあとで調べる。


ということで開発環境は我が社の通称神棚サーバー

という感じ
で、必要なのが

  • Apache
  • PHP4.1.x以上
  • PostgresSQL7.4.x以上、MySQL4.1、MySQL5.0以上

である。
Apacheは既に入ってる。
PHPも大丈夫。
DBはまだだからインストールしよう。
個人的にはPostgresSQLが好きだが、ZenCartがMySQL対応なので、ここはMySQLを選択する。


まずはApacheの確認

# rpm -qa | grep httpd
httpd-2.2.3-11.el5_2.centos.4
system-config-httpd-1.3.3.3-1.el5
httpd-manual-2.2.3-11.el5_2.centos.4

インスコされてますね。
次、PHPの確認

# rpm -qa | grep php
php-cli-5.1.6-20.el5
php-common-5.1.6-20.el5
php-5.1.6-20.el5
php-ldap-5.1.6-20.el5

はい。バージョンも5.1.6なので、問題ないと思われ。
次、MySQL

# rpm -qa | grep -i mysql
mysql-5.0.45-7.el5

あれ、なんかいる。
もともと入っていた物っぽい。
よく分からんから消す。

# rpm -e mysql
エラー: 依存性の欠如:
libmysqlclient.so.15 は (インストール済み)dovecot-1.0.7-2.el5.i386 に必要とされて います
libmysqlclient.so.15(libmysqlclient_15) は (インストール済み)dovecot-1.0.7-2.el5.i386 に必要とされています

なんか出た。うざい

# rpm -e --nodeps mysql
# rpm -qa | grep mysql

消えた。dovecotって「pop3/imapサーバソフトウエア」らしい。
いらない。神棚では使わない。
何か起きたらごめん。id:stokiwa(*´∀`*)
で、新たにインスコ

# yum install mysql
Setting up Install Process
Parsing package install arguments
Resolving Dependencies

    • > Running transaction check
      • > Package mysql.i386 0:5.0.45-7.el5 set to be updated
    • > Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
mysql i386 5.0.45-7.el5 base 4.1 M

Transaction Summary
=============================================================================
Install 1 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 4.1 M
Is this ok [y/N]: y
Downloading Packages:
(1/1): mysql-5.0.45-7.el5 100% |=========================| 4.1 MB 00:04
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: mysql ######################### [1/1]

Installed: mysql.i386 0:5.0.45-7.el5
Complete!

もういっちょ

# yum install mysql-server
Setting up Install Process
Parsing package install arguments
Resolving Dependencies

    • > Running transaction check
      • > Package mysql-server.i386 0:5.0.45-7.el5 set to be updated
    • > Processing Dependency: perl-DBD-MySQL for package: mysql-server
    • > Running transaction check
    • > Finished Dependency Resolution

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Installing:
mysql-server i386 5.0.45-7.el5 base 9.7 M
Installing for dependencies:
perl-DBD-MySQL i386 3.0007-2.el5 base 148 k

Transaction Summary
=============================================================================
Install 2 Package(s)
Update 0 Package(s)
Remove 0 Package(s)

Total download size: 9.8 M
Is this ok [y/N]: y
Downloading Packages:
(1/2): mysql-server-5.0.4 100% |=========================| 9.7 MB 01:08
(2/2): perl-DBD-MySQL-3.0 100% |=========================| 148 kB 00:01
Running rpm_check_debug
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Installing: perl-DBD-MySQL ######################### [1/2]
Installing: mysql-server ######################### [2/2]

Installed: mysql-server.i386 0:5.0.45-7.el5
Dependency Installed: perl-DBD-MySQL.i386 0:3.0007-2.el5
Complete!

よっしゃ
なんか乗ってきた(`・ω・´) b

# /sbin/service mysqld start
MySQL データベースを初期化中: Installing MySQL system tables...
OK
Filling help tables...
OK

To start mysqld at boot time you have to copy
support-files/mysql.server to the right place for your system

PLEASE REMEMBER TO SET A PASSWORD FOR THE MySQL root USER !
To do so, start the server, then issue the following commands:
/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'
See the manual for more instructions.
You can start the MySQL daemon with:
cd /usr ; /usr/bin/mysqld_safe &

You can test the MySQL daemon with mysql-test-run.pl
cd mysql-test ; perl mysql-test-run.pl

Please report any problems with the /usr/bin/mysqlbug script!

The latest information about MySQL is available on the web at
http://www.mysql.com
Support MySQL by buying support/licenses at http://shop.mysql.com
[ OK ]
MySQL を起動中: [ OK ]

起動した。
トラボーなくて気持ちいい。


これで開発環境は整った。
では、MySQLの設定を気持ちがいいのでやろう。

# mysql
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.0.45 Source distribution

Type 'help;' or '\h' for help. Type '\c' to clear the buffer.

mysql> set password for root@localhost=password('********');
Query OK, 0 rows affected (0.00 sec)

まずはrootの権限を変えてと

mysql> grant all privileges on eccube_db.* to eccube_db_user@localhost identified by '*******';
Query OK, 0 rows affected (0.00 sec)
mysql> flush privileges;

ほい。ユーザー作成完了。
順調順調
最後にデータベース作成

mysql> create database eccube_db DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
Query OK, 1 row affected (0.01 sec)

はい。ここ重要。
なぜなら、キャラクター設定をちゃんとしないと、文字化けした。
windowsでxamppでやったとき。
これは、明日あたり詳細に書こう。。。


で、Apacheの設定
httpd.confの一番最後に以下を追加

# EC-CUBE
NameVirtualHost *:80


ServerName hoge.piyo.jp
DocumentRoot /var/www/html
DirectoryIndex index.html


ServerName hoge.foo.jp
DocumentRoot /home/hoge/bar
DirectoryIndex index.html index.php


Options FollowSymLinks
AllowOverride None
Order deny,allow
Allow from all

とした。
テストとして
/home/hoge/bar
の下にindex.html
を置く。
中身は

test!!!

これで、
http://hoge.foo.jp
としたら、test!!!が出るはず。
ブラウザで実行。
出ない。
error_log見ると

[Thu Jun 25 22:06:05 2009] [error] [client 114.48.203.126] (13)Permission denied: access to / denied
[Thu Jun 25 22:06:05 2009] [error] [client 114.48.203.126] (13)Permission denied: access to /favicon.ico denied, referer: http://hoge.foo.jp

ぬう。
今日はじめてのトラボー
はまった。
小一時間はまった。
で、結論。
SELINUXでした。
http://74.125.153.132/search?q=cache:bC-_MKYmUWIJ:kennyqi.com/item/81+apache+virtualhost+Warning:+DocumentRoot+does+not+exist&cd=1&hl=ja&ct=clnk&gl=jp&lr=lang_ja&client=firefox-a
ここ見て解決。
疲れた。
今日はもういい。
EC-CUBEインスコできなかったけど帰る。