Installing Rails on Fedora

I'm building a virtual machine (VMWare flavor) for use with Rails development. After installing Fedora, there were a few things I had to do to get everything ready. I thought I'd take a minute and document them in one play for the next poor soul.

First, I don't know what I do wrong, but the GUI auto-update feature seems more trouble than it's worth. I like doing it manually. So the first thing to do is:

sudo /usr/bin/yum -y update

I've found that the Yum system can get corrupted and hang (I think I do this by force quitting the auto-update tool). Alternantely, you might see a bunch of errors. To fix that, I do the following:

sudo rm -f /var/lib/rpm/__db.*
sudo rpm --rebuilddb

Next, I install or update some other tools:

sudo /usr/bin/yum -y install \\
sudo \\
wget \\
tar \\
gzip \\
make \\
gcc \\
mysql \\
mysql-devel \\
mysql-server \\
ruby \\
ruby-libs \\
ruby-mode \\
ruby-rdoc \\
ruby-irb \\
ruby-ri \\
ruby-docs \\
ruby-devel \\
ruby-mysql \\
rubygems \\
subversion \\
lighttpd \\
lighttpd-fastcgi \\
httpd \\
ImageMagick \\ 

Now, we're ready to install rails and some other gems:

sudo gem install rails --include-dependencies
sudo gem install rmagick

If gem complains about "Could not find rails..." you need to reset the gem cache. The correct path can be found using the command gem env.

sudo rm -rf /usr/lib/ruby/gems/1.8/source_cache
sudo gem update

If you're going to use MySQL, be sure to set it to start up and set a root password:

sudo /sbin/chkconfig mysqld on

/usr/bin/mysqladmin -u root password 'new-password'
/usr/bin/mysqladmin -u root -h localhost.localdomain password 'new-password'

If you're going to use FastCGI with LightTPD, then you'll need to install the FastCGI code:

curl -O
tar xzvf fcgi-2.4.0.tar.gz
cd fcgi-2.4.0
./configure --prefix=/usr/local
sudo make install
cd ..

And the Ruby FastCGI support:

curl -O
tar xzvf ruby-fcgi-0.8.7.tar.gz
cd ruby-fcgi-0.8.7
ruby install.rb config --prefix=/usr/local
ruby install.rb setup
sudo ruby install.rb install
cd ..

And the fcgi gem:

sudo gem install fcgi

I also need RMagick (the Ruby ImageMagick package) installed. Notice that I installed ImageMagick in the yum command above. To install RMagick, I used the gem install:

sudo gem install rmagick

Note that the ImageMagick install I got from yum had been built with the configuration option for TrueType fonts, so it was looking for those and failing. You can see what fonts your installation is looking for using the convert command:

convert -list type

You'll see path information for the configuration files as well as the various fonts each type file is loading. I changed my type-windows.xml file to look like this:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE typemap [
  <!ELEMENT typemap (type+)>
  <!ELEMENT type (#PCDATA)>
  <!ELEMENT include (#PCDATA)>
  <!ATTLIST type fullname CDATA #IMPLIED>
  <!ATTLIST type family CDATA #IMPLIED>
  <!ATTLIST type foundry CDATA #IMPLIED>
  <!ATTLIST type weight CDATA #IMPLIED>
  <!ATTLIST type style CDATA #IMPLIED>
  <!ATTLIST type stretch CDATA #IMPLIED>
  <!ATTLIST type format CDATA #IMPLIED>
  <!ATTLIST type metrics CDATA #IMPLIED>
  <!ATTLIST type glyphs CDATA #REQUIRED>
  <!ATTLIST type version CDATA #IMPLIED>
  <!ATTLIST include file CDATA #REQUIRED>

This did the job, but beware that it may break other things you want to use ImageMagick for. I just know it worked for what I wanted to do.

Finally there are a few small jobs.

  • Add /usr/local/lib to /etc/ and run /sbin/ldconfig.
  • Add a alias for root to /etc/aliases. Don't forget to run newaliases.
  • Set up hostname. I like to edit /etc/sysconfig/network directly, but that's OS specific.
  • Set up any users. Be sure to set passwords.
  • Run chkconfig --list |more and turn off anything you don't need. I usually turn off bluetooth, cups, and yum-updatesd for starters. Turn on anything you do (like mysqld).
  • Set up /etc/sudoers. I can't tell you what to do since that's specific to what you are setting up. The simplest configuration is to use set it up so that anyone in group wheel can be a sudoer. Then add the wheel group to each user who should be able to sudo.

At this point, I'm unsure that the FastCGI is working completely with LightTPD. I'll add more information if something changes.

Please leave comments using the sidebar.

Last modified: Thu Oct 10 12:47:19 2019.