Monday, March 21, 2011

Ruby on Rails Installation on Linux flavours

To install ruby on rails on fedora/ubuntu use the following commands on root.(for fresh installation)

You can copy & paste the commands(#) in your terminal & it will work



# wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p0.tar.gz
# tar -xvvf ruby-1.9.2-p0.tar.gz
# cd ruby-*
# ./configure make install sudo make install



If you have any previously installed ruby & rails then
remove all ruby-1.9.2 like files from your root by using
# rm-R ruby-1.9.2

also remove rails from root by using
# gem uninstall rails

then use

# wget ftp://ftp.ruby-lang.org//pub/ruby/1.9/ruby-1.9.2-p0.tar.gz
# tar -xvvf ruby-1.9.2-p0.tar.gz
# cd ruby-*
# ./configure make install sudo make install


After finishing all the installation you can install sqlite3 as a database by using following command

# gem install sqlite3


If you are willing to install mysql then use the following commands

For Ubuntu

It will check whetehr your packages are uptodate or not If not it will make it update
# sudo apt-get update
# sudo apt-get dist-upgrade

Now you are ready to install Mysql server & client, use the following command

# sudo apt-get install mysql-server mysql-client

When done, you have a MySQL database ready to rock ‘n roll. However, there’s more to do.

You need to set a root password, for starters. MySQL has it’s own user accounts, which are not related to the user accounts on your Linux machine. By default, the root account of the MySQL Server is empty. You need to set it. Please replace ‘mypassword’ with your actual password and myhostname with your actual hostname.

# sudo mysqladmin -u root -h localhost password 'mypassword'
# sudo mysqladmin -u root -h myhostname password 'mypassword'

You need some library files for ruby so use the following command to install ruby libfiles for mysql

# sudo apt-get install libmysql-ruby

You can now access your MySQL server by using following command:

# mysql -u root -p


For Fedora

1. Use yum to install both mysql command line tool and the server:yum -y install mysql mysql-server
2. Enable the MySQL service:/sbin/chkconfig mysqld on
3. Start the MySQL server:/sbin/service mysqld start
4. Set the MySQL root password:mysqladmin -u root password 'new-password'The quotes around the new password are required.