Skip to content

Instantly share code, notes, and snippets.

@kaz29
Created January 8, 2012 08:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save kaz29/1577742 to your computer and use it in GitHub Desktop.
Save kaz29/1577742 to your computer and use it in GitHub Desktop.
baserCMS Setup Script for NiftyCloud - Ubuntu 10.04 64bit Plain
#!/bin/sh
export BASERCMS_PATH=/usr/local/app
if [ ! -d $BASERCMS_PATH ]
then
mkdir $BASERCMS_PATH
fi
# IPアドレスを取得
export IPADDR=`ip addr show | grep eth0 | grep 'inet *' | awk '{print $2;}' | cut -f1 -d '/'`
apt-get update
apt-get -y upgrade
apt-get install -y curl unzip git-core
# apache2,php5インストール
apt-get install -y apache2 apache2-mpm-prefork apache2-utils libapache-mod-security libapache2-mod-php5 \
php5 php5-curl php5-cli php5-xdebug php5-mcrypt php-pear php5-common php5-gd php5-ldap php5-xsl php5-intl php-apc
# FW設定更新
ufw allow 80
# baserCMSをダウンロード
cd $BASERCMS_PATH
wget "http://basercms.net/packages/download/basercms/latest" --output-document=basercms.zip
unzip basercms.zip
rm basercms.zip
chmod go+w $BASERCMS_PATH/basercms/app/config
chmod go+w $BASERCMS_PATH/basercms/app/config/core.php
chmod go+w $BASERCMS_PATH/basercms/app/tmp
chmod go+w $BASERCMS_PATH/basercms/app/webroot/themed
chmod go+w $BASERCMS_PATH/basercms/app/db
# apacheの設定
a2enmod rewrite
cat <<_EOT_ 1>/etc/apache2/sites-available/basercms
<VirtualHost *:80>
ServerName $IPADDR
DocumentRoot "$BASERCMS_PATH/basercms"
ErrorLog /var/log/apache2/cakephp_error_log
CustomLog /var/log/apache2/cakephp_access_log combined
RewriteEngine on
RewriteLogLevel 0
<Directory "$BASERCMS_PATH/basercms">
Options FollowSymLinks Includes
AllowOverride All
order allow,deny
allow from all
</Directory>
</VirtualHost>
_EOT_
a2dissite default
a2ensite basercms
# PHPの設定を変更
/bin/sed -i.orig -e "s/;date.timezone =/date.timezone = Asia\/Tokyo/g" /etc/php5/apache2/php.ini
/bin/sed -i.orig -e "s/;date.timezone =/date.timezone = Asia\/Tokyo/g" /etc/php5/cli/php.ini
/bin/sed -i.orig -e "s/# configuration/; configuration/g" /etc/php5/cli/conf.d/mcrypt.ini
# mysqlインストール
apt-get install -y mysql-server mysql-common mysql-client php5-mysql
# データベースを作成
echo "baserCMS用のデータベースを作成します。MySQLインストール時に指定したパスワードを入力してください。"
echo "CREATE DATABASE baser CHARACTER SET utf8;" | mysql -u root -p
# apacheを再起動
service apache2 restart
echo "==== インストール終了 ===="
echo "http://$IPADDR/ にアクセスしてbaserCMSの設定を続けてください。"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment