Ruby On Rails on CentOS 4.5

Saturday, March 29, 2008 16:45
Posted in category Ruby
Ruby On Rails on CentOS 4.5 pr0
Post Page Rank

Since you can’t easily upgrade to CentOS 5 from 4.5 with yum you have to compile it all yourself.

Apache 2.2.4
PHP 5.2.3
Ruby 1.8.6
The following script downloads and compiles a complete stack of the newest apps for a ruby on rails installation, even including PHP. Complete with SSL and the newest Subversion.

#!/bin/bash
mkdir install
cd install
sudo yum -y remove httpd

wget http://apache.imsam.info/httpd/httpd-2.2.4.tar.gz
wget http://www.apache.org/dist/httpd/KEYS
wget http://www.apache.org/dist/httpd/httpd-2.2.4.tar.gz.asc
gpg –import KEYS
gpg –verify httpd-2.2.4.tar.gz.asc
read -p “verify apache key …”
tar xfz  httpd-2.2.4.tar.gz
cd httpd-2.2.4
./configure –enable-mods-shared=most –enable-ssl=shared –with-included-apr –enable-proxy=shared
make

sudo make install
sudo /usr/local/apache2/bin/apachectl start
# check working apache by connecting to :80
read -p “apache working on :80?”

# svn
# http://downloads.open.collab.net/readmes/readme_Redhat_Server.txt
cd ..
wget http://www.open.collab.net/servlets/OCNDownload?id=CSVNRHELC
wget http://www.open.collab.net/servlets/OCNDownload?id=CSVNRHELS
sudo rpm -i CollabNetSubversion-client-1.4.4-1.i386.rpm
sudo rpm -i CollabNetSubversion-server-1.4.4-1.i386.rpm

# integrate /opt/CollabNet_Subversion/bin in PATH
# add MAN etc
read -p “add subversion to PATH/MAN http://downloads.open.collab.net/readmes/readme_Redhat_Server.txt

# configure svn server
export PATH=/opt/CollabNet_Subversion/bin:$PATH
sudo Configure-CollabNet-Subversion

# setup won’t handle our local httpd, so setup by hand
sudo cp /opt/CollabNet_Subversion/modules/mod_dav_svn.so /usr/local/apache2/modules/

# see http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html
read -p “edit httpd.conf(s) http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.html
#sudo vi /usr/local/apache2/conf/httpd.conf

# bring down svnserve?
sudo /opt/CollabNet_Subversion/bin/httpd -k stop

# ssl http://www.akadia.com/services/ssh_test_certificate.html
read -p “generate ssl certificate http://www.akadia.com/services/ssh_test_certificate.html
openssl genrsa -des3 -out server.key 1024

# as cn, use *.yourdomain.com
openssl req -new -key server.key -out server.csr
openssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crt
sudo cp  server.crt /usr/local/apache2/conf
sudo cp  server.key /usr/local/apache2/conf

# you probably don’t have to change anything …
#sudo vi /usr/local/apache2/conf/extra/httpd-ssl.conf

read -p “you might want to restart httpd and check whether ssl works”

# ruby
wget ftp://ftp.gnu.org/gnu/readline/readline-5.1.tar.gz
tar xfz readline-5.1.tar.gz
cd readline-5.1
./configure –prefix=/usr/local
make
sudo make install
cd ..
wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.6.tar.gz
tar xfz ruby-1.8.6.tar.gz
cd ruby-1.8.6
./configure –prefix=/usr/local –enable-pthread –with-readline-dir=/usr/local –enable-shared
make
sudo make install
cd ..
wget http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgz
tar xfz rubygems-0.9.4.tgz
cd rubygems-0.9.4
sudo /usr/local/bin/ruby setup.rb
cd ..
sudo gem install rails –include-dependencies
sudo gem install termios –include-dependencies
sudo gem install mongrel –include-dependencies
sudo gem install mongrel_cluster –include-dependencies
sudo gem install capistrano –include-dependencies
sudo gem install mysql — –with-mysql-dir=/usr/

# php
# http://www.php.net/manual/en/install.unix.apache2.php
sudo yum -y install libxml2-devel
sudo yum -y install bzip2-devel
sudo yum -y install curl-devel
sudo yum -y install gcc-c++
wget http://de.php.net/get/php-5.2.3.tar.gz/from/us.php.net/mirror
tar xfz php-5.2.3.tar.gz
cd php-5.2.3
./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysql –with-openssl –with-zlib –with-bz2 –with-curl
make
sudo make install
sudo cp php.ini-dist /usr/local/lib/php.ini
read -p “include php in httpd.conf http://www.php.net/manual/en/install.unix.apache2.php
sudo vi /usr/local/apache2/conf/httpd.conf
cd ..

# capistrano will fail unless you symlink svn:
sudo ln -s /opt/CollabNet_Subversion/bin/svn /usr/bin

read -p “enable centosplus repository so we can update to mysql 5″
sudo vi /etc/yum.repos.d/CentOS-Base.repo
sudo yum update mysql

You can leave a response, or trackback from your own site.

Leave a Reply

You must be logged in to post a comment.