Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kalendae/5633609 to your computer and use it in GitHub Desktop.
Save kalendae/5633609 to your computer and use it in GitHub Desktop.
centos6-rvm-ruby2-rails4-unicorn-nginx-setup
-
ssh as root
-
adduser tao;passwd tao
-
usermod -a -G wheel tao, then visudo and uncomment line # %wheel ALL=(ALL) ALL
-
set UTC time: rm /etc/localtime then ln -s /usr/share/zoneinfo/UTC /etc/localtime
-
Turn off SELINUX - vi /etc/selinux/config set to disabled
-
edit /etc/bashrc add to end of the file the following:
export HISTSIZE=10000
alias mem='ps -e -orss=,args= | sort -b -k1,1n | pr -TW$COLUMNS'
-
ssh as tao
-
add pub key to ~/.ssh/authorized_keys
chmod 700 .ssh chmod 600 authorized_keys if setting up ssh authorized_keys
-
sudo yum install git
git config --global user.name "kalendae"
git config --global user.email [email protected]
provide ssh key to github: instructions at http://github.com/guides/providing-your-ssh-key#linux
-
from : https://www.digitalocean.com/community/articles/how-to-install-ruby-on-rails-on-centos-6-with-rvm
for latest rvm: https://rvm.io/rvm/install
sudo yum update
sudo yum install curl
curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
rvm get stable
rvm requirements --verify-downloads 1
rvm install ruby-2.0.0
-
mysql:
sudo yum install mysql mysql-devel mysql-server
sudo chkconfig --level 345 mysqld on
-
redis:
sudo yum install redis
sudo chkconfig --level 345 redis on
-
nginx:
sudo yum remove httpd
sudo yum install epel-release
sudo yum install nginx
sudo chkconfig --level 345 nginx on
set /etc/nginx/nginx.conf to https://gist.github.com/kalendae/d2bf99b2d25036dd9857
-
unicorn:
add unicorn to gemfile
bundle install
set config/unicorn.rb to https://gist.github.com/kalendae/1c26f9189e4b6698412d
edit the unicorn.rb file
rvmsudo rvm wrapper 2.0.0-p247 bootup unicorn_rails
sudo mkdir /etc/unicorn
sudo vi /etc/unicorn/commentwheel.conf
add these contents to commentwheel.conf:
RAILS_ROOT=/home/tao/commentwheel
RAILS_ENV=production
UNICORN=/home/tao/.rvm/bin/bootup_unicorn_rails
create /etc/init.d/unicorn from https://gist.github.com/kalendae/4ede02e619d6ed3ae383
sudo chmod +x /etc/init.d/unicorn
sudo chkconfig --add unicorn
sudo chkconfig --level 345 unicorn on
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment