Skip to content

Instantly share code, notes, and snippets.

@emag
Last active December 19, 2015 01:48
Show Gist options
  • Save emag/5878161 to your computer and use it in GitHub Desktop.
Save emag/5878161 to your computer and use it in GitHub Desktop.
Vagrant provisioning script for CentOS 6.4 32bit
#!/usr/bin/env bash
INSTALL="yum install -y"
GROUP_INSTALL="yum groupinstall -y"
ENABLE_REPO="--enablerepo=epel,remi,rpmforge,nginx"
EPEL="http://dl.fedoraproject.org/pub/epel/6/i386/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.i686.rpm"
NGINX="http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm"
MAVEN_VERSION="3.0.5"
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
cd /etc/yum.repos.d
sed -i -e s/enabled.*=.*1/enabled=0/ epel.repo remi.repo rpmforge.repo nginx.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.i686
$INSTALL zsh
$INSTALL git
$INSTALL nkf $ENABLE_REPO
$INSTALL nginx $ENABLE_REPO
$INSTALL java-1.6.0-openjdk.i686
$INSTALL java-1.6.0-openjdk-devel.i686
$INSTALL java-1.7.0-openjdk.i686
$INSTALL java-1.7.0-openjdk-devel.i686
## installing software has no repository
#
cd /usr/local
wget -qO- -O tmp.zip $WGET_MAVEN && unzip tmp.zip && rm 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=/usr/local/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