Created
August 14, 2012 12:37
-
-
Save burisu/3348997 to your computer and use it in GitHub Desktop.
Initialize global environment for RBenv, Ruby 1.9.3, Apache2 and Passenger
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 | |
# Installs RBenv for production mode with passenger | |
rbenv_dir=/usr/local/lib/rbenv | |
profile_init=/etc/profile.d/rbenv.sh | |
# Install packages | |
apt-get install git build-essential apache2 openssl libcurl4-openssl-dev apache2-prefork-dev zlib1g zlib1g-dev | |
# Install rbenv | |
mkdir -p ${rbenv_dir} | |
rm -fr ${rbenv_dir} | |
git clone git://github.com/sstephenson/rbenv.git ${rbenv_dir} | |
# Add rbenv to the path: | |
echo '# rbenv setup' > ${profile_init} | |
echo "export RBENV_ROOT=${rbenv_dir}" >> ${profile_init} | |
echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> ${profile_init} | |
echo 'eval "$(rbenv init -)"' >> ${profile_init} | |
# echo "# RBenv conf" >> /etc/environment | |
# echo "RBENV_ROOT=${rbenv_dir}" >> /etc/environment | |
# echo 'PATH="$RBENV_ROOT/shims:$RBENV_ROOT/bin:$PATH"' >> /etc/environment | |
echo '' >> "$HOME/.profile" | |
echo '# Load RBenv for root' >> "$HOME/.profile" | |
echo "source ${profile_init}" >> "$HOME/.profile" | |
chmod +x ${profile_init} | |
source ${profile_init} | |
# Install ruby-build: | |
pushd /tmp | |
rm -fr ruby-build | |
git clone git://github.com/sstephenson/ruby-build.git | |
cd ruby-build | |
./install.sh | |
popd | |
# Install Ruby 1.9.3-p194: | |
rbenv install 1.9.3-p194 --with-openssl-dir=/usr/lib | |
rbenv global 1.9.3-p194 | |
# Rehash: | |
rbenv rehash | |
# Install base gems | |
gem install bundle passenger --no-ri --no-rdoc | |
# Rehash: | |
rbenv rehash | |
# Install passenger | |
passenger-install-apache2-module --auto | |
passenger-install-apache2-module --snippet > /etc/apache2/conf.d/passenger | |
# Restart Apache2 | |
invoke-rc.d apache2 restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment