-
-
Save newbamboo/1261956 to your computer and use it in GitHub Desktop.
Linode Ubuntu 10.04 (Lucid) with passenger & nginx for rails hosting
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
################################################################# | |
# # | |
# A guide to setting up a linode Ubuntu VPS for # | |
# Ruby on Rails hosting with nginx & passenger # | |
# # | |
# Compiled by Chris Toomey [ctoomey.com] on Sept. 9 2011 # | |
# # | |
################################################################# | |
# Start with base 10.04 image. Setup the DNS for any domains you | |
# want to host with this server | |
# SSH in and create deploy user | |
ssh root@<IP address> | |
adduser deploy | |
usermod -g admin deploy # add user to admin, => sudo ability | |
cd /home/deploy | |
mkdir ~/.ssh | |
# Update the hostnmae per this linode guide: | |
# http://library.linode.com/getting-started#sph_set-the-hostname | |
echo 'kermit' > /etc/hostname | |
hostname -F /etc/hostname | |
vim /etc/hosts # Update the ip / FQDN line | |
# Create the ssh key pair, then exit the linode | |
su deploy | |
ssh-keygen | |
exit | |
# Setup named connection info for the server on the dev box | |
vim ~/.ssh/config # Add nickname, hostname (ip), and user | |
# Host kermit | |
# HostName <IP address> | |
# User deploy | |
# From local machine, cat the server's new public key to the | |
# clipboard to then setup the server in github | |
ssh kermit 'cat ~/.ssh/id_rsa.pub' | pbcopy | |
# Add local machines public key to server | |
cat ~/.ssh/id_rsa.pub | ssh user@hostname "cat - >> ~/.ssh/authorized_keys" | |
# Setup named connection info for the server | |
vim ~/.ssh/config # Add nickname, hostname (ip), and user | |
# Host kermit | |
# HostName <IP address> | |
# User deploy | |
ssh kermit | |
# Remove passowrd authentication option | |
vim /etc/ssh/sshd_config | |
# Ensure the following settings | |
ChallengeResponseAuthentication no | |
PasswordAuthentication no | |
UsePAM no | |
# Update the system | |
sudo apt-get update | |
sudo apt-get upgrade | |
# Get us some git | |
sudo apt-get install curl git-core | |
# Setup rvm to manage my rubys. Single user install | |
bash < <(curl -s https://rvm.beginrescueend.com/install/rvm) | |
# Add the needed dependencies per instructions in rvm install output | |
sudo apt-get install build-essential bison openssl libreadline6 libreadline6-dev \ | |
curl git-core zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-0 libsqlite3-dev \ | |
sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev ncurses-dev automake | |
# Install and set default ruby | |
rvm install 1.9.2 | |
rvm use 1.9.2 --default | |
# Install passenger & nginx | |
gem install passenger | |
rvmsudo passenger-install-nginx-module # Accept defaults | |
# Setup the init file to start and keep nginx running | |
# NOTE: this should be performed as root, rather than | |
# using sudo | |
su # Switch to root user for the next few commands | |
curl -L http://bit.ly/nginx-ubuntu-init-file > /etc/init.d/nginx | |
chmod +x /etc/init.d/nginx | |
update-rc.d nginx defaults | |
/etc/init.d/nginx start | |
# Get zsh in there | |
sudo apt-get install zsh | |
chsh -s $(which zsh) | |
git clone git://github.com/robbyrussell/oh-my-zsh.git ~/.oh-my-zsh | |
# MySQL | |
sudo apt-get install mysql-server | |
# Github keys | |
# From the server, do this once | |
ssh [email protected] | |
# Capistrano | |
# You'll need this in config/deploy.rb to get Capistrano to work with RVM | |
# Add RVM's lib directory to the load path. | |
$:.unshift(File.expand_path('./lib', ENV['rvm_path'])) | |
# Load RVM's capistrano plugin. | |
require "rvm/capistrano" | |
set :rvm_ruby_string, '1.9.2' | |
set :rvm_type, :user # Don't use system-wide RVM | |
# Rails | |
# You'll probably need libmysqlclient-dev in order for the MySQL Ruby adapter to work | |
sudo apt-get install libmysqlclient-dev |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment