How To Setup A Local Gem Server In Ubuntu 14.04 LTS

Setup a Local Gem Server in Ubuntu 14.04 LTS

My Environment Setup:

Hostname       :
IP Address      :
ifconfig | grep inet


Step 1: Install ruby package:

First we need ruby package to work with gems.

Add the PPA repository and update the repo cache to get install ruby.

sudo apt-add-repository ppa:brightbox/ruby-ng-experimental
sudo apt-get update && sudo apt-get install ruby1.9.3

Check for the Ruby version using:

ruby -v


Step 2: Install & Configure Gem server:

Install any one of ruby gems and start to configure the gem Server.

sudo gem install aa

Here what ever Gems you need want to be pulled and stored here by manual, After that in future we can use these gems in client machines.

Then start the Gem server using:

gem server --port 8808 --dir /var/lib/gems/1.9.1/ --bind --no-daemon

Here is the explanation for above command.

gem server = start the gem server
–port = In which Port we need to run
–dir = which directory need to be used as gem repository to store and served.
–bind = Need to run in this address.
–no-daemon = dont need to be run as a daemon.

Step 3: Running in background:

If we need to run the gem server in background  while the server start-up we need to add a small script.

Create a Script file in any name:


Append the following gem server command in the created file:

gem server --port 8808 --dir /var/lib/gems/1.9.1/ --bind --no-daemon &

Then save and exit using wq!.

Now to start it automatically when server up and running we need to add the created script file in the rc.local.

sudo vim /etc/rc.local

Append the created file location with sh to execute the command:

sh /home/unixadmin/

save and quit rc.local using wq!


Step 4: Check Gem Server status:

Now the gem server used to run in the, We can access the web interface using:


Step 5: Client side Configuration:

Create two files in under home directory and /etc/.

vim ~/.gemrc
vim /etc/gemrc

Add the below Content in above created files.

 :update_sources: true
 :benchmark: false
 :bulk_threshold: 1000
 :backtrace: false
 :verbose: true
 gem: --no-ri --no-rdoc
 install: --no-rdoc --no-ri
 update: --no-rdoc --no-r

Now When ever we try to install the gems for any project Gems will be served from local server and it saves lot of time even hours.

To see the gem info navigate to

sudo gem install aa


To get every gems from local we have to pull and stored in gem server by manually, That’s it we have installed and setup-ed a local gem server for our home or office environment.