Skip to content

Instantly share code, notes, and snippets.

@wearethefoos
Last active December 17, 2015 07:09
Show Gist options
  • Save wearethefoos/5570931 to your computer and use it in GitHub Desktop.
Save wearethefoos/5570931 to your computer and use it in GitHub Desktop.
Install Ruby 2.0, Nginx, Postgres, Passenger, NodeJS, ElasticSearch on Ubuntu 12.10
# Install Ruby 2.0
apt-get -y update
apt-get -y -m install build-essential zlib1g-dev libssl-dev libreadline-gplv2-dev libyaml-dev libxslt1-dev libxml2-dev libcurl4-openssl-dev libffi-dev libgdbm-dev libncurses5-dev
cd /tmp
wget http://ftp.ruby-lang.org/pub/ruby/ruby-2.1.0.tar.gz
tar xzvf ruby-2.1.0.tar.gz
cd ruby-2.1.0/
./configure --prefix=/usr/local
make
make install
gem update --system
gem install bundler
ruby -v
# Install Nginx + Postgres + Passenger
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev curl git-core python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
sudo apt-get -y update
sudo apt-get -y install nodejs
sudo apt-add-repository ppa:pitti/postgresql
sudo apt-get -y update
sudo apt-get -y install postgresql-9.3 libpq-dev
gem install passenger
passenger-install-nginx-module
# Create a user for deploys and Passenger
adduser deploy
# Create a Postgres user and database
su - postgres
psql -d template1 -U postgres
CREATE USER deploy WITH PASSWORD 'verysecret';
CREATE DATABASE app_name;
GRANT ALL PRIVILEGES ON DATABASE app_name to deploy;
\q
# After installation is finished, you’ll get some configuration tips for Nginx to use Passenger, and we’re going to make one
# other change. Open up /opt/nginx/conf/nginx.conf and add the following line at the top:
#
# user deploy staff;
wget -O init-deb.sh http://library.linode.com/assets/660-init-deb.sh
mv init-deb.sh /etc/init.d/nginx
chmod +x /etc/init.d/nginx
/usr/sbin/update-rc.d -f nginx defaults
sudo service nginx start
# Example host config for Rails Nginx
#
# server {
# listen 80;
# server_name example.com;
# root /home/deploy/MYAPPLICATION/public; # <--- be sure to point to 'public'!
# passenger_enabled on;
# }
# Install ElasticSearch with a deb package
sudo apt-get update
sudo apt-get install openjdk-7-jre -y
wget https://download.elasticsearch.org/elasticsearch/elasticsearch/elasticsearch-0.90.0.deb
dpkg -i elasticsearch-0.90.0.deb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment