How to install Ruby, Rails, mySQL and Apache from (almost) the scratch
I've been installing everything that is needed to run Ruby on Rails application onto a host (which is CentOS 4.x), which didn't even have Ruby installed, mySQL was too old and Apache didn't have required modules for running Mongrel clusters. So I had to install everything from the scratch, and the whole process was documented so I could repeat it in the future :) But may be this will helpful to someone else too, so here it is, right from my Yojimbo's note :)
Just one thing to notice. CentOS already has some of the required libs installed (zlib, libpng, libjpeg and freetype), so if you don't have them installed, do it before proceeding. I think there are plenty of info on this matter so I'll omit it.
Now, to the business.
RUBY
wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.5.tar.gz
tar zxvf ruby-1.8.5.tar.gz
cd ruby-1.8.5
./configure
make
sudo make install
Warning! If you're on Mac, you have to use the following string to configure Ruby install:
./configure –prefix=/usr/local –enable-pthread
On Mac OS X, once you have installed Ruby, you have to fix default paths for your default shell, because Ruby installs itself to /usr/local/bin by default, and Apple's default binaries location is in /usr/bin. Do this in Terminal:
pico ~/.bash_login
# and paste the following text:
export PATH="/usr/local/bin:/usr/local/sbin:$PATH"
# save the file (Control-W) and relogin, or just re-open terminal session before proceeding.
RAILS : GEMS
wget http://rubyforge.rubyuser.de/rubygems/rubygems-0.9.2.tgz
tar zxvf rubygems-0.9.2.tgz
cd rubygems-0.9.2
ruby setup.rb
RAILS: CORE (possible to use –include-dependencies, but i was getting some 'not found' error with this option)
#install the specific version, which happens to be 1.2.2 in this case.
gem install -v=1.2.2 rails
RAILS: STANDARD STUFF (possible to use –include-dependencies)
gem install capistrano
gem install mongrel
gem install mongrel_cluster
gem install gettext
gem install unicode
APACHE 2 with load balancer (for Mongrel cluster)
wget http://ftp.kddilabs.jp/infosystems/apache/httpd/httpd-2.2.4.tar.gz
tar zxvf httpd-2.2.4.tar.gz
cd httpd-2.2.4
./configure –enable-rewrite –enable-proxy –enable-load-balancer –enable-mods-shared=ALL
make
sudo make install
GHOSTSCRIPT & FONTS
# we need to install/update ghostscript and install ghostscript-fonts in order to get rid of the "`get_type_metrics': unable to read font `(null)' (Magick::ImageMagickError)" error:
wget http://jaist.dl.sourceforge.net/sourceforge/ghostscript/ghostscript-8.56.tar.gz
tar zxvf ghostscript-8.56.tar.gz
cd ghostscript-8.56
./configure
make
sudo make installwget http://jaist.dl.sourceforge.net/sourceforge/gs-fonts/ghostscript-fonts-std-8.11.tar.gz
tar zxvf ghostscript-fonts-std-8.11.tar.gz
mv fonts /usr/local/share/ghostscript/8.56/
IMAGEMAGICK (required by RMagick)
wget ftp://ftp.u-aizu.ac.jp/pub/graphics/image/ImageMagick/imagemagick.org/ImageMagick-6.3.3-10.tar.gz
cd ImageMagick-6.3.3
./configure
make
sudo make install
RAILS: RMAGICK (manual install - I have always had multi-systems compatibility problems with the gem install)
wget http://files.rubyforge.mmmultiworks.com/rmagick/RMagick-1.15.4.tar.gz
tar zxvf RMagick-1.15.4.tar.gz
cd RMagick-1.15.4
./configure
make
sudo make install
MYSQL
wget http://ftp.iij.ad.jp/pub/db/mysql/Downloads/MySQL-5.0/mysql-5.0.37.tar.gz
tar zxvf mysql-5.0.37.tar.gz
cd mysql-5.0.37
./configure –with-extra-charsets=all –prefix=/usr/local/mysql
make
sudo make install#in /etc/my.cnf
[mysqld]
set-variable = max_allowed_packet=32M # I upload large images into DBs, therefore need a bigger allowed packet size
(also need to change encodings to utf8)
default-character-set=utf8
SUBVERSION (required to capistrano deployment to work)
wget http://subversion.tigris.org/downloads/subversion-1.4.3.tar.gz
wget http://subversion.tigris.org/downloads/subversion-deps-1.4.3.tar.gz
tar zxvf subversion-1.4.3.tar.gz
tar zxvf subversion-deps-1.4.3.tar.gz
cd subversion-1.4.3
./configure
make
sudo make install
That all folks :) Hope this was helpful.
April 27th, 2007 at 5:40 pm
there's Capitrano.. but it's worthless without this blog. Thank you very much.
April 27th, 2007 at 7:21 pm
Slight note, for me, i had to move the ghostscript fonts to /usr/local/share/ghostscript/fonts directory instead of /usr/local/share/ghostscript/8.56/ for rmagick to install.
And just a reminder for the newbs, if you're copying and pasting these in in some kind of GUI, sometimes it may not work. Type them in manually into your putty.
January 30th, 2008 at 7:07 am
[...] http://wiki.rubyonrails.org/rails/pages/Ruby+and+Rails+on+Red+Hat+Enterprise+Linux http://www.redhat.com/magazine/025nov06/features/ruby/ http://macdiggs.com/index.php/2007/04/03/how-to-install-ruby-rails-mysql-and-apache-from-almost-a-s... [...]