3

I've downloaded nodejs I want to install it on Ubuntu 16.10 ,I have the node folder with this files

bin  CHANGELOG.md  include  lib  LICENSE  README.md  share

Where I have to place it to use node?

AFS
  • 205

2 Answers2

2

You can place them anywhere and link to a bin folder. The common places are /usr/share, /usr/local/share. On my personal computer, I usually place things like that in my home directory like that: ~/bin/node/*.

However, I would generally not recommend it with node, unless you have no choice. I would rather go with NVM. This way you can install any version of node you want and switch them if needed.

Tim
  • 32,861
  • 27
  • 118
  • 178
Mat
  • 289
0

Let give this simple method:

  1. Create a folder /home/$USERNAME/devenv

  2. Download binaries into folder in step 1

  3. untar the node file

  4. Create a symbolic link in the /home/$USERNAME/devenv

    ln -s untared-node-file-name node
    
  5. Place it in your path in the /home/$USERNAME/.profile file with at the end:

    PATH=$PATH:$HOME/devenv/node/bin
    
  6. Source the /home/$USERNAME/.profile by running this in terminal:

    source ~/.profile
    
  7. Now check with node -v and npm -v

Information:

  • To update just download new version and change symbolic link.
George Udosen
  • 36,677
  • 1
    No need to create the denenv dir, link it, and edit .profile. Just create ~/bin, and it's already in the $PATH. – heynnema Mar 12 '17 at 14:44
  • Yes if you don't need the extra luggage, but I prefer to group things – George Udosen Mar 12 '17 at 15:43
  • Just drop folders into ~/bin and you can still group things by folder name. No? – heynnema Mar 12 '17 at 15:49
  • Can you be more explicit? – George Udosen Mar 12 '17 at 15:54
  • It sounds like to keep things organized, you're creating new folders (devenv) in your home directory. That can get kind of messy, yes? Instead, drop the nodejs folder into ~/bin, and if need be, create a link in ~/bin that points to the executable in the folder. Type echo $PATH to see the current path, and you'll see that ~/bin is the first item. – heynnema Mar 12 '17 at 16:07
  • I believe this is better? – George Udosen Mar 12 '17 at 16:25
  • Well... I guess not then... :-( You don't have to create new folders for every new binary, and you don't have to edit .profile or source .profile. Drag a new folder into ~/bin, and create a new link, sounds easier :-) – heynnema Mar 12 '17 at 16:53
  • Could you please edit my answeer so I get what your trying to put across – George Udosen Mar 12 '17 at 16:55
  • Mat's answer is almost the same idea... except I put the folder containing the binary (or the executable or shell script) into the ~/bin directly, and then link into a folder hierarchy if need be. – heynnema Mar 12 '17 at 16:59