CentOS7にEC-Cube3をインストール(yumのみ)

スポンサーリンク

CentOS7の標準のyumだけを使ってCentOS7上でEC-Cube3をセットアップします。

色々と苦戦しましたが、とりあえず動くようにしました。
Webサーバ:apache
DBサーバ:MariaDB
で動かしています。

apacheのインストール

[root@hostname ~]# yum install httpd httpd-devel

バージョンを確認する。

[root@hostname ~]# httpd -v
Server version: Apache/2.4.6 (CentOS)
Server built: Nov 19 2015 21:43:13

とりあえずサービスを立ち上げて動かす。

[root@hostname ~]# systemctl start httpd.service
[root@hostname ~]# systemctl status httpd.service
● httpd.service - The Apache HTTP Server
Loaded: loaded (/usr/lib/systemd/system/httpd.service; disabled; vendor preset: disabled)
Active: active (running) since 火 2016-01-26 00:34:57 JST; 1s ago
Docs: man:httpd(8)
man:apachectl(8)
Main PID: 24028 (httpd)
Status: "Processing requests..."
CGroup: /system.slice/httpd.service
tq24028 /usr/sbin/httpd -DFOREGROUND
tq24030 /usr/sbin/httpd -DFOREGROUND
tq24031 /usr/sbin/httpd -DFOREGROUND
tq24032 /usr/sbin/httpd -DFOREGROUND
tq24033 /usr/sbin/httpd -DFOREGROUND
mq24034 /usr/sbin/httpd -DFOREGROUND

1月 26 00:34:31 hostname systemd[1]: Starting The Apache HTTP Server...
1月 26 00:34:47 hostname httpd[24028]: AH00557: httpd: apr_sockaddr_info_get() failed for hostname
1月 26 00:34:47 hostname httpd[24028]: AH00558: httpd: Could not reliably determine the server's fully qualified domain name, using 127.0.0.1. Set the 'ServerName' directive globally to suppress this message
1月 26 00:34:57 hostname systemd[1]: Started The Apache HTTP Server.

ここでようやく実際に接続を。
http://(ipaddress)/ でapacheにまずは繋いだが、ブラウザで動かしても繋がらない。。。
ファイアウォールが効いてる。
httpだけ通すように設定する。

[root@hostname ~]# firewall-cmd --permanent --zone=public --add-service=http
success
[root@hostname ~]# firewall-cmd --reload
success

http://(ipaddress)/ で接続したら繋がった。

PHPのインストール

[root@hostname ~]# yum install php php-mysql php-phar php-mbstring php-zlib php-ctype php-session php-json php-xml php-libxml php-openssl php-zip php-curl php-fileinfo

php.iniの設定変更。これも主に文字関係。

[root@hostname ~]# vi /etc/php.ini

; PHP's default character set is set to empty.
; http://php.net/default-charset
default_charset = "UTF-8"

[Date]
; Defines the default timezone used by the date functions
; http://php.net/date.timezone
date.timezone = "Asia/Tokyo"

[mbstring]
; language for internal character representation.
; http://php.net/mbstring.language
mbstring.language = Japanese

; internal/script encoding.
; Some encoding cannot work as internal encoding.
; (e.g. SJIS, BIG5, ISO-2022-*)
; http://php.net/mbstring.internal-encoding
;mbstring.internal_encoding = EUC-JP
mbstring.internal_encoding = UTF-8

; http input encoding.
; http://php.net/mbstring.http-input
mbstring.http_input = auto

; http output encoding. mb_output_handler must be
; registered as output buffer to function
; http://php.net/mbstring.http-output
;mbstring.http_output = SJIS
mbstring.http_output = UTF-8

; enable automatic encoding translation according to
; mbstring.internal_encoding setting. Input chars are
; converted to internal encoding by setting this to On.
; Note: Do _not_ use automatic encoding translation for
; portable libs/applications.
; http://php.net/mbstring.encoding-translation
mbstring.encoding_translation = On

; automatic encoding detection order.
; auto means
; http://php.net/mbstring.detect-order
mbstring.detect_order = auto

MariaDBのインストール

[root@hostname ~]# yum install mariadb mariadb-server

設定ファイルを編集し、文字コードだけとりあえずUTF-8に整える。

[root@hostname ~]# vi /etc/my.cnf
[mysqld]
datadir=/var/lib/mysql
socket=/var/lib/mysql/mysql.sock
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
# Settings user and group are ignored when systemd is used.
# If you need to run mysqld under a different user or group,
# customize your systemd unit file for mariadb according to the
# instructions in http://fedoraproject.org/wiki/Systemd
# add 文字コード設定
character-set-server=utf8

[mysqld_safe]
log-error=/var/log/mariadb/mariadb.log
pid-file=/var/run/mariadb/mariadb.pid

#
# include all files from the config directory
#
!includedir /etc/my.cnf.d

サービスを立ち上げ

[root@hostname ~]# systemctl enable mariadb.service
Created symlink from /etc/systemd/system/multi-user.target.wants/mariadb.service to /usr/lib/systemd/system/mariadb.service.
[root@hostname ~]# systemctl start mariadb.service

初期のインストール作業はMySQLと一緒なので、例のやつで。

[root@hostname ~]# mysql_secure_installation
/usr/bin/mysql_secure_installation: 行 379: find_mysql_client: コマンドが見つかりません

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):(空でエンター)
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.

Set root password? [Y/n] Y
New password:(パスワード)
Re-enter new password:(パスワード)
Password updated successfully!
Reloading privilege tables..
... Success!

By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.

Remove anonymous users? [Y/n] Y
... Success!

Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.

Disallow root login remotely? [Y/n] Y
... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

Reload privilege tables now? [Y/n] Y
... Success!

Cleaning up...

All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

DBを作る

[root@hostname ~]# mysql -uroot -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 11
Server version: 5.5.44-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]> create database eccube;
Query OK, 1 row affected (0.00 sec)

ユーザを作る。権限とかはきっちり見直して下さい。

MariaDB [(none)]> grant all privileges on eccube.* to ecuser@localhost IDENTIFIED BY 'password';
Query OK, 0 rows affected (0.00 sec)

MariaDB [(none)]> exit
Bye

作ったユーザで接続の確認を行う。

[root@hostname ~]# mysql -uecuser -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or g.
Your MariaDB connection id is 19
Server version: 5.5.44-MariaDB MariaDB Server

Copyright (c) 2000, 2015, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or 'h' for help. Type 'c' to clear the current input statement.

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| eccube             |
+--------------------+
2 rows in set (0.00 sec)

EC-Cubeのインストール

まずは下準備としてwgetのインストール。
そこからec-cubeのzipをダウンロード。

[root@hostname var]# yum install wget
[root@hostname var]# wget http://downloads.ec-cube.net/src/eccube-3.0.7.zip
--2016-01-26 00:52:57-- http://downloads.ec-cube.net/src/eccube-3.0.7.zip
downloads.ec-cube.net (downloads.ec-cube.net) をDNSに問いあわせています... 112.78.219.13
downloads.ec-cube.net (downloads.ec-cube.net)|112.78.219.13|:80 に接続しています... 接続しました。
HTTP による接続要求を送信しました、応答を待っています... 200 OK
長さ: 15116030 (14M) [application/zip]
`eccube-3.0.7.zip' に保存中

2016-01-26 00:54:24 (176 KB/s) - `eccube-3.0.7.zip' へ保存完了 [15116030/15116030]

本来なら2016年1月26日時点の最新版3.0.8を選ぶべきだけど、migrateをやりたいので、1つ前を。
解凍するとワーッと出てくる。

[root@hostname var]# unzip eccube-3.0.7.zip

ドキュメントルートが/var/www/htmlなので、そこに上書きしてしまう。

[root@hostname var]# cd eccube-3.0.7
[root@hostname eccube-3.0.7]# ls -l
合計 212
-rw-r--r--. 1 root root 17987 12月 8 19:02 COPYING
drwxrwxrwx. 7 root root 99 12月 8 19:02 app
-rw-r--r--. 1 root root 1113 12月 8 19:02 autoload.php
-rw-r--r--. 1 root root 1017 12月 8 19:02 cli-config.php
-rw-r--r--. 1 root root 2102 12月 8 19:02 composer.json
-rw-r--r--. 1 root root 157273 12月 8 19:02 composer.lock
drwxr-xr-x. 2 root root 6 12月 8 19:02 docs
-rw-r--r--. 1 root root 7148 12月 8 19:02 eccube_install.sh
drwxrwxrwx. 6 root root 4096 12月 8 19:02 html
-rw-r--r--. 1 root root 810 12月 8 19:02 phpunit.xml.dist
drwxr-xr-x. 4 root root 51 12月 8 19:02 src
drwxr-xr-x. 4 root root 4096 12月 8 19:02 tests
drwxr-xr-x. 19 root root 4096 12月 8 19:03 vendor
[root@hostname eccube-3.0.7]# mv * ../www/
mv: `../www/html' を上書きしますか? y

忘れた。

[root@hostname eccube-3.0.7]# mv .htaccess ../www/

それでいざ、インストール!とすると、エラーが発生。多分こういうログが出てくる。

[Tue Jan 26 01:00:36.155463 2016] [core:error] [pid 24030] (13)Permission denied: [client 192.168.68.1:49332] AH00035: access to /index.php denied (filesystem path '/var/www/html/index.php') because search permissions are missing on a component of the path

SELinuxを状態確認してから無効化。

[root@hostname httpd]# getenforce
Enforcing
[root@hostname httpd]# setenforce 0
[root@hostname httpd]# getenforce
Permissive

EC-Cubeインストール開始

まずインストールしようとすると、「これがあった方がいいよ」という警告が出る。
ec-cubeのインストール画面。

足りないのを追加するための準備。
こういうマニュアルが無いのかー。探すしかないのはどうなの?

[root@hostname httpd]# yum install epel-release
[root@hostname httpd]# yum install php-mcrypt php-pecl-apcu

インストールの途中に、

warning: /var/cache/yum/x86_64/7/epel/packages/libmcrypt-2.5.8-13.el7.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 352c64e5: NOKEY ] 0.0 B/s | 123 kB --:--:-- ETA
libmcrypt-2.5.8-13.el7.x86_64.rpm の公開鍵がインストールされていません
(2/5): libmcrypt-2.5.8-13.el7.x86_64.rpm | 99 kB 00:00:00
(3/5): php-mcrypt-5.4.16-3.el7.x86_64.rpm | 20 kB 00:00:01
(4/5): php-pecl-apcu-4.0.10-1.el7.x86_64.rpm | 62 kB 00:00:02
(5/5): php-pear-1.9.4-21.el7.noarch.rpm | 357 kB 00:00:03
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
合計 155 kB/s | 592 kB 00:00:03
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7 から鍵を取得中です。
Importing GPG key 0x352C64E5:
Userid : "Fedora EPEL (7) <epel@fedoraproject.org>"
Fingerprint: 91e9 7d7c 4a5e 96f1 7f3e 888f 6a2f aea2 352c 64e5
Package : epel-release-7-5.noarch (@extras)
From : /etc/pki/rpm-gpg/RPM-GPG-KEY-EPEL-7
上記の処理を行います。よろしいでしょうか? [y/N]y

よろしいので、とにかくyesで進む。

apacheを再起動してもう一度チャレンジ

[root@hostname httpd]# systemctl restart httpd.service
ec-cube-1

次に行くといきなり怒られた。
ec-cube-install-2

権限をapacheにしちゃう。

[root@hostname www]# chown -R apache:apache *

更新すると正常らしい。
ec-cube-install-2-2

お店を。
ここはキッチリやったほうがいいと思いますが、これはローカル接続のみのvmware上で作ってるので、わかりやすくしてます。
ec-cube-omise

DBの設定を行います。
ec-cube-db1

初期化してしまっていいので、それで。
ec-cube-db2

これで完成。

で、admin画面を開くとこの様子。。。
EC-Cube3の管理画面に繋がらない!というエラーが発生する。
ec-cube-not-found

どうやらhttpd.confのAllowOverrideが悪いらしい。修正して再起動。

[root@hostname conf]# vi httpd.conf
<Directory "/var/www/html">
#AllowOverride None
AllowOverride All

再起動。

[root@hostname conf]# systemctl restart httpd.service

で入れるはず。
ec-cube-login

繋がった。。。これは大変な作業だな。


スポンサーリンク