Last active
October 12, 2015 04:28
-
-
Save alingogo/3970864 to your computer and use it in GitHub Desktop.
bootstrap_basic
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
echo "プロキシとfisheyeを設定しますか?(y/n)" | |
read proxy_flag < /dev/tty | |
if [ $proxy_flag = "y" ]; then | |
echo "ユーザ名を入力してください" | |
read user < /dev/tty | |
echo "パスワードを入力してください" | |
read passwd < /dev/tty | |
proxy=proxy.ricoh.co.jp:8080 | |
export http_proxy="http://$user:$passwd@$proxy/" | |
export HTTP_PROXY="http://$user:$passwd@$proxy/" | |
export https_proxy="https://$user:$passwd@$proxy/" | |
export HTTPS_PROXY="https://$user:$passwd@$proxy/" | |
export ftp_proxy="ftp://$user:$passwd@$proxy/" | |
export FTP_PROXY="ftp://$user:$passwd@$proxy/" | |
export no_proxy=spoon.rgk.ricoh.co.jp | |
echo "JIRA用アカウントを入力してください" | |
read JACCOUNT < /dev/tty | |
echo "設定されたメアドを入力してください" | |
read JEMAIL < /dev/tty | |
fi | |
#必要なパッケージは、rvm requirementsを参照した | |
if [[ `uname -a` =~ ^.*Ubuntu.*$ ]]; then #ubuntu | |
echo "debパッケージをインストールする" | |
apt-get update | |
apt-get install -y build-essential openssl libreadline6 libreadline6-dev curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake libtool bison subversion pkg-config openssh-server | |
else # centos | |
echo "yumパッケージをインストールする" | |
yum -y update | |
yum install -y git gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel | |
echo "libyamlをインストール" | |
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-7.noarch.rpm | |
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm | |
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm | |
yum install -y libyaml-devel | |
echo "gitをインストール" | |
wget http://www.magicermine.com/demos/curl/curl/sources/curl-7.28.0.tar.gz | |
tar zxvf curl-7.28.0.tar.gz | |
cd curl-7.28.0 | |
./configure | |
make | |
make install | |
cd .. | |
wget https://github.com/git/git/archive/master.tar.gz | |
tar zxvf master | |
cd git-master | |
make clean | |
make configure | |
./configure --with-curl=/usr/local | |
make | |
sudo make install | |
cd .. | |
fi | |
echo "rvm ruby1.9.3 chefをインストールする" | |
curl -L https://get.rvm.io | bash -s stable | |
source /etc/profile.d/rvm.sh | |
/usr/local/rvm/bin/rvm autolibs enable | |
/usr/local/rvm/bin/rvm install 1.9.3 | |
/bin/bash --login | |
rvm use 1.9.3 | |
gem install chef --no-rdoc --no-ri | |
if [ $proxy_flag = "y" ]; then | |
echo "git flowをインストールして、fisheyeを設定する" | |
wget http://spoon.rgk.ricoh.co.jp/gitflow-install.tar.gz | |
tar zxf gitflow-install.tar.gz | |
cd gitflow-install | |
sh gitflow-installer.sh | |
sleep 3s | |
git config --global user.name $JACCOUNT | |
git config --global user.email $JEMAIL | |
fi | |
if [[ `uname -a` =~ ^.*Ubuntu.*$ ]]; then #ubuntu | |
echo "source /etc/profile.d/rvm.sh" >> /etc/bash.bashrc | |
echo "rvm default 1.9.3" >> /etc/bash.bashrc | |
else | |
echo "rvm default 1.9.3" >> /etc/bashrc | |
fi | |
echo "******************************************" | |
echo "* インストールが完了.................... *" | |
echo "* terminalから退出して、再開してください *" | |
echo "******************************************" | |
echo "* 何か問題があれば、https://gist.github.com/3970864にコメントしてください *" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if [[ `uname -a` =~ ^.*Ubuntu.*$ ]]; then #ubuntu | |
echo "source /etc/profile.d/rvm.sh" >> /etc/bash.bashrc | |
echo "rvm default 1.9.3" >> /etc/bash.bashrc | |
else | |
echo "rvm default 1.9.3" >> /etc/bashrc | |
fi | |
↓↓↓ | |
#root権限で | |
rvm use 1.9.3 --default |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CentOS6.3 | |
----------------------------------------------------------------------------------- | |
【例】windows7上に、vmware playeでcentos6.3をインストールして、bootstrap | |
ゲストOSのインストール手順 | |
1. vmware playerのダウンロード | |
2. 仮想マシンを作成 - memory 1GB; CPU 1個, storage 20GB; DVDを後に入ることを選択する | |
3. centos6.3 i386をDL(live版) - x86-64も | |
iosをDVDに入って、起動して、インストール | |
4. sudo設定 | |
# su - | |
# visudo | |
---- | |
ユーザ名 ALL=(ALL) NOPASSWD: ALL | |
---- | |
5. ssh設定 | |
# service sshd start | |
# chkconfig sshd on | |
bootstrap_basicの使い方と確認 | |
1. 社外(proxyとfisheyeの設定が要らない) | |
wget -qO- https://raw.github.com/gist/3970864/bootstrap_basic | bash | |
2. 社内(proxyとfisheyeの設定が必要) | |
wget -qO- http://spoon.rgk.ricoh.co.jp/bootstrap_basic --no-proxy | bash | |
3. 確認 | |
$ ruby -v | |
$ gem -v | |
$ chef-solo -v | |
$ git --version | |
Ubuntu-ja-12.04 | |
----------------------------------------------------------------------- | |
【例】ubuntu12.04上に、vmware playerでubuntu-ja-12.04をインストールして、bootstrap | |
ゲストOSのインストール手順 | |
1. vmware playerのダウンロード | |
2. 仮想マシンを作成 - memory 1GB; CPU 1個, storage 20GB; DVDを後に入ることを選択する | |
3. ubuntu-ja-12.04版 | |
iosをDVDに入って、起動して、インストール | |
4. ssh設定 | |
openssh-serverは、ubuntu-ja-12.04に入ってないけど、bootstrapの時にインストール | |
bootstrap_basicの使い方と確認 | |
1. 社外(proxyとfisheyeの設定が要らない) | |
wget -qO- https://raw.github.com/gist/3970864/bootstrap_basic | bash | |
2. 社内(proxyとfisheyeの設定が必要) | |
wget -qO- http://spoon.rgk.ricoh.co.jp/bootstrap_basic --no-proxy | bash | |
3. 確認 | |
$ ruby -v | |
$ gem -v | |
$ chef-solo -v | |
$ git --version | |
* centos6.3に、git1.8.0をインストールしたけど、ubuntuにapt-getでインストール |
bashで、カラーを表示
ESC="\e["
ESCEND=m
COLOR_OFF=${ESC}${ESCEND}
echoNomal() {
echo "${1}" | tee -a ${LOG}
}
echoComment() {
# 文字色:Black Bold(灰色)
echo -en "${ESC}30;1${ESCEND}"
echo "${1}"
echo -en "${COLOR_OFF}"
}
echoPass() {
# 文字色:green
echo -en "${ESC}32${ESCEND}"
echo "---------------------"
echo "${1}" | tee -a ${LOG}
echo "---------------------"
echo -en "${COLOR_OFF}"
}
echoAlert() {
# 文字色:red
echo -en "${ESC}31${ESCEND}"
echo "---------------------"
echo "${1}" | tee -a ${LOG}
echo "---------------------"
echo -en "${COLOR_OFF}"
}
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
linux系のOSネームとバージョン
$ cat /etc/
ls /etc -F | grep "release$\|version$"
CentOS release 6.3 (Final)
$ cat /etc/issue
Ubuntu 12.04 LTS \n \l
$ lsb_release -r
Release: 12.04
http://blog.layer8.sh/ja/2011/12/23/linux%E3%82%B5%E3%83%BC%E3%83%90%E3%83%BC%E3%81%AE%E3%83%90%E3%83%BC%E3%82%B8%E3%83%A7%E3%83%B3%E3%82%84os%E5%90%8D%E3%82%92%E8%AA%BF%E3%81%B9%E3%82%8B%E3%82%B3%E3%83%9E%E3%83%B3%E3%83%89linux/