Craig Kuhns

Tales of a "Computer Whisperer"

Gentoo, Passenger and Rails Setup

Generally this time of year I am scrambling frantically to finish my taxes. This year I decided to get that done early. That gave me time to knock out this post. Speaking of which, what is this post? Well every 4-5 months I get to set up another gentoo/passenger/rails server either for work or for myself. I got tired of looking all over for my documentation so I thought I would post it here. 

useradd -m -G users,wheel username
passwd username
emerge sudo
visudo - add your user underneath root
su username
sudo emerge syslog-ng
sudo emerge logrotate
sudo emerge cron
sudo rc-update add vixie-cron default
sudo /etc/init.d/vixie-cron start
sudo emerge sqlite
cd ~/
mkdir src
cd src
# latest version of rubygems - http://rubyforge.org/frs/?group_id=126
wget latest_version_of_rubygems.tgz
tar -xzvf latest_version_of_rubygems.tgz
cd latest_version_of_rubygems
ruby setup.rb
gem sources -a http://gems.github.com

At this point go ahead and install some gems. Rails, will_paginate, mongoid, you get the idea.

sudo gem install passenger
sudo passenger-install-nginx-module
sudo nano /etc/init.d/nginx

Paste in the contents of this gist

sudo chmod +x /etc/init.d/nginx
sudo /etc/init.d/nginx start # lets make sure it starts
sudo rc-update add nginx default
cd /var mkdir www # this is where all of your web apps live
sudo chown your_username www
sudo nano /opt/nginx/conf/nginx.conf

Paste in the contents this gist right above the first server block. Finally restart nginx so that it picks up your config changes

sudo /etc/init.d/nginx restart

And thats it. If this is any kind of production environment you will probably want to do some server hardening. I'll leave that as an exercise to the reader

Welcome

Thanks for dropping by. I need a place to document my experiences with technology and this is the best way I know how. If you stick around and read what I have to say here are some topics you are likely to hear about.

  • Gentoo Linux
  • MongoDB and Mongoid
  • Rails 3 and my upgrade experiences
  • Ruby and PDF's
  • Rubyproblems.com
  • Cool things I am doing while building a "yet to be announced product" for the "yet to be announced company" I am starting with a good friend.

Welp, I think thats about it for now. Keep checking back on this space if any of the above sounds in the least bit interesting.

Thanks for Hanging Out

Powered by gondaba.com's color shades