Instalacja Slanger na Ubuntu

Z Podręcznik Administratora by OPZ SGU
Skocz do: nawigacja, szukaj

Tłumaczenie ze strony (

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:

<code>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:

<code>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:

<code>\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:

<code>rvm install 1.9.3

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

<code>rvm use 1.9.3 --default


<code>gem install slanger

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

<code>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:

<code>gem install slanger -v=0.3.6

You also need to have redis-server so run:

<code>gem install redis-server

Next you can start the redis-server with:

<code>redis start

Similarly you can stop redis with

<code>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:

<code>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:

<code>puts "Running Slanger v.#{Slanger::VERSION}"

I just commented that line out

<code>#puts "Running Slanger v.#{Slanger::VERSION}"

And voila it works!

<code>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:

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