tag:blogger.com,1999:blog-3304826615112922802024-03-07T21:20:11.494-08:00vBatikUnknownnoreply@blogger.comBlogger1125tag:blogger.com,1999:blog-330482661511292280.post-4111894025150037492011-09-20T08:35:00.001-07:002011-09-20T14:33:41.034-07:00Installing rabbit.js on Ubuntu 11.04 - Natty<div>So you want to run the following:</div><div><br /></div><div>http://www.rabbitmq.com/blog/2010/11/12/rabbitmq-nodejs-rabbitjs/</div><div><br /></div><div>This is a quick blog on installing node.js, RabbitMQ and then rabbit.js on Ubuntu 11.04. I may have forgotten a few steps, so please feel free to add comments.</div><div><br /></div><div>1) Download Ubuntu 11.04 Natty Narwal iso (I am using 32bit)</div><div><br /></div><div>http://www.ubuntu.com/download/ubuntu/download</div><div><br /></div><div>2) I am running a MBP so I installed the iso on Fusion 3.1.3. I took the defaults and created a 20gig drive and standard 512MB RAM for memory.</div><div><br /></div><div>3) Installing Node.js from source </div><div><ul><li> Make sure that you do the following: </li></ul><span class="Apple-tab-span" style="white-space:pre"> </span>- sudo apt-get update</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- sudo apt-get install ubuntu-dev-tools</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- sudo apt-get install python2.7 </div><div><span class="Apple-style-span" style="font-size: 14px; line-height: 18px; white-space: pre; "><br /></span></div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>- Python tools to interact with RabbitMQ (Perhaps for later not necessary for node)</div><div><span class="Apple-style-span"><span class="Apple-style-span" style="line-height: 18px; white-space: pre; "><span class="Apple-tab-span" style="white-space: pre; "><span class="Apple-style-span" style="font-size: 14px;"> </span></span></span></span><span class="Apple-style-span"><span class="Apple-style-span" style="line-height: 18px; white-space: pre; "><span class="Apple-tab-span" style="white-space: pre; "><span class="Apple-tab-span" style="white-space: pre; "> </span></span></span></span>- sudo apt-get install python-pip git-core</div><div><span class="Apple-style-span"><span class="Apple-style-span" style="line-height: 18px; white-space: pre; "><span class="Apple-tab-span" style="white-space: pre; "> - sudo pip install pika==0.9.5</span></span></span></div><div><ul><li><span class="Apple-style-span"><span class="Apple-style-span" style="line-height: 18px; white-space: pre;">Here is the interesting part and I tried several different methods, but this seemed to work for me.</span></span></li></ul><span class="Apple-style-span" style="line-height: 18px; white-space: pre; "><span class="Apple-tab-span" style="white-space:pre"> </span>- Install node.js from the "Ubuntu Software Center" On the desktop goto: Applications->Ubuntu Software Center.</span><br /><span class="Apple-style-span" style="line-height: 18px; white-space: pre; "> </span></div><div><span class="Apple-style-span" style="line-height: 18px; white-space: pre; "><span class="Apple-tab-span" style="white-space:pre"> </span> - Search for node.js and then select "Node.js event-based server-side javascript engine"</span><br /><span class="Apple-style-span" style="line-height: 18px; white-space: pre; "><span class="Apple-tab-span" style="white-space:pre"><br /></span></span></div><div><span class="Apple-style-span" style="line-height: 18px; white-space: pre; "><span class="Apple-tab-span" style="white-space:pre"> </span>- Click on it and then install it. We are then going to "uninstall" once this has been completed. I don't know why...but it must bring the necessary dependencies. .</span></div><div></div><div></div><div></div><div><span class="Apple-style-span" style="line-height: 18px; white-space: pre;"><span class="Apple-tab-span" style="white-space:pre"><br /></span></span></div><div><span class="Apple-style-span" style="line-height: 18px; white-space: pre;"><span class="Apple-tab-span" style="white-space:pre"> </span>- Node.js will work if you install this way, BUT, Node Package Manager (npm) will not...and trust me you want the Package Manager</span></div><div><span class="Apple-tab-span" style="white-space:pre"><br /></span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- Now following the instructions as written for the installation of Node.js:</div><div><br /></div><div><span class="Apple-tab-span" style="white-space: pre; "> </span>- <span class="Apple-tab-span">https://github.com/joyent/node/wiki/Installation</span></div><div><br /></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- Open a terminal and make sure you are at /home/[username] and follow the <span class="Apple-tab-span" style="white-space:pre"> </span> instructions to get node.js installed</div><div><ul><li>Once you have node installed from the source...you should have a directory as follows:</li></ul> <span class="Apple-tab-span" style="white-space:pre"> </span>- /home/[username]/local/node</div><div><ul><li>node executable is now in your .profile and sourced, so you should be able to execute "node" in any terminal window.</li><li>Ok, now we need to get npm installed</li></ul><span class="Apple-tab-span" style="white-space:pre"> - Execute in the terminal:: "curl http://npmjs.org/install.sh | sh" - If you are prompted to install curl, then go ahead and do that via apt-get and rerun the command. - You should be able to run npm and not get an error about not having some MRI viewing software. ;-) </span></div><div><div><ul><li>Now let's get to the heart of this effort and install rabbit.js. In terminal go to /home/[username]/local/node/lib/node_modules</li></ul></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- Execute in the terminal: npm install amqp -g</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- Execute in the terminal: npm install rabbit.js</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- Execute in the terminal: npm install socket.io@0.6.17</div><div> - Execute in the terminal: npm ls (this command lists all of the installed node plugins)</div><ul><li><span class="Apple-style-span">If all went well you should then have a directory like this:</span></li></ul></div> /home/vfabric/local/node/lib/node_modules<div><span class="Apple-style-span"><span class="Apple-style-span" style="line-height: 24px; white-space: pre;"><div>├── amqp@0.1.0 </div><div>├─┬ npm@1.0.30 </div><div>│ ├── abbrev@1.0.3 </div><div>│ ├── graceful-fs@1.0.0 </div><div>│ ├── ini@1.0.1 </div><div>│ ├─┬ minimatch@0.0.4 </div><div>│ │ └── lru-cache@1.0.4 </div><div>│ ├── node-uuid@1.2.0 </div><div>│ ├── nopt@1.0.8 </div><div>│ ├── proto-list@1.0.0 </div><div>│ ├── request@2.1.1 </div><div>│ ├── rimraf@1.0.6 </div><div>│ ├── semver@1.0.9 </div><div>│ ├── slide@1.1.3 </div><div>│ └── which@1.0.2 </div><div>├── rabbit.js@0.1.1 </div><div>└── socket.io@0.6.17 </div></span></span><div><span class="Apple-style-span"><span class="Apple-style-span" style="white-space: pre; line-height: 24px; "><br /></span></span></div><div><div><ul><li>Now we need to get RabbitMQ installed. This is pretty straightforward:</li></ul></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- http://www.rabbitmq.com/releases/rabbitmq-server/v2.6.1/rabbitmq-server_2.6.1-1_all.deb</div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- In gnome, navigate to the Downloads folder and right mouse button the deb file</div><div> <span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- Open the file with "Open With Ubuntu Software Center"</div><div><span class="Apple-tab-span" style="white-space:pre"> </span></div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- This will state that an older version of RabbitMQ is installed. Go ahead and install this version</div><div><br /></div><ul><li>Nice management addins to install are the RabbitMQ Management plugins.</li></ul><ul><li>Download these addins from here:</li></ul><span class="Apple-tab-span" style="white-space:pre"> </span>- http://www.rabbitmq.com/plugins.html<br /><br /></div><div><div><b>rabbitmq_management</b></div><div><br /></div><div>- mochiweb</div><div>- webmachine</div><div>- rabbitmq_mochiweb</div><div>- amqp_client</div><div>- rabbitmq_management_agent</div><div>- rabbitmq_management</div><div><br /></div><div><b>rabbitmq_visualiser</b></div><div><br /></div><div>- rabbitmq_management_visualiser</div></div><div><br /></div><div><ul><li>To install the plugins, you need to stop the server. In the terminal:</li></ul><span class="Apple-tab-span" style="white-space:pre"> </span>- Execute in the terminal: rabbitmqctl stop</div><div><br /></div><div><ul><li>Copy all of the .ez files in /home/[username]/Downloads to the RabbitMQ plugin directory</li></ul><span class="Apple-tab-span" style="white-space:pre"> </span>- Execute in the terminal: sudo mv ~/Downloads/*.ez /usr/lib/rabbitmq/lib/rabbitmq_server-2.6.1/plugins</div><div><br /></div><div><ul><li>Restart RabbitMQ with the following:</li></ul><div><span class="Apple-tab-span" style="white-space:pre"> </span>- Execute in the terminal: sudo rabbitmq-server</div><div><ul><li>In firefox, navigate to http://localhost:55672 and login as guest / guest</li></ul><span class="Apple-tab-span" style="white-space:pre"> </span>- Hopefully, you should see the management console and the visualizer (pretty cool!)</div><div><ul><li>Now, let's get node and rabbit chatting with each other. Navigate to /home/[username]/local/node/lib/node_modules/rabbit.js in the terminal.</li></ul><span class="Apple-tab-span" style="white-space:pre"> </span>- Execute in the terminal: node example/socketio.js</div><div><span class="Apple-tab-span" style="white-space:pre"> </span>- You should see in the terminal...something like: </div><div><br /></div><div><div>20 Sep 13:29:49 - Your node instance does not have root privileges. This means that the flash XML policy file will be served inline instead of on port 843. This will slow down initial connections slightly.</div><div>20 Sep 13:29:49 - socket.io ready - accepting connections</div></div><div><br /></div><div><ul><li>Finally...whew...if all of this is working...then you will be able to login into the node server at http://localhost:8080 and follow the instructions from there...if not...well it works on my vm. ;-)</li></ul></div><div><br /></div></div></div>Unknownnoreply@blogger.com2