Skip to content

Instantly share code, notes, and snippets.

@snooc
Last active December 11, 2015 04:18
Show Gist options
  • Save snooc/4543845 to your computer and use it in GitHub Desktop.
Save snooc/4543845 to your computer and use it in GitHub Desktop.

Setup Rails App Server

nginx, passenger, rails, rbenv, ruby 1.9.3-p362

root$

  1. ssh root@ip.add.re.ss to SSH into server

  2. apt-get -y update To update sources

  3. apt-get -y upgrade To upgrade the OS

  4. To install libraries needed to compile ruby:

    apt-get -y install build-essential zlib1g-dev libssl-dev libreadline-dev libyaml-dev libcurl4-openssl-dev curl git-core     python-software-properties vim
    
  5. apt-get -y install ruby1.9.3 To install system ruby

  6. apt-get -y install nodejs To install nodejs

  7. echo -e "install: --no-rdoc --no-ri\nupdate: --no-rdoc --no-ri" >> /etc/gemrc

  8. gem install passenger To install passenger

  9. adduser deploy To create a new deploy user, homedirectory, and group

  10. To install init.d script for nginx:

    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
    

deploy$

  1. ssh deploy@ip.add.re.ss to SSH into server
  2. git clone git://github.com/sstephenson/rbenv.git ~/.rbenv To copy rbenv
  3. echo 'export PATH="$HOME/.rbenv/bin:$HOME/.rbenv/shims:$PATH"' >> ~/.profile To add rbenv to path
  4. echo 'eval "$(rbenv init -)"' >> ~/.profile To add init and shims
  5. exec $SHELL -l To restart our shell
  6. rbenv rehash To rebuild shims
  7. git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build To install ruby-build
  8. rbenv install 1.9.3-p362 To install the latest version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment