Tuesday , July 16 2024

How to: Install Ruby 1.9.3 + RubyGems 1.8.7 + Rails 3.2.1 with libyaml on CentOS 5

If you are looking to install Ruby 1.9.3+ on a Linux system this will guide you through compiling the software. There is always the option to use yum to install ruby packages but the versions in repositories will be older, not the latest stable. This guide is using a Centos 5.x base system without any packages installed and all commands run as root.

1. First the system will need the appropriate packages to compile and install the source code for ruby. To do this run the following command.

# yum install make openssl-devel zlib-devel gcc gcc-c++ autoconf readline-devel curl-devel expat-devel gettext-devel ncurses-devel ruby-devel libxml2 libxml2-devel libxslt libxslt-devel mysql-devel httpd-devel -y

2. Now that a compiler package is installed move on to download, compile and install the libyaml library.

# cd ~
# wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
# tar xzvf yaml-0.1.4.tar.gz
# cd yaml-0.1.4
# ./configure --prefix=/usr/local
# make
# make install

3. The next step is to download, compile and install Ruby 1.9.3

# cd ~
# wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.gz
# tar xzvf ruby-1.9.3-p194.tar.gz
# cd ruby-1.9.3-p194
# ./configure --prefix=/usr/local --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
# make
# make install

4. Upon completion of steps 1 through 3 ruby is accessible via command line. Test ruby by running the following command.

# ruby -v
ruby 1.9.3p194 (2012-04-20 revision 35410) [i686-linux]

5. Install rubygems 1.8.7

# cd ~
# wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.7.tgz
# tar xvfz rubygems-1.8.7.tgz
# cd rubygems-1.8.7
# ruby setup.rb

Display complete:

RubyGems 1.8.7 installed

== 1.8.7 / 2011-08-02

* 5 bug fixes:
* Added missing require for <code>gem uninstall --format-executable</code>
* The correct name of the executable being uninstalled is now displayed with
* Fixed <code>gem unpack uninstalled_gem</code> default version picker
* RubyGems no longer claims a nonexistent gem can be uninstalled
* <code>gem which</code> no longer claims directories are requirable files
* <code>gem cleanup</code> continues cleaning up gems if one can't be uninstalled due
to permissions.  Issue #82
* Gem repository directories are no longer created world-writable.  Patch by
Sakuro OZAWA.  Ruby Bug #4930


RubyGems installed the following executables:

The “gem” executable is now usable and can be used to install other ruby packages on centos.

You can update gem to new version:

# gem update


# gem update --system

to update to default path in system.

You can check version of gem:

# gem -v

6. Install Rails 3.2.1

# gem install rails --version 3.2.1

Check rails version:

# rails -v

Display rals version:

Rails 3.2.1

The guide will help get Ruby on Rails working on a CentOS system, later I will cover what you can do with Ruby on Rails.

About Ngo Thang IT

Check Also

generate ssh key and login

Hướng dẫn tạo SSH Key trên CentOS 7 và cách đăng nhập

Xin chào, bài viết này Thắng sẽ hướng dẫn mọi người biết cách tạo SSH …

79 Bình luận

    • That’s the great thing about the open source cnmoumity, nothing is too much! It’s up to all of us to keep contributing in any way we can in blog posts, code snippets, answering questions but most of all creating great things from these awesome tools!Thanks for the comment!

    • This is what we need – an ingsiht to make everyone think

      • cupcake8million Posted on congrats- your lvinig my dream since you won’t see your family/ friends for a long tie you could go cheesy- wish you were here or on the trail again or Where in the world is (your name)? Best of luck!

    • Yeah I love how he tells it like it is. So many people offer services for free then wonder how to make money.Your right, especially with online business there are so many price models. Free trial vs. freemium, monthly vs 1-time, etc. Also picking the price is tricky as being both to low or to high can hurt you.

      • After a week of climbing seeravl learning curves with regards to MySQL, Ruby, Rails, CSS, AJAX and such I’m finally making headway in my latest project with everything in a sort of hazy funk feeling my way around clumzily. Then I found your cheatsheet, and suddenly everything is clearing up! It’s been a long time since I’ve seen such a dense offering of knowledge. Just wanted to drop a thanks for your effort. It’s the tear-out handy reference that I didn’t know The Agile Rails book was missing.

      • I have to point out to most RUBY fanatics that even ruyranboils.com, 37signals.com, bascamp.com and backpack.com all run PHP on their frontpage just to be able to handle the bandwidth!! This has been KNOWN for a long time and the RUBY guys still don\’t move off PHP. Of course excuses are made and no one believes it, but it is a huge issue. It is a known fact that RUBY does not scale and 43things required 4 times the number of machines to get the job done and their migration was a nightmare.

    • Your posting lays bare the truth

    • Hi Patrick,First of all thanks for pnuittg down an article for Kaltura which is rare. But am facing a difficulty which you might be able to understand and help me out.I took the trial version of Kaltura KMC and tried using the gem Kaltura to integrate a video from KMC into my rails app by using this in my view:[544,360] %>but am not getting the video to be rendered at my app, am just getting a string-containing div and some JavaScript code containing variables for the video.Have defined the credentials in yml file for kaltura as per your github site kaltura_fu.

    • Thanks, Suriname is great and the kids are loving it! BTW, going for Ruby when I did was pbblaroy the best career move I could wish for.. the $$$ is great and it’s oh soo much more fun than PHP/Java I am picking up some Java again though because of Android. I personally think it will be huge so I definitely want a piece of the action..

    • This is a neat service, is it possible to grab the images from your site using an API of sorts or would I have to use your service, save the image, and then upload it to my site?

    • I’ve found the solution to this issue I’m using Rails 3 and my class looks like this (and the praloembtic methods was this too)class Organization [‘is_company = ? ‘,true] select_choice = I18n.t(“select”) + ” “+ I18n.t(“segments.description”) @organization_parents = [select_choice] for organization in @organizations @organization_parents < [‘is_company = ? ‘,true]So I had to change it to something like this@organizations = Organization.where(“is_company = ?”,true)But it was wrong too.. So I decided to add an scope for this below the class name so the final code looks like this:class Organization < ActiveRecord::Base scope :company, where("is_company = ?",true) def self.parents @organizations = self.company select_choice = I18n.t("select") + " "+ I18n.t("segments.description") @organization_parents = [select_choice] for organization in @organizations @organization_parents << [organization.name, organization.id] end return @organization_parents end #…endSo using this line with the scope@organizations = self.companyit worked flawlessly in every part of the code.I was wondering if the named_scope is deprecated when using class methods or they are not supported from now and throws an error and not a warning beforeThanks for your helpLeo

      • Blaine just started eonlxripg RoR roughly 3 weeks today and its marvelous features and power have captured my attention im hoping sometime after a month i would start to develop a real RoR web app and your cheatsheet shimmers like a ruby gem when i found it ive been using flash’s actionscript (also an OO lang) , some mysql and PHP codes and when i found RoR, it magically transformed my coding style since its very easy to learn thanks! and more power!from the pearl of the orient ~ philippinesand the city of love ~ iloilo city::nonoy::javellana::

      • Have looked on sapmle fusion and they have stop downloads or something like that. It’s really annoying because i understand that the fpc kits are good but i just think my work would sound better with a better kit.

      • you can call me e Posted on The Simple TruthTruth SerumTruth or ConsequencesHonesty or BustIt actually sunods like an interesting blog. I wouldn’t mind checking it out when it is up and running!

    • This error generally hppneas when you accidentally recursively changing an attribute. If you have a username attribute in User model, and a virtual attribute named username, that is directly changing the username, you end up calling the virtual, the virtual calls the virtual again and so on.. Therefore, take a look on whether something like that hppneas somewhere in your code.

    • How exactly do you fix this prleobm when you get this message: Your configuration file contains settings (root with no password) that correspond to the default MySQL privileged account. Your MySQL server is running with this default, is open to intrusion, and you really should fix this security hole by setting a password for user root’.?

      • Actually, this kit was almost a raondm selection kind of sub par IMO. I can’t remember what samples I selected though. You can easily come up with a better kit with the samples from sample fusion. That is where all these samples came from.

    • i have down load xampp many times but it did not work. i means apache is not runnnig. status check failure -2 error is shown. how can i slove this kind of problem just mail me at . i have remove the skype also but agian is not work.

      • lients. The system was wtterin using Ruby on Rails and has touches of Ajax for asthetic reasons. The system includes various folksonomies elements including the ability ta

      • I really hope ruby and sarppihe remakes will be made! The merchandise is so cute and charming!! I wish I lived in Japan (those Wailord and Gulpin plushies look awesome)

  1. Please teach the rest of these internet hooligans how to write and rseeacrh!

  2. Cool server!In 1st spmlae, It works with only drb’ because the betabrite is in the server side. require drb’obj = DRbObject.new_with_uri( druby://eviladmins.org:9000 )File.open( out.jpg , wb ) { |a| a.write obj.write_simple( http://www.druby.org )}

  3. thank you, this is an awesome thing to share! many would cseolly guard such a thing as an advantageous personal tool, but as it is becoming more clear everyday, openness and sharing can go even furthersecondly, i’d like to ask a question but i don’t intend at ALL to be negative with some of its possible implications:why is this a pdf? don’t RoR and all the web 2.0 concepts, essentially lead to the conclusion that your cheatsheet should be a shared, group editable document, available anywhere at it’s newest possible state?it just seems weird that a tool which enables the creation of collaborative web apps, and collaborative documents would have a subtool (your cheatsheet) that does not take advantage of the very technology that it is helping to enable.perhaps not!looking forward to hear back,trevor

    • ce provider souiprtpng multiple clients. The system was written using Ruby on Rails and has touches of Ajax for asthetic reasons. The system includes various folksonomies

    • Posted on incredible, that was a very good read. In conoiuslcn, someone who actually thinks and understands what they are blogging about. Quite difficult to find of late, especially on the web . I bookmarked your web blog and will make sure to keep coming back here if this is how you always write. thank you, keep it up! .

  4. Unparalleled accuracy, unequivocal clarity, and uneditable importance!

    • Thanks so much Blaine! I was looking for sotnmhieg exactly like this. I like to have an overview when I’m learning a new language and until now I’ve not found anything like this for RoR. Thank you so much for the time and effort you have put into this and for sharing your cheatsheet.

    • Posted on I’d must test with you here, which isn’t something I uslulay do! I get pleasure from reading a post that will make folks think. Thanks for permitting me to remark!

  5. Now I’m like, well duh! Truly thankful for your help.

    • Good post I’ve encountered the exact same pmeblors you’re having. The “add more servers” answer is really stupid, too, given the number and cost of servers involved. I’ve worked on a large on-line payment platform written in Java which used exactly ONE server to cater to over 60 countries, but a hosting company I’ve worked for requires 9 servers running RoR to handle Canada and the USA.As for the question of tools there will really never be an instance where an IDE can really help you. Part of the problem is that so many libraries, tools and framework rely on “method_missing” to handle functionality. It would be challenging if not down-right impossible for an IDE to fathom what would be an acceptable “method” name under these circumstances (as a point of reference, ActiveRecord makes heavy use of “method_missing”)

  6. Release management is one of the thigns I hate most about maintaining a library. Surely there’s a way to make this less painful? I know there are libs for pushing the code to RubyForge, but that’s the easiest of a tedious process: there’s testing your gem to make sure you didn’t do something stupid in the build process, and there are the release notes to write, and announcements to draft for blog and mailing list(s) This process alone is easily more than half of what keeps me from releasing updates to code, sadly. Does anyone have any solutions for this?

  7. I will be putting this dazzling insight to good use in no time.

    • Nice cheatsheet.May I make a sesougtign? In the Control Structures section, make clear that Ruby’s control structures are actually expressions: they not only control the flow of execution but also evaluate to values, which can be used in other expressions. For example, (1 + if true; 10 else 20 end) evaluates to 11. Most common programming languages do not have this useful property, so many Ruby switchers are likely to overlook it unless somebody points it out.Cheers,Tom

    • I’d be reluctant to group uolmnpiced or interpreted languages all in one bucket and suggest they don’t scale. Perhaps you aren’t saying that, but it was the impression I got. We have a large (10s of thousands of objects, dozens of servers, 10s of thousands of users) system in use at Purdue University, where I work, and it’s done in Smalltalk. It scales very well, both in the traditional sense and in the sense of complexity. I am under the impression Ruby is pure OO, like Smalltalk, so perhaps it’s an architecture thing rather than a language thing.

    • blogged abouta0my experiences with rails and in pacturilar my conclusion that at the timea0Rails was not ready for large, complex projects, partly because of a lack of good tools, libraries and sensible error messages, all of which can be

  8. Clear, informative, simple. Could I send you some e-hugs?

  9. hehe.. yeah.. I feel your pain So Rails is getting bettin by the eat-your-dog-food thing.. Rails framework code uses Ruby (I suppose?) and whatever you write in Ruby for your Rails app can clash with the framework code itself? Am I making sense? Maybe this is my ignorance talking. I haven’t started working in this arena that much.Anyways, nice to know you are enjoying the new environment. I do keep checking your blog from time to time

  10. If only there were more clever people like you!

  11. Hey Matthijs,Thanks for the input, let us know what you think after using the tool a bit, feedback is alayws helpful. You note some good points here. I think what we are going to do down the road is write a more real world example than the simple one we already posted (which was just meant as a very basic introduction) and that example would include some code similar to what you have above.Gabe

  12. I’m so very new to programming and am aemtitddly over my head. How do I login to SSH. I’ve had to access a server using winSCP and Secure CRT before, but that was a company I work for. I had to be guided through that! If you could just point me in the right direction I’ll take it from there. Thanks!!!

  13. Well I actually can’t really recall what I did to K2 to make it fluid. I know I run a SVN version with a patch but I’d have to dive back in to figure out how/why/what maybe next year

  14. Glad you’re feeling better today. I didn’t not like reading those tweets last night. Yeah, waiting on one more document and then I can submit everything for the new visas. Hopefully things will go as smooth!Feel better my friend!

  15. My problem was a wall until I read this, then I smashed it.

  16. As you are not showing all the code, I can only saeuclpte that you have defined inspect or to_s to build a string containing, among other things the parents.Your current parents method doesn’t seem to be doing anything reasonable, as it returns all organisations that are companies, no matter which association you start from. Thus, any company has itself as parent. Attempting to convert it to string will induce an infinite loop to try to show the parents’ of the parents’ of In any case, the bulk of your parents method should be in a helper, called something like options_for_parents_select, because that’s what it seems to be doing? Even then, the first empty choice should be passed as allow_null to select.The fact that it sets instance variables is a code smell.Good luck

  17. Not really. While Rails is a frwmaeork and PHP a language, PHP’s frwmaeorks are a lot more bloated than Rails, especially Zend and Cake. Rails leaves a lot of that to plugins and gems, which makes it very lean. I do think Rails should be compared to PHP as I reckon most ppl who write PHP don’t use frwmaeorks, and perhaps rightfully so, because PHP isn’t geared towards complex application design. It’s probably the most simple language for creating a hello world .

  18. why not comparing RoR asinagt a PHP framework like Yii which does all the CRUD stuff, DB abstraction etc.?Comparing RoR vs plain PHP is like comparing a SQL db asinagt plain text data stores.I really like RoR, don’t get it wrong. But why do the ruby people always compare the framework, without their language would not be as good as it is, asinagt plain languages??

  19. LOL, SQL is so difficult. Thank god you avoid it in RoR. Thank god it’s all hedidn and in some monolithic framework that basically decides for you what you want to do. I can see why people that like RoR hate C/C++. You actually have to be smart and understand the details to write in C/C++. Who needs that? Just crank out a pre-fab website with RoR. Isn’t that how garbage collection became such a problem??

  20. You CAN compare Rails with PHP. They are both tools (to use a baorder term) to develop web applications. What the commercial is saying is that developing with Rails can save you a lot of headaches PHP would cause. There is nothing wrong with that, considering that a great number of websites/web applications used to be developed with PHP alone, without any additional frameworks.

  21. I’m php fanatic. I love it and parnormmigg in it from last 4 years. I want to learn ROR but never give it a try as I again fall in love with php every time if i try. But I always watch these videos I love the way they make these ads and make me laugh. Don’t oppose on them.

  22. I dug some of you post as I celebrated they were extremely helpful handy

  23. I just want to tell you that I am just very new to blogs and certainly savored you’re web site. Almost certainly I’m want to bookmark your blog post . You amazingly have fantastic article content. Thanks for sharing your website page.

  24. Simply a smiling visitant here to share the love (:, btw outstanding style and design .

  25. I will right away clutch your rss feed as I can not find your e-mail subscription hyperlink or e-newsletter service. Do you’ve any? Please permit me realize so that I could subscribe. Thanks.

  26. It is very rare these days to uncover internet sites that supply information someone is searching for. I am glad to see that your blog share valued info that can assist to a lot of scaners. thank and keep writing!

  27. I’ve been exploring for a bit for any high-quality articles or weblog posts on this sort of area . Exploring in Yahoo I at last stumbled upon this site. Reading this info So i am happy to express that I have an incredibly good uncanny feeling I found out exactly what I needed. I most for sure will make certain to don’t overlook this web site and provides it a look regularly.

  28. I will right away grab your rss feed as I can’t find your e-mail subscription link or newsletter service. Do you’ve any? Please let me know so that I could subscribe. Thanks.

  29. You might have observed really fascinating points ! ps nice website .

  30. I’ve read a few just right stuff here. Certainly price bookmarking for revisiting. I surprise how much attempt you place to make one of these wonderful informative website.

  31. There’s definately a great deal to find out about this topic. I love all the points you’ve made.

  32. Hello, I enjoy reading through your article post. I like to write a little comment to support you.

  33. I am sure this post has touched all the internet viewers, its really really pleasant post on building up new web site.

  34. Hi there! Someone in my Facebook group shared this site with us so I came to take a look.
    I’m definitely loving the information. I’m book-marking and will be tweeting this to my followers!
    Outstanding blog and terrific design and style.

  35. Hello, i think that i saw you visited my weblog thus i came to “return the favor”.

    I’m trying to find things to enhance my web site!I suppose its ok to use some of your ideas!!

  36. hey there and thank you for your info – I have definitely picked up something new from right here.

    I did however expertise some technical points using this
    site, as I experienced to reload the web site lots of times previous to
    I could get it to load properly. I had been wondering
    if your hosting is OK? Not that I am complaining, but
    sluggish loading instances times will sometimes affect
    your placement in google and can damage your high-quality score if advertising and marketing with Adwords.
    Anyway I am adding this RSS to my e-mail and could look out for much more
    of your respective exciting content. Ensure that you update
    this again soon.

  37. Howdy! This post couldn’t be written any better! Looking at this article reminds me of my previous roommate! He constantly kept talking about this. I’ll forward this information to
    him. Pretty sure he’ll have a good read. Thanks for sharing!

  38. If you wish for to obtain much from this article
    then you have to apply these techniques to your
    won webpage.

  39. Hey! This is my first visit to your blog! We are a group of volunteers and starting a new initiative in a
    community in the same niche. Your blog provided
    us beneficial information to work on. You have done a marvellous job!

  40. Hi there, I enjoy reading through your article. I wanted
    to write a little comment to support you.

  41. Excellent site you have here.. It’s difficult to find quality writing like yours nowadays. I really appreciate individuals like you! Take care!!

  42. Great info. Lucky me I recently found your website by chance (stumbleupon).
    I have saved it for later!

  43. Howdy! I’m at work browsing your blog from my new iphone 4! Just wanted to say I love reading through your blog and look forward to all your posts! Carry on the great work!

  44. I couldn’t refrain from commenting. Exceptionally well written!

  45. Pretty! This has been a really wonderful article.

    Thank you for supplying this information.

  46. Hi there, I discovered your website by the use of
    Google whilst searching for a similar topic, your website came
    up, it seems to be good. I’ve bookmarked it in my google bookmarks.
    Hello there, just become aware of your blog via Google, and found that it is truly informative. I’m gonna watch out for brussels.

    I’ll be grateful should you proceed this in future. Lots of folks will likely be benefited out of your writing. Cheers!

  47. It’s a pity you don’t have a donate button! I’d most certainly donate to this superb blog! I suppose for now i’ll
    settle for book-marking and adding your RSS feed to my
    Google account. I look forward to fresh updates and will
    talk about this website with my Facebook group.
    Chat soon!

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Đăng Ký Nhận Tin Qua Email

Nhận thông tin bổ ích về WordPress, Hosting, Thủ thuật website, Download miễn phí....và các phần quà hấp dẫn qua email.

* là bắt buộc