Monthly Archives: October 2014

Ruby on Rails 3 and Ruby 1.9 on cPanel

bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison iconv-devel source "$HOME/.rvm/scripts/rvm" echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc

rvm install 1.9.2
rvm –default 1.9.2

gem install bundler
gem install passenger
passenger-install-apache2-module

vi /usr/local/apache/conf/includes/pre_main_global.conf
LoadModule passenger_module /home/ruby/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /home/ruby/.rvm/gems/ruby-1.9.2-p290/gems/passenger-3.0.11
PassengerRuby /home/ruby/.rvm/wrappers/ruby-1.9.2-p290/ruby
PassengerResolveSymlinksInDocumentRoot on

cp /usr/local/apache/conf/httpd.conf /usr/local/apache/conf/httpd.conf.bak-modrails
/usr/local/cpanel/bin/apache_conf_distiller –update
/scripts/rebuildhttpdconf
/etc/init.d/httpd restart

chmod ugo+x ~
chmod ugo+rX -R ~/.rvm

Using Rails apps:
bash < <(curl -s https://raw.github.com/wayneeseguin/rvm/master/binscripts/rvm-installer) source "$HOME/.rvm/scripts/rvm" echo '[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"' >> ~/.bashrc
rvm install 1.9.2
rvm –default 1.9.2
gem install rails

rails new hello_world

Gems to the vendor/ directory:
bundle install –deployment
bundle install –path vendor/bundle

Pointing a site to Rails:
mv ~/public_html ~/public_html.bak
ln -s ~/hello_world/public ~/public_html
alternatively you can put Rails into a subdirectory (or subdomain, add-on domain, etc.):
ln -s ~/hello_world/public ~/public_html/hello-world

environments:
export RAILS_ENV=production
echo “export RAILS_ENV=production” >> ~/.bashrc
rake assets:precompile
touch tmp/restart.txt

author of that instructions is Dave James Miller

iptables: No chain/target/match by that name

modprobe nf_conntrack
modprobe xt_state

this will help you if: iptables -A INPUT -m state –state ESTABLISHED,RELATED -j ACCEPT says:

iptables: No chain/target/match by that name

I have found article http://serverfault.com/questions/608870/error-iptables-no-chain-target-match-by-that-name with no answer. So the answer is above.

if you will try load incorrectly module like this: “modprobe ipt_state” you will get error:

FATAL: Module ipt_state not found.