Skip to content

Instantly share code, notes, and snippets.

@statique
Created September 25, 2012 19:18
Show Gist options
  • Save statique/3783870 to your computer and use it in GitHub Desktop.
Save statique/3783870 to your computer and use it in GitHub Desktop.
Setup Ubuntu 12.04 Web Server for Apache Passenger Rails RBEnv Postgres Memcache
# rbenv inspired by https://gist.github.com/1441139
# make sure running as root user
apt-get -y update
apt-get install linux-headers-2.6.32-5-amd64
apt-get -y upgrade
apt-get -y install curl git-core python-software-properties build-essential git-core curl libssl-dev libreadline5 libreadline5-dev zlib1g zlib1g-dev libcurl4-openssl-dev libxslt-dev libxml2-dev
# add-apt-repository
curl -o /usr/sbin/add-apt-repository http://blog.anantshri.info/content/uploads/2010/09/add-apt-repository.sh.txtchmod o+x /usr/sbin/add-apt-repository
chown root:root /usr/sbin/add-apt-repository
# PostgreSQL
add-apt-repository ppa:pitti/postgresql
apt-get -y update
apt-get -y install postgresql-9.2
apt-get -y install libpq-dev
# Apache
apt-get install apache2
apt-get install libapache2-mod-passenger
service apache2 start
# Node.jsadd-apt-repository ppa:chris-lea/node.js
apt-get -y update
apt-get -y install nodejs
# Memcached
apt-get -y install memcached
service memcached start
# Install Firewall
apt-get -y install ufw
ufw enable
ufw allow 22
ufw allow 80
# rbenv
# Install rbenv
git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv
# Add rbenv to the path:
echo '# rbenv setup' > /etc/profile.d/rbenv.sh
echo 'export RBENV_ROOT=/usr/local/rbenv' >> /etc/profile.d/rbenv.sh
echo 'export PATH="$RBENV_ROOT/bin:$PATH"' >> /etc/profile.d/rbenv.sh
echo 'eval "$(rbenv init -)"' >> /etc/profile.d/rbenv.sh
chmod +x /etc/profile.d/rbenv.sh
source /etc/profile.d/rbenv.sh
# Install ruby-build:
pushd /tmp
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
rbenv global 1.9.3-p194
cat << EOF > /root/.gemrc
---
:verbose: true
:bulk_threshold: 1000
install: --no-ri --no-rdoc --env-shebang
:sources:
- http://gems.rubyforge.org/
:benchmark: false
:backtrace: false
update: --no-ri --no-rdoc --env-shebang
:update_sources: true
EOF
rbenv rehash
gem update --system
gem install bundler
# Add deployer user
adduser deployer --ingroup sudo
su deployer
shutdown -r now
@statique
Copy link
Author

Install Ruby 1.9.3-p286:

rbenv install 1.9.3-p286
rbenv global 1.9.3-p286

@statique
Copy link
Author

Install Ruby 1.9.3-p327

rbenv install 1.9.3-p327
rbenv global 1.9.3-p327

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment