Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save zonoise/1835654 to your computer and use it in GitHub Desktop.
Save zonoise/1835654 to your computer and use it in GitHub Desktop.
procesure for ruby on rails on nginx on ubuntu using passenger

Variables

  • USERNAME
  • PASSWORD
  • SSHPORT

USER

locale

SSH

KEY

  1. [local]公開鍵をVPSに送る scp
  2. [remote]VPSで公開鍵を配置する。
  3. [remote]鍵と鍵の入っているフォルダのパーミッション

CONFIG

/etc/ssh/sshd_config
PermitRootLogin no
PasswordAuthentication no
/etc/services
ssh              ${SSHPORT}/tcp
ssh              ${SSHPORT}/udp
sshd -t #test
service ssh restart

UPDATE

apt-get update
apt-get upgrade
apt-get install build-essential
apt-get install checkinstall

UFW

sudo ufw default deny
sudo ufw allow 80
sudo ufw allow ${SSHPORT}
sudo ufw enable
sudo ufw status

Ruby

Libyaml (for Ruby)

wget  http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
tar xvfz yaml-0.1.4.tar.gz 
cd yaml-0.1.4/
./configure 
make
sudo checkinstall

Ruby

wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
tar ruby-1.9.3-p0.tar.gz
cd ruby-1.9.3-p0/
./configure
make
sudo checkinstall

Ruby openssl extension

cd ruby-1.9.3-p0/ext/openssl/
ruby extconf.rb
make
sudo checkinstall

Ruby readline extension

cd ruby-1.9.3-p0/ext/readline/
ruby extconf.rb
make
sudo make install #instead checkinstall

Rubygems

wget http://rubyforge.org/frs/download.php/75833/rubygems-1.8.16.tgz
tar xzfv rubygems-1.8.16.tgz 
cd rubygems-1.8.16/
ruby setup.rb --help
ruby setup.rb

Passenger

Install

gem install passenger

Nginx(using passenger-install-nginx-module command)

Download

wget http://nginx.org/download/nginx-1.0.12.tar.gz
tar xzvf 

Install

sudo passenger-install-nginx-module
=>apt-get install libopenssl-ruby   libcurl4-gnutls-dev  libssl-dev

Q
A 2. No: I want to customize my Nginx installation. (for advanced users)

Q Where is your Nginx source code located?
A =>/path/to/nginx/source

Q Where do you want to install Nginx to?
A /usr/local/nginx

apt-get install libpcre3 libpcre3-dev  zlib1g-dev   # if msg configure script -> PCRE zlib
sh ./configure 
make
checkinstall

StartupScript

http://wiki.nginx.org/Nginx-init-ubuntu

Ruby on Rails

sudo gem install rails 
sudo gem install execjs
apt get install  sqlite3   libsqlite3-dev

Node

wget
http://nodejs.org/dist/v0.6.10/node-v0.6.10.tar.gz
./configure
make
checkinstall

MySQL

sudo apt-get install mysql-server mysql-client

Redis

sudo apt-get install redis-server

logrotate

nginx

redis

mysql

monit

nginx

redis

mysql

Some of the files created by the installation are inside the build
directory: /home/red/ruby-1.9.3-p0
You probably don't want them to be included in the package,
especially if they are inside your home directory.
Do you want me to list them? [n]:
Should I exclude them from the package? (Saying yes is a good idea) [y]:
Copying files to the temporary directory...OK
Stripping ELF binaries and libraries...OK
Compressing man pages...OK
Building file list...OK
Building Debian package...OK
Installing Debian package...OK
Erasing temporary files...OK
Writing backup package...OK
Deleting temp dir...OK
**********************************************************************
Done. The new package has been installed and saved to
/home/red/ruby-1.9.3-p0/ruby-1.9.3_p0-1_amd64.deb
You can remove it from your system anytime using:
dpkg -r ruby-1.9.3
**********************************************************************
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment