月別アーカイブ: 2020年6月

EC-CUBEセットアップ

CentOS 7 をベースにEC-CUBEをセットアップする手順をまとめました。
コピー&ペーストで出来上がります。

EC-CUBEインストール用コマンド一覧

●SecureLinuxの無効化

sudo su
cd /etc/selinux
vi config

以下の箇所をdisabledに変更する。

変更前:SELINUX=enforcing
変更後:SELINUX=disabled

●メモリが足りない為、仮想メモリを設定する

swapon -s
dd if=/dev/zero of=/swapfile bs=1024 count=1048576
mkswap /swapfile
swapon /swapfile
swapon -s

●起動時に自動的に仮想メモリを利用する様に設定する

vi /etc/fstab

以下を最終行に追記

/swapfile       none    swap    sw      0       0

●再起動する

reboot

●Web(Apache)サーバのインストール

yum install httpd mod_ssl

正しくインストールされたか確認するには

rpm -qa | grep -i httpd
と入力し
httpd-tools-2.4.6-89.el7.centos.1.x86_64
httpd-2.4.6-89.el7.centos.1.x86_64
の2つが表示されれば問題ありません。

●MariaDBのインストール

yum install mariadb mariadb-server

正しくインストールされたか確認するには
rpm -qa | grep -i mariadb
と入力し
mariadb-libs-5.5.60-1.el7_5.x86_64
mariadb-5.5.60-1.el7_5.x86_64
mariadb-server-5.5.60-1.el7_5.x86_64
の3つが表示されれば問題ありません。

●MariaDBサーバのサービス起動と起動時の自動実行を有効にする。

systemctl start mariadb.service
systemctl enable mariadb.service

●MariaDBの初期セットアップ

/usr/bin/mysql_secure_installation

●EC-CUBE用データベースの作成

mysql -u root -p
create database eccube_db character set = utf8;
grant all privileges on eccube_db.* to eccube_db_user@localhost identified by ‘eccube_db_2020’;
flush privileges;
use mysql;
select * from db where user = ‘eccube_db_user’\G
exit

●PHP7のインストール準備

必要なリポジトリを登録(インストール)する。

yum install epel-release
rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm

●PHP環境の整備

yum install –enablerepo=remi,remi-php73 php php-devel php-pdo php-gd php-xml php-mcrypt 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-intl

rpm -qa | grep php
php-gd-7.3.8-1.el7.remi.x86_64
php-7.3.8-1.el7.remi.x86_64
php-common-7.3.8-1.el7.remi.x86_64
php-pecl-zip-1.15.4-1.el7.remi.7.3.x86_64
php-mysqlnd-7.3.8-1.el7.remi.x86_64
php-devel-7.3.8-1.el7.remi.x86_64
php-mbstring-7.3.8-1.el7.remi.x86_64
php-pecl-mcrypt-1.0.2-2.el7.remi.7.3.x86_64
php-pdo-7.3.8-1.el7.remi.x86_64
php-json-7.3.8-1.el7.remi.x86_64
php-cli-7.3.8-1.el7.remi.x86_64
php-xml-7.3.8-1.el7.remi.x86_64
php-intl-7.3.8-1.el7.remi.x86_64

●ここでec-cubeのファイルをWin-SCPを利用し転送する

●転送したファイルを解凍するツール(unzip)をインストールする

yum install unzip

●ファイルを解凍し、Web公開するための所定のフォルダにファイルを移動させる

cd /home/centos
unzip ./eccube-4.0.2.zip
cd /var/www/
rmdir html
mv /home/centos/eccube-4.0.2 html
chmod 755 html
chown –Rf apache:apache html

●/var/www/html/.htaccessの修正

cd /var/www/html/
vi .htaccess

1行目をコメントアウトする

DirectoryIndex index.php index.html .ht

# DirectoryIndex index.php index.html .ht

●コンフィグ(/etc/httpd/conf/httpd.conf)の下記内容を修正

cd /etc/httpd/conf
cp -p httpd.conf httpd.conf.20200101
vi httpd.conf

<サンプル画像>

<Directory “/var/www/html”>
    Options Indexes FollowSymLinks
    #####################
    # Order機能とRewrite機能を有効にする
    #AllowOverride None
    AllowOverride Limit FileInfo Options
    #####################
    Require all granted
</Directory>

●httpdのサービスを自動起動に設定し、さらに再起動する。

systemctl enable httpd.service
systemctl restart httpd.service

●Webブラウザ経由でのセットアップ

http://[IPアドレス]/
     又は
http://[IPアドレス]/install.php