The way to install Node.js on my Asus router with tomato was a bit tricky. I do not know yet if I did the best way but anyway it is working well. Then here is how I did to get Node.js running on my RT-AC68U with Tomato.
- An USB key (2Go is enough)
- Debian chroot environment
USB Key configuration
Please note that everything on your key will be erased during these operations.
Router and usb stick configuration
- Log into your router
- Plug your USB key
- In the web interface go to "USB & NAS" and then "USB Support" and activate the following options:
- [X] Core USB Support
- [X] USB 2.0 Support
- [X] USB 1.1 Support
- [X] USB Storage Support
- [X] File Systems Support ext2/ext3
- If the USB key is mounted unount it
- Go to "Administration" and then "Scripts"
- In the "Init" tab add this line:
echo "LABEL=optware /opt ext3 defaults 1 1" >> /etc/fstab
This line tells Tomato to mount the partition optware to /opt with the filesystem ext3.
Now we need to connect to our router by ssh and format the USB key.
ssh root@ip_of_my_router fdisk -l
Find your own USB key, mine is /dev/sda1 for this instance
Device Boot Start End Blocks Id System /dev/sda1 1 129706 1945589+ 83 Linux
Now delete all the partitions and create one single partition with 83 (Linux) as the type. When is done format the new partition. Replace sda1 by your partition.
mkfs.ext3 -L optware /dev/sda1
Peform the Optware installation
mount /opt cd /usr/sbin ./opware-install.sh
Reboot your router and verify the optware installation with the command
Debian Wheezy 7.7 installation
There is a very good tutorial to install Debian for the Merlin build but this works well for Tomato as well. You can find the original topic at this address: how-to-install-debian-wheezy-arm.
Here is the short way to install and run a chrooted Debian.
Connect to your router with again ssh and run the following commands:
ipkg install nano findutils cd /opt wget -c -O debian-wheezy7.7-clean-arm.tgz http://goo.gl/ieM6Ns tar -xvzf ./debian-wheezy7.7-clean-arm.tgz wget -c -O /opt/bin/debian http://goo.gl/RW37OV chmod 755 /opt/bin/debian wget -c -O /opt/etc/init.d/S99debian http://goo.gl/T8SX26 chmod 755 /opt/etc/init.d/S99debian
If your disk label is not /dev/sda1 edit the init script S99debian
Remplace sda1 by your own partition for the CHROOT_DIR and EXT_DIR.
Enter to the chrooted Debian and update it.
debian apt-get update apt-get upgrade
You are now ready to install every package from Debian.
To quit your chrooted Debian just run
exit and to enter
Perfom the Node.js installation
There is different way to install Node.js on a Debian but I think the simpler is from apt-get. If you prefere and have enough time you can compile it from the sources.
here is the steps to get it from apt-get.
Configure apt to use backports
And add this line:
deb http://ftp.debian.org/debian wheezy-backports main contrib non-free
Update apt and install the nodejs package + npm:
apt-get update aptitude -t wheezy-backports install nodejs update-alternatives --install /usr/bin/node nodejs /usr/bin/nodejs 100 aptitude install wget wget https://www.npmjs.com/install.sh ./install.sh rm -f install.sh
Finally you can test your node and npm with these commands:
node -v npm -v