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/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 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.:(