Created
September 9, 2011 17:09
-
-
Save christoomey/1206762 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 | |
su deploy | |
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, ie 191.191.191.191 kermit.ctoomey.com kermit | |
# Create the ssh key pair, then exit the linode | |
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 | |
# Add local machines public key to server | |
cat ~/.ssh/id_rsa.pub | ssh kermit "cat - >> ~/.ssh/authorized_keys" | |
# Get server public key in clipboard to then setup the server in github | |
ssh kermit 'cat ~/.ssh/id_rsa.pub' | pbcopy | |
ssh kermit | |
# Remove password 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) | |
source /home/deploy/.rvm/scripts/rvm # This will need to be setup in .zshrc | |
# 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 passeneger | |
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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
there's a typo at line 78 (passeneger instead of passenger)