Saturday, March 5, 2011

Setting up Cloud9 on Ubuntu 10.10 32-bit desktop

EDIT: I’ve posted an easier version of this setup routine.

After many failed attempts to get Cloud9 up and running on ubuntu, someone finally posted some decent installation instructions. Andre used archlinux, so i thought I would try to do the same with ubuntu.

Below is the sequence of steps i followed to get up and running:

  1. Install Ubuntu 10.10 i686, choose any of the following:
    1. Local install
    2. Cloud based install amazon ec2, rackspace, etc
    3. Virtual Machine with VMware, Parallels, Virtual PC, etc
  2. I chose to use VMware Server 2.0 (formerly GSX server) for no other reason than I have used it before. It is free and quite powerful. I can never get bridged networking to work with wireless network on the host, so i plugged a cheapo separate wireless-network adapter into my laptop and configured VMware to pass that through to ubuntu. Anyway use whatever method you want, just get to the ubuntu desktop/terminal with network access.
  3. Update ubuntu
    sudo apt-get update
  4. Need to install various packages and tools in order to compile node, o3, cloud9, etc. The big one I missed here was libxml2-dev, o3 won’t compile without it, and it wasn’t exactly obvious for me that I need this particular package. Also, you probably won’t need all of these, YMMV.
    sudo apt-get install -y build-essential g++ curl libssl-dev apache2-utils git libxml2-dev
  5. Due to various folder permission errors you may get down the track, it’s worth setting up a local bin path to install nodejs into and add that path to bash
    echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
    . ~/.bashrc
    mkdir ~/local 
  6. Setup nodejs. Now there are various ways of doing this, you could even try nvm. This is what worked for me. There are newer versions of node than v0.4.0 already (4.1, 4.2, 5.0-pre, etc) but it seemed stable enough for me so I stuck with it. Now not all these steps are necessary, e.g. test and –v, but i put them in just to keep my sanity in check. Set configure to ~/local makes sure we install node to the ~/local/bin path we setup earlier
    git clone git://github.com/joyent/node.git
    cd node
    git checkout v0.4.0
    ./configure --prefix=~/local
    make
    make install
    make test
    cd ..
    node -v
  7. Setup npm, I think this step is optional but we may need it down the track
    curl http://npmjs.org/install.sh | sh
    npm -v
  8. Setup cloud9. This doesn’t really seem to be very well documented, but the suggestion is to use the development branch of cloud9. This part will take quite a while to update all the submodules. You will probably get an error on bin/cloud9.sh, I really don’t know if it is necessary (it is mentioned in the cloud9 installation instructions)  
    git clone git://github.com/ajaxorg/cloud9.git
    cd cloud9
    git checkout devel
    git submodule update --init --recursive
    bin/cloud9.sh
    cd ..
  9. Build o3. I had plenty of problems with this step due to not having libxml2-dev installed. This copies the new o3 binaries into cloud9
    git clone http://github.com/ajaxorg/o3
    cd o3
    ./tools/node_modules_build
    cp build/default/o3.node ../cloud9/support/jsdav/support/node-o3-xml-v4/lib/o3-xml/
    cd ..
     
       
  10. Create a new directory for your project ~/yourproject and add an app.js file containing
    var http = require('http');
     
    http.createServer(function (req, res) {
      res.writeHead(200, {'Content-Type': 'text/plain'});
      res.end('Hello World\n');
    }).listen(3001, "0.0.0.0"); 
       
  11. Almost there. You should now be able to run cloud9 like so (although switches are optional)
    node ~/cloud9/bin/cloud9.js -w ~/yourproject
  12. Now you should be able to open up the cloud9 ide @ http://127.0.0.1:3000
  13. Now not everything is perfect (ctrl-s doesn’t save you file, instead calls up the firefox save as dialog for me for some reason), but it’s good enough for me to live with.
  14. Lastly, why do this instead of using the free, already configured cloud9ide.com? Well this allows me to control everything, as well as run commands like the coffeescript cli, etc

Good luck!

You may want to hit up the cloud9 ide google group if you have issues

11 comments:

  1. hello,
    I cannot seem to find the libxml-dev package.

    ReplyDelete
  2. Hi Inxive, sorry it's actually called libxml2-dev. It should get installed at step 4. Are you getting an error?

    ReplyDelete
  3. I can get cloud9 running and accessible from a browser running on that machine, but how come it is not accessible to other machines in the network?

    ReplyDelete
  4. Hi! In item 14 you mention that "as well as run commands like the coffeescript cli, etc" - I don't sure, I can't compile coffee files on the server (and when I asked about it in twitter I had this response "Cloud9 IDE@
    @baio1980 The command is disabled in the console, so you can't at this time. We are figuring out how to safely enable more commands") and there is some restrictions - particularly you can't use gm module.
    And yes it would be grate to use it all out of box in cloud9ide.com. But now there is still pain to setup all this stuff on your own server.

    ReplyDelete
  5. Hi Max, definitely an issue. Seems like the Cloud9 team are making good progress on this though

    ReplyDelete
  6. I got it up and running, but can't open it up on any other than the machine itself. Changing the parameters in config.js didn't work. Any hints, how to get that working?

    ReplyDelete
  7. Ah, I forgot to mention that it works when using bin/cloud9.js -l 0.0.0.0. But I prefer to use the startup script do daemonize Cloud9.

    ReplyDelete
  8. i got it working as localhost, however can't access over local network... any ideas? i have other web services running also

    ReplyDelete
  9. Hi Ash and Ulf, bit late for this but you're probably better off asking questions over at https://groups.google.com/forum/#!forum/cloud9-ide

    ReplyDelete
  10. Hi,
    I simply wanted a web based editor on my server to edit scripts in perl, sh, php etc. I started from bespin and ended up here.

    Can you kindly write up a simple step-by-step for installing ACE editor on server, so that it can be embedded with any page?

    thank you.
    Rajeev

    ReplyDelete
  11. When I type in make install I get the following:

    Build failed: -> task failed (err #1):
    {task: cxx node_crypto.cc -> node_crypto_4.o}

    ReplyDelete