While using the ChromeBook I was thinking that if I was able to run (tools like) git, node and LevelGraph (which is needed for my current dev focus at SI: TM_Graph_DB) I would have a really portable development environment (specially for running longish batches of Unit Tests).
After a bit of Linux fiddling, I was able to get it working and here is a screenshot of the final result:
What you see there is:
- the nodejs execution of the TM_Graph_DB github project
- which was cloned using git
- which used npm install
- that (due to levelgraph/leveldown dependencies) used node-gyp, python, make and g++
- that are not part of the Chrome OS distribution and where installed on a
- ubunto virtual environment
- created by Crouton
Crouton is actually a really nice solution, since it creates an 'Universal chroot environment' for ChromeOS.
My first efforts were based on manually getting/downloading the missing packages (like git, node and python from archlinux). Using the technique of 'mounting an folder from an SD Drive without the noexec setting' (into the /home/utills folder), I was able to get git, node and python to work ok (For example, I was able to clone and run the tests for the fluentnode project I recently published), but it got messy getting node-gyp to work, specially since it needed python (2.7) and make and g++.
The Crouton solution is much better, specially since it doesn't require touching the original Chrome OS bin folder (note: another prob to solve, was that by default /usr/bin folder only had 200Mb of free space, which is not enough to install node and git).
For reference here a number of links that helped me to figure this out:
- http://www.chromium.org/chromium-os/poking-around-your-chrome-os-device
- http://www.ipreferjim.com/2011/12/install-nodejs-under-chromeos-cr-48/
- http://kalinchuk.com/?tag=install-packages-on-chrome-os
- https://www.archlinux.org/packages/ (search for git, nodejs, python,etc..)
- http://www.benfarrell.com/2013/01/03/c-and-node-js-an-unholy-combination-but-oh-so-right/
- http://stackoverflow.com/questions/7880454/python-executable-not-finding-libpython-shared-library
- https://answers.atlassian.com/questions/250260/about-git-path-for-sourcetree
- http://www.lagmonster.org/docs/vi.html
- https://github.com/TooTallNate/node-gyp
Useful linux commands
- wget http://mirror.bytemark.co.uk/archlinux/extra/os/x86_64/python2-2.7.8-2-x86_64.pkg.tar.xz
- tar -xvf python2-2.7.8-2-x86_64.pkg.tar.xz
- LD_LIBRARY_PATH=/home/tools/usr/lib
- whereis git
- alias npm='/home/tools/usr/bin/node /home/tools/usr/bin/npm'
- PATH=/home/tools/usr/bin:$PATH
- sh ~/Downloads/crouton
- sudo sh ~/Downloads/crouton -t xfce
- sudo enter-chroot
- mkdir /mnt/stateful_partition/crouton/chroots/precise/home/_downloads
- cp *.xz /mnt/stateful_partition/crouton/chroots/precise/home/_downloads/
- df -h
- du -s usr
- apt-get install git
- apt-get install node
- apt-get install make
- apt-get install g++
- fdisk -l
- mount -bind /dev/sdb1 /home/tools
- mount -o remount,rw,exec