Skip to content

Instantly share code, notes, and snippets.

@samuelololol
Last active December 22, 2015 23:29
Show Gist options
  • Save samuelololol/6547247 to your computer and use it in GitHub Desktop.
Save samuelololol/6547247 to your computer and use it in GitHub Desktop.
setting nodejs environment on centos6.4 as a vmware vm
  1. edit MAC address
$ vi /etc/udev/rules.d/70-persistent-net.rules #ATTR{address}=="$MAC", NAME="eth0"
$ vi /etc/sysconfig/network-scripts/ifcfg-eth0 #HWADDR=$MAC, onboot=yes
  1. edit IP address
$ ifconfig eth0 <ip> netmask <netmask>
$ route add default gw <gateway>
$ echo "nameserver 8.8.8.8" >> /etc/resolv.conf
  1. install system-config-* tools and edit the config of network and firewall(iptables)
$ yum install system-config-network-tui
$ yum install system-config-firewall-tui
$ system-config-network-tui
$ system-config-firewall-tui
  1. (Optional) finstall and activate the CentOS Continuous Release (CR) Repository and update
$ yum install centos-release-cr
$ yum update
$ reboot
  1. install necessary packages
$ yum groupinstall 'Development tools'
$ yum install gcc gcc-c++ unzip vim zlib-devel bzip2-devel \ 
              openssl-devel ncurses-devel sqlite-devel \
              readline-devel tk-devel git
  1. install nvm
$ git clone https://github.com/creationix/nvm.git ~/.nvm
$ echo "[[ -s ~/.nvm/nvm.sh ]] && source ~/.nvm/nvm.sh" >> ~/.bashrc
$ echo "[[ -s ~/.nvm/bash_completion ]] && source ~/.nvm/bash_completion" >> ~/.bashrc
$ source ~/.bashrc
$ nvm ls-remote 
  1. install node, search http://nodejs.org/ for stable version
$ nvm install 0.10
$ nvm alias default 0.10
  1. install node to system, allow other user to use node
$ n=$(which node);n=${n%/bin/node}; chmod -R 755 $n/bin/*; sudo cp -r $n/{bin,lib,share} /usr/local

Reference: nodejs via nvm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment