Skip to content

Instantly share code, notes, and snippets.

@DQNEO
Created January 13, 2012 17:38
Show Gist options
  • Save DQNEO/1607706 to your computer and use it in GitHub Desktop.
Save DQNEO/1607706 to your computer and use it in GitHub Desktop.
サーバ構築自動化スクリプト(ただの練習用)
#!/bin/bash
#
# ※これはただの落書きみたいなものです。マネしないで!!
#
# 1. このファイルをローカルからリモートサーバに転送する。
# scp init.sh -i key.pem root@example.com
#
# 2. リモートサーバにログインして、root権限で実行する
# $ ssh -i key.pem root@example.com
# # bash init.sh
#
# sshの設定変更
echo "setting /etc/bashrc ..."
cat <<EOF >> /etc/bashrc
export SVN_URL=http://svn.example.com/repos/prjectA
export SVN_USER=userfoo
export SVN_PASSWD=secret
EOF
source /etc/bashrc
svn co -q $SVN_URL/setup /tmp/setup --username $SVN_USER --password $SVN_PASSWD
echo "checking out setup scripts...ok"
echo "executing setup scripts..."
bash /tmp/setup/setup_ec2.sh
# ==== setup_ec2.sh =======
export DOMAIN_HON=example.com
export DOMAIN_KAI=trunk.example.com
# root
echo "entering /tmp/setup"
cd /tmp/setup
cp /usr/share/zoneinfo/Japan /etc/localtime
echo "setting timezone ok"
yum -y -q update
echo "yum update...ok"
yum -y install yum-fastestmirror
# yum -y install zsh emacs
# add user
useradd userhoge -p himitsu
chmod 0755 /home/userhoge
echo "adding a user...ok"
# setup mysql
bash setup_mysqld.sh
echo "setting mysqld ...ok"
# checkout trunk and insert sql
echo "checkout trunk..."
su -l userhoge -c /tmp/setup/checkout_trunk.sh
echo "ok"
# install php httpd
# install ImagiMagick Imagick php-gd
# setup http.conf
echo "setting httpd ..."
bash setup_httpd.sh
echo "ok"
# ?
bash install_middleware.sh
# setup postfix
echo "setting postfix ..."
bash setup_postfix.sh
echo "ok"
# for convenience
bash install_screen.sh
bash test_run.sh
# mysql_secure_installation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment