Ruby On Rails on CentOS 4.5

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

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/bashmkdir installcd installsudo yum -y remove httpdwget http://apache.imsam.info/httpd/httpd-2.2.4.tar.gzwget http://www.apache.org/dist/httpd/KEYSwget http://www.apache.org/dist/httpd/httpd-2.2.4.tar.gz.ascgpg --import KEYSgpg --verify httpd-2.2.4.tar.gz.ascread -p "verify apache key ..."tar xfz  httpd-2.2.4.tar.gzcd httpd-2.2.4./configure --enable-mods-shared=most --enable-ssl=shared --with-included-apr --enable-proxy=sharedmakesudo make installsudo /usr/local/apache2/bin/apachectl start# check working apache by connecting to :80read -p "apache working on :80?"# svn# http://downloads.open.collab.net/readmes/readme_Redhat_Server.txtcd ..wget http://www.open.collab.net/servlets/OCNDownload?id=CSVNRHELCwget http://www.open.collab.net/servlets/OCNDownload?id=CSVNRHELSsudo rpm -i CollabNetSubversion-client-1.4.4-1.i386.rpmsudo rpm -i CollabNetSubversion-server-1.4.4-1.i386.rpm# integrate /opt/CollabNet_Subversion/bin in PATH# add MAN etcread -p "add subversion to PATH/MAN http://downloads.open.collab.net/readmes/readme_Redhat_Server.txt"# configure svn serverexport PATH=/opt/CollabNet_Subversion/bin:$PATHsudo Configure-CollabNet-Subversion# setup won't handle our local httpd, so setup by handsudo cp /opt/CollabNet_Subversion/modules/mod_dav_svn.so /usr/local/apache2/modules/# see http://svnbook.red-bean.com/nightly/en/svn.serverconfig.httpd.htmlread -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.htmlread -p "generate ssl certificate http://www.akadia.com/services/ssh_test_certificate.html"openssl genrsa -des3 -out server.key 1024# as cn, use *.yourdomain.comopenssl req -new -key server.key -out server.csropenssl x509 -req -days 365 -in server.csr -signkey server.key -out server.crtsudo cp  server.crt /usr/local/apache2/confsudo cp  server.key /usr/local/apache2/conf# you probably don't have to change anything ...#sudo vi /usr/local/apache2/conf/extra/httpd-ssl.confread -p "you might want to restart httpd and check whether ssl works"# rubywget ftp://ftp.gnu.org/gnu/readline/readline-5.1.tar.gztar xfz readline-5.1.tar.gzcd readline-5.1./configure --prefix=/usr/localmakesudo make installcd ..wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.6.tar.gztar xfz ruby-1.8.6.tar.gzcd ruby-1.8.6./configure --prefix=/usr/local --enable-pthread --with-readline-dir=/usr/local --enable-sharedmakesudo make installcd ..wget http://rubyforge.org/frs/download.php/20989/rubygems-0.9.4.tgztar xfz rubygems-0.9.4.tgzcd rubygems-0.9.4sudo /usr/local/bin/ruby setup.rbcd ..sudo gem install rails --include-dependenciessudo gem install termios --include-dependenciessudo gem install mongrel --include-dependenciessudo gem install mongrel_cluster --include-dependenciessudo gem install capistrano --include-dependenciessudo gem install mysql -- --with-mysql-dir=/usr/# php# http://www.php.net/manual/en/install.unix.apache2.phpsudo yum -y install libxml2-develsudo yum -y install bzip2-develsudo yum -y install curl-develsudo yum -y install gcc-c++wget http://de.php.net/get/php-5.2.3.tar.gz/from/us.php.net/mirrortar xfz php-5.2.3.tar.gzcd php-5.2.3./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-mysql --with-openssl --with-zlib --with-bz2 --with-curlmakesudo make installsudo cp php.ini-dist /usr/local/lib/php.iniread -p "include php in httpd.conf http://www.php.net/manual/en/install.unix.apache2.php"sudo vi /usr/local/apache2/conf/httpd.confcd ..# capistrano will fail unless you symlink svn:sudo ln -s /opt/CollabNet_Subversion/bin/svn /usr/binread -p "enable centosplus repository so we can update to mysql 5"sudo vi /etc/yum.repos.d/CentOS-Base.reposudo yum update mysql
Tags: , , , , , , ,

9 Responses to “Ruby On Rails on CentOS 4.5”


uberdose 2.0

L-l-look at you, hacker.