Learning to click my Ruby shoes together.
February 28, 2007 2:04 PM   Subscribe

Installing Ruby programs on a website: Where do I even begin?

For a few years now, I've been flying by with easy installations, e.g. the 5-second web-based Wordpress installation. But the age of Ruby has come, and I, too, wish to learn.

But then there's the installation instructions! Take, for example, Gruff Graphs and JunebugWiki. And all the other Ruby programs I've come across have similar installation instructions. Where do I even begin?

From what I gather, I need SSH access to my website. Done. I create a MySQL database with mydatabase_username and mydatabasepassword. I then login via PuTTY, then when the command-line screen pops up, I try to login with the MySQL username and password - and then the server says "Access denied", but that's another thing I'll have to settle with my webhost. Perhaps I'm not putting in my username/password correctly. (Then why am I including this tidbit here? I'm not sure, but it might be relevant and I'm just not realizing it.)

In the case of Gruff Graphs: to install, "sudo gem install gruff". I assume that once I'm in somewhere - possibly after getting past the SSH access - I enter in these magic words and ta-da!

This is as far as I've gotten. It could be that I'm missing a big piece of information somewhere, or it could be as simple as just getting past PuTTY. Please do take a newbie by the hand and show me? Alternatively, you could also cattle-prod me in the right direction.
posted by Xere to Computers & Internet (5 answers total) 2 users marked this as a favorite
Don't try to do it all at once. You can try a lot of things on their own, on your local machine.

If you want "rails", look into InstantRails, and running it on your local box, to try to get the hang of it.
posted by PEAK OIL at 2:23 PM on February 28, 2007

The login it wants is the one you identify yourself to the hosting company with, which is distinct from your database credentials, which you'll have to tell your app about it in some way that varies from software to software. If your host offers some kind of control panel your credentials there are likely the same as the shell login.

Once you get in the path you take is going to depend on whether you have some type of private hosting or shared. If the former, the sudo gem install foo thing should about do it for you.

If the latter is the case, you'll probably not be able to sudo anything because you'll not have permission. You can still install the gem, but you need to keep it in your home directory where you have dominion. The rest of this post is just my experience installing gems on shared hosting, so if you have private hosting don't bother reading it ;)

type 'mkdir ~/gems' once to make a place to keep them (you don't have to do this for every install) (the path of your home directory is automatically substituted for ~ by the shell)

After that you can redirect gem by changing occurrences of 'sudo gem install foo' to 'gem install foo --install-dir=~/gems'

This adds one additional dependency to whatever other instructions come with the app, you need to tell it to look in the directory you supplied for the things it's trying to include from the gem. This involves adding a line to a file in the app that will be run or included every time:

For Rails apps: in config/environment.rb after the initial #! line near the top:

ENV['GEM_PATH'] = 'dir'

For other Ruby or if that gives you trouble, put this in any file that looks like it's probably included for every request. config stuff or dispatch.cgi are good bets:

$:.push 'dir'

In both cases 'dir' should correspond to the gem folder you created, ie. /home/yourusername/gems. If there's any doubt about this you can type 'stat ~/gems' in the shell and a line near the top of the output will list the actual absolute path.

That's all I can think to tell you that's general. A lot depends on your host and the app you're installing. Your host may have documents tailored to people in your situation taking their system administration decisions into account.
posted by moift at 2:34 PM on February 28, 2007

Chances are that your host won't allow you access to sudo. Sudo is a command that says 'execute the following as root'...

With many rails applications, you need to have the Rails framework installed already. Look into a host that advertises Ruby on Rails Support, and you'll need to look into how to install things that require RoR.

Or, just buy a Virtual Private Server, and be done with all of the hassles of shared hosting.
posted by SpecialK at 2:46 PM on February 28, 2007

There's a very good chance that Ruby is already running on your host. Once you get your SSL login sorted out, log in and type "ruby -v" at the prompt. That will tell you what version of Ruby the host is running, if any. If you get an error message, you'll know they aren't.

If you need RoR (which I am just learning myself, on a local install), you might be better off just getting a hosting plan at a service that has it built-in.
posted by adamrice at 2:58 PM on February 28, 2007

You are going to need more help than we can give you in this thread.

You're basically trying to run before you can walk.

Go to rubyonrails.org and do some tutorials. Don't try installing a ruby app until you've done it.

Ruby on Rails apps are not for beginners, despite the hype, although Ruby on Rails is a good way to learn to program.
posted by empath at 3:10 PM on February 28, 2007

« Older Help me re-train my cat!   |   Freshwater fishing for n00bs Newer »
This thread is closed to new comments.