Using Jordan Sissel fpm , you can use various input archives (including gems), as well as compile and package them as (among others) DEB or RPM.
Below is an example for compiling json gem into a deb package:
cd /tmp fpm -s gem -t deb json
This will download the latest version of json gem and create the rubygem-json-1.5.7-1.amd64.deb in /tmp , which you can install on your server. Note that the compilation field and destination server must be identical. At least the distribution and bitness, the ruby version and its file layout, as well as the available downloadable libraries should be the same. Basically, all the restrictions that your distribution applies to are related to ...
However, in the long run, it was much easier for me to simply install the compiler on the target servers and use rbenv or rvm on the server. For most small and medium-sized devices, this is much easier to use, since you do not need to pre-compile and send everything to your servers.
source share