Install Slanger on Ubuntu 12

Install Slanger on Ubuntu 12Slanger is an open source server implementation of the Pusher protocol written in Ruby.

I wanted to install it on Ubuntu 12 but hit a few snags, so here’s how I got it working.

First, it seems pretty imperative that you have a good ruby version manager (rvm) tool available. On Mac OS X I use rbenv but on Ubuntu I think the best one is the one from and not the one from apt-get.

So if you have installed the one from apt-get then it is probably best to remove it. Disclaimer – back up important files, blah bla blah, you should have some knowledge of linux, bla bla bla, I don’t know what you might accidentally delete while doing this. Be careful.

To remove the old rvm:

sudo apt-get --purge remove ruby-rvm
sudo rm -rf /usr/share/ruby-rvm /etc/rvmrc /etc/profile.d/

Then logout of the shell and/or reboot and run:

env | grep rvm

It should be blank, but if not try and find where the settings are coming from. I changed to the /etc/ directory and ran grep -Hil rvm and found that it was in the bash.profile there so i removed the environmental variables being set there, then logged out of my shell and logged in again.

Once that is removed, you need to install the new version of rvm and from the website the instructions say run this:

\curl -L | 
    bash -s stable --ruby --autolibs=enable --auto-dotfiles

That worked great, I think it installed ruby 2.0 by default and I think it would be better to have 1.9.3 so I ran:

rvm install 1.9.3

After that completed I wanted to make 1.9.3 run as my default so I ran:

rvm use 1.9.3 --default


gem install slanger

Slanger 0.3.7 has some issues with version dependencies with rack and sinatra and so the command spit out:

ERROR:  While executing gem ... (Gem::DependencyError)
Unable to resolve dependencies: slanger requires rack (~> 1.5);
thin requires rack (>= 1.0.0); sinatra requires rack (< 1.5, ~> 1.1)

You may be able to run that command without any problem (after slanger is updated) but as of right now you need to install an older version of slanger IF THE PREVIOUS COMMAND DOES NOT WORK.

So you can try:

gem install slanger -v=0.3.6

You also need to have redis-server so run:

gem install redis-server

Next you can start the redis-server with:

redis start

Similarly you can stop redis with

redis stop // don't run this right now - it's in case you need it later

If everything worked well you can just run slanger with:

slanger --app_key 765ec374ae0a69f4ce44 --secret your-pusher-secret

But if that gives you an error about:

in `block in <top (required)>': uninitialized constant Slanger::VERSION (NameError)

Then you need to make a small edit until slanger is updated.

Edit the file referenced in the error, at the line referenced (106):


And it has this line of code:

puts "Running Slanger v.#{Slanger::VERSION}"

I just commented that line out

#puts "Running Slanger v.#{Slanger::VERSION}"

And voila it works!

Slanger API server listening on port 4567
Slanger WebSocket server listening on port 8080

The github issues page is also a good resource but just don’t try and install slanger inside inside another app. Read the readme:

Slanger is intended as a server that is easy to install,
not a gem inside Rails or Sinatra.

Related Posts:

  • No Related Posts
This entry was posted in Tech Tips, Web Development and tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *