最近安装 Redmine 需要安装 Rails 下, 在CentOS Linux 5.3下 Rails 的安装过程记录如下。 注: MySQL, Rmagick等是为了进一步安装Redmine安装的。
准备工作
# yum install httpd \
httpd-devel \
openssl-devel \
zlib-devel \
mysql-server \
mysql-devel \
gcc \
gcc-c++ \
curl-devel
Ruby, RubyGems
Ruby
# cd ~/source/
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p174.tar.gz -C ~/source/
# tar xvzf ~/source/ruby-1.8.7-p174.tar.gz -C ../build/
# cd ../build/ruby-1.8.7-p174
# ./configure && make && make install
# ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux]
RubyGems
# wget http://rubyforge.org/frs/download.php/73882/rubygems-1.4.2.tgz -C ~/source/
# tar xvzf ~/source/rubygems-1.4.2.tgz -C ../build/
# cd ../rubygems-1.5.2
# ruby setup.rb
# gem -v
1.4.2
Rails, Passenger(mod_rails), Rmagick, MySQL gem
Rails 2.3.11
# gem install rails -v=2.3.11
Passenger
# gem install passenger
passenger-install-apache2-module
安装完成后按照提示将下面的内容添加到httpd.conf
LoadModule passenger_module /usr/ <strong><font color="#006699">local</font></strong> /lib/ruby/gems/1.8/gems/passenger-3.0.4/ext/apache2/mod_passenger.so |
PassengerRoot /usr/ <strong><font color="#006699">local</font></strong> /lib/ruby/gems/1.8/gems/passenger-3.0.4 |
PassengerRuby /usr/ <strong><font color="#006699">local</font></strong> /bin/ruby |
MySQL gem
安装过程会产生很多“No definition for ”的打印,不需要管它。
Rmagick 1.15.17
在安装rmagick之前需要先安装ImageMagick-devel和TrueType字体
# gem install libjpeg libtiff libpng libwmf ghostscript ImageMagick-devel
# yum install rpm-build cabextract
# wget http://corefonts.sourceforge.net/msttcorefonts-2.0-1.spec -P ~/source/
# vim ~/source/msttcorefonts-2.0-1.spec
将 msttcorefonts-2.0-1.spec 第9行
%define fontdir /usr/share/fonts/%{name}
修改为
%define fontdir /usr/share/fonts/default/TrueType
安装字体
# rpmbuild -bb msttcorefonts-2.0-1.spec
# rpm -ivh /usr/src/RedHat/RPMS/noarch/msttcorefonts-2.0-1.noarch.rpm
测试一下
# convert label:abc abc.gif
# ll abc.gif
-rw-r--r-- 1 root root 555 Mar 3 21:04 abc.gif
最后安装Rmagick 1.15.17
# gem install rmagick -v 1.15.17