Skip to content

Instantly share code, notes, and snippets.

@jacksmith117
Forked from vladimir-e/vps.md
Last active August 29, 2015 14:17
Show Gist options
  • Select an option

  • Save jacksmith117/aad66f086b5e6e82aa4f to your computer and use it in GitHub Desktop.

Select an option

Save jacksmith117/aad66f086b5e6e82aa4f to your computer and use it in GitHub Desktop.

Server Commands

apt-get -y update
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties

# nginx
add-apt-repository ppa:nginx/stable
apt-get -y update
apt-get -y install nginx
service nginx start

# PostgreSQL
add-apt-repository ppa:pitti/postgresql
apt-get -y update
apt-get -y install postgresql libpq-dev
sudo -u postgres psql
# \password
# create user blog with password 'secret';
# create database blog_production owner blog;
# \q

# Mysql
sudo apt-get install mysql-server mysql-client libmysqlclient-dev

# Postfix
apt-get -y install telnet postfix

# Node.js
add-apt-repository ppa:chris-lea/node.js
apt-get -y update
apt-get -y install nodejs

# Redis
sudo apt-get update
sudo apt-get install tcl8.5
wget http://download.redis.io/releases/redis-2.8.13.tar.gz
tar zxf redis-2.8.13.tar.gz
cd redis-2.8.13
make
make test
sudo make install
cd utils
sudo ./install_server.sh
# sudo service redis_6379 start
# sudo service redis_6379 stop
# check
redis-cli
# start on boot
sudo update-rc.d redis_6379 defaults

# Add deployer user
groupadd admin
adduser rordev --ingroup admin
su rordev
cd

# Ruby with rbenv railscasts
curl -L https://raw.github.com/fesplugas/rbenv-installer/master/bin/rbenv-installer | bash
vim .bashrc # add rbenv to the top
. .bashrc
rbenv bootstrap-ubuntu-10-04
rbenv install 1.9.3-p125
rbenv global 1.9.3-p125
gem install bundler --no-ri --no-rdoc
rbenv rehash

# rbenv (gorails)
cd
git clone git://github.com/sstephenson/rbenv.git .rbenv
echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
echo 'eval "$(rbenv init -)"' >> ~/.bashrc
exec $SHELL

git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
echo 'export PATH="$HOME/.rbenv/plugins/ruby-build/bin:$PATH"' >> ~/.bashrc
exec $SHELL

rbenv install 2.1.2
rbenv global 2.1.2
ruby -v

echo "gem: --no-ri --no-rdoc" > ~/.gemrc
gem install bundler
rbenv rehash

# Get to know github.com
ssh [email protected]

# modify sudoers (capistrano 3)
sudo vim rordev

rordev ALL=NOPASSWD:/etc/init.d/nginx
rordev ALL=NOPASSWD:/bin/ln -nfs /home/rordev/www/* /etc/nginx/sites-enabled/*
rordev ALL=NOPASSWD:/bin/ln -nfs /home/rordev/www/* /etc/init/*

sudo mv rordev /etc/sudoers.d/rordev
sudo chown root:root /etc/sudoers.d/rordev

# check
exit
/etc/init.d/nginx status


cap staging deploy:setup_config

cp shared/config/database.example.yml shared/config/database.yml

cap staging deploy


===============

additionally swap file can be added

RailsCasts Episode #335: Deploying to a VPS

Setup Ruby On Rails on Ubuntu 14.04

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