若有Node有出新版時, 只要修改NODE_VERSION, 就可以重覆安裝
#!/bin/bash
NODE_VERSION="v0.10.30"
NODE_FILENAME="node-$NODE_VERSION-linux-x64"
PARENT_LOCATION="/opt/nodejs"
###
### Prerequisive ###
###
yum -y update
yum -y groupinstall "Development Tools"
sudo mkdir -p /usr/local/src
sudo cp etc/statsd.init /usr/local/src
###
### Install NodeJS ###
###
### Download NodeJS ###
cd /usr/local/src
sudo wget -nc http://nodejs.org/dist/$NODE_VERSION/$NODE_FILENAME.tar.gz
#wget -E -H -k -K -p http://
sudo tar zxvf $NODE_FILENAME.tar.gz
sudo mkdir -p $PARENT_LOCATION
sudo mv $NODE_FILENAME $PARENT_LOCATION/
### Link binary files ###
rm -f /usr/local/bin/node
rm -f /usr/local/bin/npm
sudo ln -s $PARENT_LOCATION/$NODE_FILENAME/bin/node /usr/local/bin
sudo ln -s $PARENT_LOCATION/$NODE_FILENAME/bin/npm /usr/local/bin
沒有留言:
張貼留言