Skip to content

Instantly share code, notes, and snippets.

@CLCL
Last active June 29, 2016 10:23
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save CLCL/b5561d1f0c1f3732475b4ce4a888beea to your computer and use it in GitHub Desktop.
Save CLCL/b5561d1f0c1f3732475b4ce4a888beea to your computer and use it in GitHub Desktop.
CentOS 6にnode.jsをインストール。EPELのnodejsパッケージにパスを合わせる
#!/bin/sh
#https://nodejs.org/en/download/package-manager/#enterprise-linux-and-fedora
# FedoraCoreやEnterpriseLinux(RHEL/CentOS)用のインストール手順
# RHEL 5/6/7 で使える手順
# 入るnode.jsはバージョンが一つ古い程度(v6.2.2が公開の時点の2016/6/29でv6.2.1が入った)
# Import yum repository
# curl --silent --location https://rpm.nodesource.com/setup_4.x | bash -
curl --silent --location https://rpm.nodesource.com/setup_6.x | bash -
# curl --silent --location https://rpm.nodesource.com/setup | bash -
# Disable defalt use
sed -i -e 's/^enabled=1/enabled=0/' /etc/yum.repos.d/nodesource-el.repo
# Install node.js
yum --enablerepo=nodesource -y install nodejs
#!/bin/sh
# install node.js tar version
curl -LO https://nodejs.org/dist/v6.2.2/node-v6.2.2-linux-x64.tar.xz
tar Jxf node-v6.2.2-linux-x64.tar.xz --no-same-owner --no-same-permission
cd node-v6.2.2-linux-x64
rsync -av bin include lib share /usr/
# 任意ディレクトリにインストールした場合下記パス設定必要
# 今回の場合はパスを合わせたので不要
#export NODE_HOME=$HOME/node
#export NODE_PATH=$NODE_HOME/lib/node_modules
#export PATH=$NODE_HOME/bin:$PATH
#!/bin/sh
# Uninstall node.js tar version
sudo rm -rf /usr/bin/node /usr/bin/npm /usr/include/node /usr/lib/node_modules /usr/share/doc/node /usr/share/man/man1/node.1 /usr/share/systemtap/tapset/node.stp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment