Skip to content

Instantly share code, notes, and snippets.

@k-motoyan
Last active December 16, 2015 13:19
Show Gist options
  • Save k-motoyan/5440435 to your computer and use it in GitHub Desktop.
Save k-motoyan/5440435 to your computer and use it in GitHub Desktop.
EC-CUBEインストールスクリプト:LAMP環境の構築とEC-CUBEのインストールを自動で行なってくれるスクリプトです。
#!/bin/bash
###########################################
# EC-CUBE INSTALL SHELL
# target: centOS6.* x86_64
###########################################
# add remi repository
rpm --import http://rpms.famillecollet.com/RPM-GPG-KEY-remi
cd /usr/local/src
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
rpm -ivh remi-release-6.rpm epel-release-6-8.noarch.rpm
# install modules
yum --enablerepo=remi -y install mysql-devel mysql-server httpd php php-mysql php-common php-mbstring php-gd php-mcrypt php-xml
#download ec-cube
cd /var/www
wget http://downloads.ec-cube.net/src/eccube-2.12.5.tar.gz
tar xvfz eccube-2.12.5.tar.gz
mv eccube-2.12.5 eccube
chmod -R 777 eccube/
rm -f eccube-2.12.5.tar.gz
#php setting
cp /etc/php.ini /etc/php.ini.org
echo "default_charset = \"UTF-8\"" >> /etc/php.ini
echo "date.timezone = \"Asia/Tokyo\"" >> /etc/php.ini
echo "mbstring.language = Japanese" >> /etc/php.ini
echo "mbstring.internal_encoding = UTF-8" >> /etc/php.ini
echo "mbstring.http_input = pass" >> /etc/php.ini
echo "mbstring.http_output = pass" >> /etc/php.ini
echo "mbstring.encoding_translation = Off" >> /etc/php.ini
echo "mbstring.detect_order = auto" >> /etc/php.ini
echo "mbstring.substitute_character = none;" >> /etc/php.ini
echo "mbstring.func_overload = 0" >> /etc/php.ini
echo "mbstring.strict_detection = Off" >> /etc/php.ini
echo "mbstring.http_output_conv_mimetype=" >> /etc/php.ini
#mysql setting
mv /etc/my.cnf /etc/my.cnf.org
touch /etc/my.cnf
echo "[mysqld]" >> /etc/my.cnf
echo "datadir=/var/lib/mysql" >> /etc/my.cnf
echo "socket=/var/lib/mysql/mysql.sock" >> /etc/my.cnf
echo "user=mysql" >> /etc/my.cnf
echo "character_set_server=utf8" >> /etc/my.cnf
echo "skip-character-set-client-handshake" >> /etc/my.cnf
echo "" >> /etc/my.cnf
echo "[mysqld_safe]" >> /etc/my.cnf
echo "character_set_server=utf8" >> /etc/my.cnf
echo "skip-character-set-client-handshake" >> /etc/my.cnf
/etc/init.d/mysqld start
chkconfig mysqld on
#apache setting
touch /etc/httpd/conf.d/eccube.conf
echo "NameVirtualHost *:80" >> /etc/httpd/conf.d/eccube.conf
echo "" >> /etc/httpd/conf.d/eccube.conf
echo "<VirtualHost *:80>" >> /etc/httpd/conf.d/eccube.conf
echo " ServerName localhost" >> /etc/httpd/conf.d/eccube.conf
echo " DocumentRoot /var/www/eccube/html" >> /etc/httpd/conf.d/eccube.conf
echo "" >> /etc/httpd/conf.d/eccube.conf
echo " <Directory \"/var/www/eccube/html\">" >> /etc/httpd/conf.d/eccube.conf
echo " Options FollowSymLinks" >> /etc/httpd/conf.d/eccube.conf
echo " AllowOverride None" >> /etc/httpd/conf.d/eccube.conf
echo " Order allow,deny" >> /etc/httpd/conf.d/eccube.conf
echo " Allow from all" >> /etc/httpd/conf.d/eccube.conf
echo " </Directory>" >> /etc/httpd/conf.d/eccube.conf
echo "" >> /etc/httpd/conf.d/eccube.conf
echo " ErrorLog /var/log/eccube/error.log" >> /etc/httpd/conf.d/eccube.conf
echo " CustomLog /var/log/eccube/access.log common" >> /etc/httpd/conf.d/eccube.conf
echo "</VirtualHost>" >> /etc/httpd/conf.d/eccube.conf
mkdir /var/log/eccube
/etc/init.d/httpd start
chkconfig httpd on
# ec-cube database setting
mysql -u root -e "CREATE DATABASE eccube_db;"
mysql -u root -e "GRANT ALL PRIVILEGES ON *.* TO 'eccube_db_user'@'localhost' IDENTIFIED BY '0000' WITH GRANT OPTION;"
# install end
echo ""
echo ""
echo ""
echo "#########################################################"
echo "# EC-CUBE installed !!"
echo "#"
echo "# database : mysql"
echo "# database address : localhost"
echo "# create database : eccube_db"
echo "# create database user : eccube_db_user"
echo "# database user password : 0000"
echo "#########################################################"
@k-motoyan
Copy link
Author

CentOS6系用のEC-CUBEインストールスクリプト

ec-cubeのテスト環境構築をこのスクリプト一つで行えます。 
決して、本番環境構築に利用しないで下さい。
このスクリプトで構築した環境は脆弱性の塊です!!
【構築環境】
PHP5.4
MySQL5.5
Apache2.2
EC-CUBE2.12.5
【備考】
64bit版のみを対象とする
80番ポートの開放、またはiptablesを止めること
既にPHP,MySQL,Apacheがインストールされている環境では動作しません。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment