Before we can get down to the nitty-gritty of creating the mirror, we have to do a bit of prerequisite work first. To start with, I will tell you that I am working on a fresh installation of Ubuntu 14.10. That disclosed, ruby comes installed by default. Please know that I will be only referencing the
The first thing that we need to get installed is the ruby-dev package. You can install that with the following command:
$ sudo apt-get install ruby-devAfter you install that, make sure that your system is up to date:
$ sudo apt-get updateNow, we need to get a couple of gems installed:
$ sudo apt-get upgrade
$ sudo gem install net-http-persistentNext we need to install a whole slew of things (inluding git):
sudo apt-get install git-core curl zlib1g-dev build-essential libssl-dev libreadline-dev libyaml-dev libsqlite3-dev sqlite3 libxml2-dev libxslt1-dev libcurl4-openssl-dev python-software-properties libffi-devNow it is time to install rbenv. This tool will provide you the ability to install different versions of ruby (other than the default). Its handy, so I am including it here for giggles. Here are the steps to install rbenv (these should be done as you, not sudo/root):
$ git clone git://github.com/sstephenson/rbenv.git ~/.rbenvNow you need to install the rubygems-mirror gem. This is what is used to create the mirror:
- Add $HOME/.rbenv/bin to your PATH variable
- Add eval "$(rbenv init -)" to your .bashrc file
After that finishes, you will need to create the the '.mirrorrc' file:$ sudo gem install rubygems-mirror
$ vi ~/.gem/.mirrorrc
In this file, you are going to specify where to grab the gems from and where to put them on your system:You will need to make sure that you create the directory you specify in the "to:" portion.--- - from: http://rubygems.org to: ~/path/to/put/the/files
After you save the .mirrorrc file and create the directory, you are ready to start mirroring:
This is going to take a while. I ran it and it took several hours to download (and I have a fiber internet connection with 30Mb down). So, once you start the download, you might as well go do something (watch a movie, read a book, hack on a Raspberry Pi, whatever you feel like. Just monitor it once in a while to ensure it keeps going successfully.$ gem mirror
Warning: The download is many gigabytes and you are going to need some space for it.
That's it, you now have a mirror of Rubygems that you can reference in offline situations. Stay tuned and I will put up a post on how to run a server that points to this mirror so that you can put it to good use.
No comments:
Post a Comment