Last active
December 20, 2015 09:09
-
-
Save emag/6106134 to your computer and use it in GitHub Desktop.
Vagrant provisioning script for CentOS 6.4 64bit
This file contains 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
#!/usr/bin/env bash | |
## usage | |
# add this script path in VagrantFile | |
# --- | |
# Vagrant.configure("2") do |config| | |
# config.vm.box = "box-name" | |
# config.vm.provision :shell, :path => "bootstrap_centos64_64.sh" | |
# ... | |
# --- | |
INSTALL="yum install -y" | |
GROUP_INSTALL="yum groupinstall -y" | |
ENABLE_REPO="--enablerepo=epel,remi,rpmforge,nginx,pgdg92" | |
EPEL="http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm" | |
REMI="http://rpms.famillecollet.com/enterprise/remi-release-6.rpm" | |
RPMFORGE="http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.x86_64.rpm" | |
NGINX="http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm" | |
PG="http://yum.postgresql.org/9.2/redhat/rhel-6-x86_64/pgdg-centos92-9.2-6.noarch.rpm" | |
MAVEN_VERSION="3.1.1" | |
MAVEN_BINARY="apache-maven-$MAVEN_VERSION" | |
WGET_MAVEN="http://ftp.kddilabs.jp/infosystems/apache/maven/maven-3/$MAVEN_VERSION/binaries/$MAVEN_BINARY-bin.zip" | |
yum upgrade -y | |
## add repos | |
# | |
rpm -i $EPEL | |
rpm -i $REMI | |
rpm -i $RPMFORGE | |
rpm -i $NGINX | |
rpm -i $PG | |
cd /etc/yum.repos.d | |
sed -i -e s/enabled.*=.*1/enabled=0/ epel.repo remi.repo rpmforge.repo nginx.repo pgdg-92-centos.repo | |
cd $HOME | |
## add packages | |
# | |
$GROUP_INSTALL "Development Tools" | |
$INSTALL man | |
$INSTALL unzip | |
# for git src build | |
$INSTALL perl-ExtUtils-MakeMaker | |
$INSTALL tcl | |
$INSTALL gettext | |
$INSTALL libcurl-devel | |
$INSTALL vim-enhanced | |
$INSTALL zsh | |
$INSTALL git | |
$INSTALL nkf $ENABLE_REPO | |
$INSTALL httpd | |
$INSTALL nginx $ENABLE_REPO | |
$INSTALL java-1.6.0-openjdk | |
$INSTALL java-1.6.0-openjdk-devel | |
$INSTALL java-1.7.0-openjdk | |
$INSTALL java-1.7.0-openjdk-devel | |
$INSTALL postgresql92 $ENABLE_REPO | |
$INSTALL postgresql92-server $ENABLE_REPO | |
$INSTALL postgresql92-docs $ENABLE_REPO | |
$INSTALL postgresql92-contrlib $ENABLE_REPO | |
## installing software has no repository | |
# | |
cd /opt | |
wget -qO- -O tmp.zip $WGET_MAVEN && unzip tmp.zip && rm -fr tmp.zip && ln -s $MAVEN_BINARY maven | |
## configure services | |
# | |
/etc/init.d/iptables stop && chkconfig iptables off | |
/etc/init.d/ip6tables stop && chkconfig ip6tables off | |
## user setting | |
# | |
USERNAME="vagrant" | |
USERDIR=/home/$USERNAME | |
chsh -s /bin/zsh $USERNAME | |
touch $USERDIR/.zshrc | |
cd $USERDIR | |
git clone https://github.com/emag/config.git | |
CONFIG=$USERDIR/config | |
cd $CONFIG | |
git checkout -b simplified origin/simplified | |
chown -R $USERNAME:$USERNAME $CONFIG | |
sudo -u $USERNAME ./setup.sh | |
sudo -u $USERNAME vim -c NeoBundleInstall -c q! | |
cp $CONFIG/.vim/bundle/desert256.vim/colors/desert256.vim $CONFIG/.vim/colors | |
echo "## maven\n#\nexport M2_HOME=/opt/maven\nexport M2=\$M2_HOME/bin\nexport PATH=\$M2:\$PATH\n" >> $CONFIG/.zsh/.zshrc.local | |
chown -R $USERNAME:$USERNAME $CONFIG | |
cd $HOME |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment