Last active
February 26, 2018 13:15
-
-
Save filipgorczynski/57fd51b267aecd2074281302aa2e7969 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| ## Check for versions compiled with ARM at http://nodejs.org/dist/ | |
| ## Inspired by https://gist.github.com/myrtleTree33/8080843 | |
| ########################################################################## | |
| ## Fill in the latest Node Version below: | |
| NODE_VERSION="v8.9.4" | |
| NODE_DIR="/opt/node-${NODE_VERSION}" | |
| NODE_DIR_NAME="node-${NODE_VERSION}" | |
| ########################################################################## | |
| # Make a new directory where you'll put the binary | |
| sudo mkdir -p $NODE_DIR | |
| # Get it | |
| wget https://nodejs.org/dist/$NODE_VERSION/node-$NODE_VERSION-linux-x64.tar.xz | |
| # Unpack | |
| tar xf node-$NODE_VERSION-linux-x64.tar.xz | |
| # Rename extracted directory | |
| mv node-$NODE_VERSION-linux-x64 $NODE_DIR_NAME | |
| # Move to the dir you made as the first step | |
| sudo mv $NODE_DIR_NAME /opt/ | |
| # Add node to your path so you can call it with just "node" | |
| # Add these lines to the file you opened | |
| PROFILE_TEXT=" | |
| PATH=\$PATH:$NODE_DIR/bin | |
| export PATH | |
| " | |
| echo "$PROFILE_TEXT" >> ~/.bash_profile | |
| source ~/.bash_profile | |
| # Linking for sudo node | |
| sudo ln -s $NODE_DIR/bin/node /usr/bin/node | |
| sudo ln -s $NODE_DIR/bin/npm /usr/bin/npm | |
| # Test | |
| echo "node installed on `which node` with version `node -v`" | |
| echo "npm installed on `which npm` with version `npm -v`" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment