Creating your own Gem Server, redux

One of the most popular landing pages for (which isn’t saying much) — is a post I put together in April, 2007 about running your own gem server.

Unfortunately it’s outdated. Set let me revisit it for those landing on the old page and looking to put together their own gem server. The nice thing is, gem has (almost) all the tools you need.

Setting up your server

  1. You need a web server. (yes I know you can run gem_server, but get a real one). You are on your own for that one. You also need a rubygems install on that box. You are also on your own for bootstrapping rubygems on that box and any other ones.
  2. Decide where you will put your gems (say in a “mycoolgems” directory off the docroot for your webserver)
  3. $ mkdir [docroot]/mycoolgems/gems
  4. Copy your .gem files that you want to host to $ [docroot]/mycoolgems/gems
  5. The gem suite of commands includes a generate_index command to generate a yaml-based index of your gems, and other supporting files. See gem help generate_index for more information

Pointing your systems to your own server

This used to be a complete PITA that involved rebuilding the sources gem. No more! After you install rubygems — just make sure to do a:

gem sources –remove

and a

gem sources –add http://yourwaycool.gem.source

That’s All Folks (probably)

Voila! You just managed to point your server to your own gem server! Install away.

It’s good to keep one box pointed to — and take advantage of the new “gem outdated” command to keep track of changes in your installed gems that have been deployed to rubyforge.