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 mysqlTags: apache, centos, linux, php, rails, ruby, ruby-on-rails, unix
July 22nd, 2007 at 4:41 pm
ey, nice ruby on the loose, keep it up and more linux blogging to you too!
if you have time, come visit my own linux blog, http://vertito.blogspot.com/
thanks!
September 20th, 2007 at 4:32 am
Megacool. With deprec and puppet out there such a shell scripts still rock =)
October 6th, 2007 at 12:45 pm
Great script, Keep’am coming !
loved the idea to reference to the online documents in the comments.
any idea if we’re gonna see a apache 2.2 rpm for centos 4.5 soon ?
October 6th, 2007 at 12:53 pm
@Neer: Never I fear
Apache 2.2 is CentOS 5 which is very incompatible with 4.5 because 4.5 has some newer (!) RPMs than 5 which is the reason upgrading from 4.5 to 5 is nearly impossible.
October 11th, 2007 at 8:47 am
To Build php I had to use:
./configure –with-apxs2=/usr/local/apache2/bin/apxs –with-mysqli=/usr/bin/mysql_config –with-openssl –with-zlib –with-bz2 –with-curl
Great script, thanks!
February 26th, 2008 at 4:11 pm
[…] The original post is here: http://wp.uberdose.com/2007/07/15/ruby-on-rails-on-centos-45/ […]
March 29th, 2008 at 5:46 pm
[…] VeRTiTO Says: July 22nd, 2007 at 4:41 pm ey, nice ruby on the loose, keep it up and more linux blogging to you […]
July 1st, 2008 at 7:56 am
excellent
March 18th, 2009 at 8:29 pm
i am new bie at linux. where i job the previous administrator told me that he compiled ruby at linux server and now its command line interface completely changed so i cant work on it.. so my ques is that is that ruby change totaly kernal of linux and newone like me who just know basics of linux like installation of normal services squid routing dns etc, are unable to work at ruby based linux or its just story. its very necesory for me because only that fear stop me to work at linux. even that person cant give me the password of linux.:(