Installing Ruby, Rails and MySQL on Fedora Core 5
July 11, 2007
A) Installing Ruby
$ yum install ruby ruby-libs ruby-mode ruby-rdoc ruby-irb ruby-ri ruby-docs
B) Install Ruby Gems
Download rubygems-0.9.4.tgz from http://rubygems.org/ to /tmp folder
$ tar -xvfz /tmp/rubygems-0.9.4.tgz
$cd rubygems-0.9.4
$ ruby setup.rb
C) Install Rails
$ gem install rails
D) Install MySQL
Download From mysql-community server from http://dev.mysql.com/downloads/mysql/5.0.html
I downloaded mysql-5.0.41-linux-i686-icc-glibc23.tar.gz to /tmp folder
$ groupadd mysql
$ useradd -g mysql mysql
$ cd /usr/local
$ gunzip < /tmp/mysql-5.0.41-linux-i686-icc-glibc23.tar.gz | tar xvf -
$ ln -s mysql-5.0.41-linux-i686-icc-glibc23 mysql
$ cd mysql
$ chown -R mysql .
$ chgrp -R mysql .
$ scripts/mysql_install_db –user=mysql
$ chown -R root .
$ chown -R mysql data
(See http://dev.mysql.com/doc/refman/5.0/en/installing-binary.html instructions if you need detailed instructions)
Now to Automatically start server at boot
$ cp mysql.server /etc/init.d/mysql
$ chmod +x /etc/init.d/mysql
$ chkconfig –add mysql
(see http://dev.mysql.com/doc/refman/5.0/en/unix-post-installation.html for detailed instructions )
Finally remove anonymous user and set password for root user
$ mysql -u root
mysql> DELETE FROM mysql.user WHERE User = ”;
mysql> FLUSH PRIVILEGES;
mysql> UPDATE mysql.user SET Password = PASSWORD(’yournewpwd’) WHERE User = ‘root’;
mysql> FLUSH PRIVILEGES;
E) Installing mysql Gem
$ gem install mysql — –with-mysql-include=/usr/local/mysql/include –with-mysql-lib=/usr/local/mysql/lib
F) Create Rails Project and Makesure it works
$ rails testproject
Now add mysql password to config/database.yml file. And create respecive databases in mysql. I am assuming you, you didnt change database names in database.yml file so database names are testproject_development, testproject_test, testproject_production
$ mysql -u root -p
Enter your password
mysql > CREATE DATABASE testproject_development;
mysql > CREATE DATABASE testproject_test;
mysql > CREATE DATABASE testproject_production;
Now run cd to your project and see if this thing works
$ cd testproject
$ rake db:migrate
If you dont see errors, mean rails can see your databases.
Go ahead and develop Rails applications….
January 24, 2008 at 4:48 pm
In the Step D)Install MySQL
I had to change the command line from scripts/mysql_install_db –user=mysql to scripts/mysql_install_db –u mysql