RoR on CentOS

So I'm having a meeting with a company about doing some work for them for automated server deployments. I thought rather than just talk about what i can do, I could just put together a demo.

Found this: centos5, rails3 ruby 1.9.2, by Alex, and went to town!

Instanciated a CentOS 5.5 image at rackspacecloud.com. ip:

Logged in, changed root passwd, then:

wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p0.tar.gz
tar xvzf ruby-1.9.2-p0.tar.gz

Then I did yum groupinstall 'Development Tools' like Alex said. Wow, that installs a lot of stuff. There's probably a better way. Don't want that on prod systems. And, that took a while.

Next: yum install readline-devel. That was fast.

Let's go back to our ruby directory

cd /root/ruby-1.9.2-p0

I like to show the full path of things. Ajust accordingly :)


Less than a minute, no errors. Most excellent.


This is taking its sweet time, so I'll go an made a dns entry for that now. Ok, dazzle.christophermahan.com now points to the ip.

I got disconnected from the server... I blame time warner and rackspacecloud.

Reconnected, looks like make completed, so going ahead with:

make install

Generating code for file enc/trans/big5.c... took a while.

Geez compiling python 2.6.5 on debian was much faster...

In the meantime I went to another server to write the fabric script that will do all that.

Ok, make install is done!

[root@dazzle ~]# ruby -v
ruby 1.9.2p0 (2010-08-18 revision 29036) [x86_64-linux]

Ruby is up!

Now, let's go play with gem.

[root@dazzle ~]# gem -v

Excellent! Ok, let's install rails. Per instructions at http://rubyonrails.org/download, let's do gem install rails.

[root@dazzle ~]# gem install rails
ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand

Oh, lovely! Not. Alex recommends yum install zlib zlib-devel so lets do that. And reinstall ruby. (I ain't got all night you know...) But on with the show:

cd /root/ruby 1.9.2p0
make install

Ok, all done.

gem install rails

Seems to be working.

[root@dazzle ~]# rails -v
Rails 3.0.3

In the meantime I altered the deployer.py python script to create an instance of CentOS on rackspacecloud with the passwrord changer.

So now I need to crashcourse myself to make a minimal rails3 app. And maybe install nginx to be able to serve stuff. Let me see...railsforzombies.org Yay!

On second thought, no.

Phusion Passenger? It works with nginx, so let's go get that!

wget http://nginx.org/download/nginx-0.8.53.tar.gz
tar xvzf nginx-0.8.53.tar.gz
cd nginx-0.8.53

Error: ./configure: error: the HTTP rewrite module requires the PCRE library.

This post says to yum -y install pcre-devel.

Another error:

checking for OpenSSL md5 crypto library ... not found

./configure: error: the HTTP cache module requires md5 functions
from OpenSSL library.  You can either disable the module by using
--without-http-cache option, or install the OpenSSL library into the system,
or build the OpenSSL library statically from the source with nginx by using
--with-http_ssl_module --with-openssl= options.

But wait the chinese guy mentioned it already

yum -y install pcre-devel openssl openssl-devel

and now with ./configure. That worked. make and make install. There is a warning, but it installs fine. See this thread.

Some info on how to run nginx.

Turns out to be harder... can't seem to start the server... plan B.

cd /usr/local
rm -rf nginx

From this set of instructions:

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-4.noarch.rpm

and then yum install nginx followed by /etc/init.d/nginx start, and wait, it's working internally (lynx), but not from outside. Odd.

Found out I need to edit iptables as shown in this post. Done.

Aaaand finally http://dazzle.christophermahan.com/ is working.

If I have time tomorrow before the meeting I'll get passport up, or write the fabric file that gets all this up.

It's Saturday. The meeting went well.

In the meantime, I'm enjoying some light reading with the iptables tutorial.