forked from coolaj86/node-installer.sh
node.js -> io.js, node -> iojs
This commit is contained in:
commit
7cc0644fec
46
README.md
46
README.md
|
@ -1,2 +1,46 @@
|
|||
# iojs-install-script
|
||||
A script to install basic development tools for iojs (git, node, gcc, pkg-config, etc)
|
||||
|
||||
A script to install basic development tools for iojs (git, iojs, gcc, pkg-config, etc)
|
||||
|
||||
Works for any recent version of Ubuntu or OS X.
|
||||
|
||||
```bash
|
||||
# Specify the version of iojs to install
|
||||
echo "v1.0.1" > /tmp/IOJS_VER
|
||||
|
||||
# And install away!
|
||||
curl -fsSL bit.ly/install-iojs | bash
|
||||
```
|
||||
|
||||
**For older versions of Ubuntu**:
|
||||
|
||||
```bash
|
||||
wget -nv bit.ly/install-iojs -O - | bash
|
||||
```
|
||||
|
||||
This is what gets installed:
|
||||
|
||||
* fail2ban (not necessary for development, but should be on every server)
|
||||
* rsync
|
||||
* curl
|
||||
* wget
|
||||
* git
|
||||
* xcode / brew / build-essential / pkg-config / gcc
|
||||
* iojs (including npm and node symlink)
|
||||
* jshint
|
||||
|
||||
Screencast
|
||||
==========
|
||||
|
||||
[How to Setup a VPS for io.js Development](https://www.youtube.com/watch?v=ypjzi1axH2A) - [(3:06 installing io.js](https://www.youtube.com/watch?v=ypjzi1axH2A#t=186))
|
||||
|
||||
Front-End Extras
|
||||
================
|
||||
|
||||
These are **not installed**, but you may wish to use them if you're doing front-end work as well
|
||||
|
||||
* bower
|
||||
* uglifyjs
|
||||
* yo
|
||||
* jade
|
||||
* less
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
#!/bin/bash
|
||||
|
||||
# curl -fsSL https://ldsconnect.org/setup-osx.bash | bash -c
|
||||
IOJS_VER=${1}
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
# XCode
|
||||
# testing for which git, gcc, etc will not work because the tools are aliased to the install script
|
||||
if [ -z "$(xcode-select --print-path 2>/dev/null)" ] || [ -z "$(git --version 2>/dev/null)" ]; then
|
||||
echo "Hey You!!!"
|
||||
echo ""
|
||||
echo "A thingy is going to pop up and ask you to install 'command line developer tools' for 'xcode-select'"
|
||||
echo ""
|
||||
echo "You need to click Install. This installation should begin when that finishes."
|
||||
echo "(if that box doesn't pop up in a second or two, something went wrong)"
|
||||
echo "(note that it may pop up underneath this window, so check for it in the dock too)"
|
||||
echo ""
|
||||
|
||||
xcode-select --install 2>/dev/null
|
||||
|
||||
while true; do
|
||||
sleep 5
|
||||
|
||||
if [ -n "$(git --version 2>/dev/null)" ] && [ -n "$(xcode-select --print-path 2>/dev/null)" ]; then
|
||||
break;
|
||||
fi
|
||||
done
|
||||
|
||||
echo "It looks like the other install is finishing up."
|
||||
echo "This installation will begin in one minute."
|
||||
sleep 60
|
||||
else
|
||||
echo "XCode Command Line Tools already installed"
|
||||
fi
|
||||
|
||||
# homebrew
|
||||
if [ -z "$(which brew | grep brew)" ]; then
|
||||
echo "installing brew (homebrew)..."
|
||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
brew doctor
|
||||
else
|
||||
echo "updating brew..."
|
||||
brew update >/dev/null 2>/dev/null
|
||||
fi
|
||||
|
||||
if [ -z "$(which wget | grep wget)" ]; then
|
||||
echo "installing wget..."
|
||||
brew install wget
|
||||
else
|
||||
echo "wget already installed"
|
||||
fi
|
||||
|
||||
# http://www.fail2ban.org/wiki/index.php/HOWTO_Mac_OS_X_Server_(10.5)
|
||||
if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then
|
||||
echo "installing fail2ban..."
|
||||
brew install fail2ban
|
||||
sudo cp -fv /usr/local/opt/fail2ban/*.plist /Library/LaunchDaemons
|
||||
sudo launchctl load /Library/LaunchDaemons/homebrew.mxcl.fail2ban.plist
|
||||
else
|
||||
echo "fail2ban already installed"
|
||||
fi
|
||||
|
||||
if [ -z "$(which pkg-config | grep pkg-config)" ]; then
|
||||
echo "installing pkg-config..."
|
||||
brew install pkg-config
|
||||
else
|
||||
echo "pkg-config already installed"
|
||||
fi
|
||||
|
||||
# iojs
|
||||
if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then
|
||||
IOJS_VER=""
|
||||
|
||||
if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then
|
||||
echo iojs ${IOJS_VER} already installed
|
||||
else
|
||||
echo ""
|
||||
echo "HEY, LISTEN:"
|
||||
echo "io.js is already installed as iojs $(iojs -v | grep v)"
|
||||
echo ""
|
||||
echo "to reinstall please first run: rm $(which iojs)"
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${IOJS_VER}" ]; then
|
||||
echo "installing io.js as iojs ${IOJS_VER}..."
|
||||
curl -fsSL "http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}.pkg" -o "/tmp/iojs-${IOJS_VER}.pkg"
|
||||
sudo /usr/sbin/installer -pkg "/tmp/iojs-${IOJS_VER}.pkg" -target /
|
||||
sudo chown -R $(whoami) /usr/local 2>/dev/null
|
||||
fi
|
|
@ -0,0 +1,56 @@
|
|||
#!/bin/bash
|
||||
|
||||
# curl -fsSL https://ldsconnect.org/setup-linux.bash | bash -c
|
||||
|
||||
IOJS_VER=${1}
|
||||
|
||||
echo ""
|
||||
echo ""
|
||||
|
||||
echo "updating apt-get..."
|
||||
sudo bash -c "apt-get update -qq -y < /dev/null" > /dev/null
|
||||
|
||||
# fail2ban
|
||||
if [ -z "$(which fail2ban-server | grep fail2ban)" ]; then
|
||||
echo "installing fail2ban..."
|
||||
sudo bash -c "apt-get install -qq -y fail2ban < /dev/null" > /dev/null
|
||||
fi
|
||||
|
||||
# git, wget, curl, build-essential
|
||||
if [ -z "$(which pkg-config | grep pkg-config)" ] || [ -z "$(which git | grep git)" ] || [ -z "$(which wget | grep wget)" ] || [ -z "$(which curl | grep curl)" ] || [ -z "$(which gcc | grep gcc)" ] || [ -z "$(which rsync | grep rsync)" ]
|
||||
then
|
||||
echo "installing git, wget, curl, build-essential, rsync, pkg-config..."
|
||||
sudo bash -c "apt-get install -qq -y git wget curl build-essential rsync pkg-config < /dev/null" > /dev/null 2>/dev/null
|
||||
fi
|
||||
|
||||
# iojs
|
||||
if [ -n "$(which iojs | grep iojs 2>/dev/null)" ]; then
|
||||
IOJS_VER=""
|
||||
|
||||
if [ "${IOJS_VER}" == "$(iojs -v 2>/dev/null)" ]; then
|
||||
echo iojs ${IOJS_VER} already installed
|
||||
else
|
||||
echo ""
|
||||
echo "HEY, LISTEN:"
|
||||
echo "io.js is already installed as iojs $(iojs -v | grep v)"
|
||||
echo ""
|
||||
echo "to reinstall please first run: rm $(which iojs)"
|
||||
echo ""
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -n "${IOJS_VER}" ]; then
|
||||
if [ -n "$(arch | grep 64)" ]; then
|
||||
ARCH="x64"
|
||||
else
|
||||
ARCH="x86"
|
||||
fi
|
||||
echo "installing io.js as iojs ${IOJS_VER}..."
|
||||
curl -fsSL "http://iojs.org/dist/${IOJS_VER}/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz" \
|
||||
-o "/tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz"
|
||||
pushd /tmp
|
||||
tar xf /tmp/iojs-${IOJS_VER}-linux-${ARCH}.tar.gz
|
||||
rm iojs-${IOJS_VER}-linux-x64/{LICENSE,ChangeLog,README.md}
|
||||
sudo rsync -a "/tmp/iojs-${IOJS_VER}-linux-${ARCH}/" /usr/local/
|
||||
sudo chown -R $(whoami) /usr/local
|
||||
fi
|
|
@ -0,0 +1,149 @@
|
|||
#!/bin/bash
|
||||
|
||||
# curl -fsSL https://example.com/setup.bash | bash
|
||||
# wget -nv https://example.com/setup.bash -O - | bash
|
||||
|
||||
BASE_URL="https://raw.githubusercontent.com/coolaj86/iojs-install-script/master"
|
||||
|
||||
if [ -n "$(which iojs 2>/dev/null || false)" ]; then
|
||||
echo ""
|
||||
echo "HEY, LISTEN:"
|
||||
echo "io.js is already install as iojs $(iojs -v | grep v)"
|
||||
echo ""
|
||||
echo "to reinstall please first run: rm $(which iojs)"
|
||||
echo ""
|
||||
fi
|
||||
|
||||
if [ -f "/tmp/IOJS_VER" ]; then
|
||||
IOJS_VER=$(cat /tmp/IOJS_VER | grep v)
|
||||
fi
|
||||
if [ -z "$IOJS_VER" ]; then
|
||||
IOJS_VER="v1.0.1"
|
||||
fi
|
||||
OS="unsupported"
|
||||
ARCH=""
|
||||
|
||||
if [ "$(uname | grep -i 'Darwin')" ]; then
|
||||
OSX_VER="$(sw_vers | grep ProductVersion | cut -d':' -f2 | cut -f2)"
|
||||
OSX_MAJOR="$(echo ${OSX_VER} | cut -d'.' -f1)"
|
||||
OSX_MINOR="$(echo ${OSX_VER} | cut -d'.' -f2)"
|
||||
OSX_PATCH="$(echo ${OSX_VER} | cut -d'.' -f3)"
|
||||
|
||||
#
|
||||
# Major
|
||||
#
|
||||
if [ "$OSX_MAJOR" -lt 10 ]; then
|
||||
echo "unsupported OS X version (os 9-)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ "$OSX_MAJOR" -gt 10 ]; then
|
||||
echo "unsupported OS X version (os 11+)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
#
|
||||
# Minor
|
||||
#
|
||||
if [ "$OSX_MINOR" -le 5 ]; then
|
||||
echo "unsupported OS X version (os 10.5-)"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Snow
|
||||
if [ "$OSX_MINOR" -eq 6 ]; then
|
||||
OS='snow'
|
||||
fi
|
||||
|
||||
# Lion
|
||||
if [ $OSX_MINOR -eq 7 ]; then
|
||||
OS='lion'
|
||||
fi
|
||||
|
||||
# Mountain Lion
|
||||
if [ "$OSX_MINOR" -eq 8 ]; then
|
||||
OS='mountain'
|
||||
fi
|
||||
|
||||
# Mavericks, Yosemite
|
||||
if [ "$OSX_MINOR" -ge 9 ]; then
|
||||
OS='mavericks'
|
||||
fi
|
||||
|
||||
if [ -n "$(sysctl hw | grep 64bit | grep ': 1')" ]; then
|
||||
ARCH="64"
|
||||
else
|
||||
ARCH="32"
|
||||
fi
|
||||
|
||||
elif [ "$(uname | grep -i 'Linux')" ]; then
|
||||
|
||||
if [ ! -f "/etc/issue" ]; then
|
||||
echo "unsupported linux os"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$(arch | grep 64)" ]; then
|
||||
ARCH="64"
|
||||
else
|
||||
ARCH="32"
|
||||
fi
|
||||
|
||||
if [ "$(cat /etc/issue | grep -i 'Ubuntu')" ]; then
|
||||
OS='ubuntu'
|
||||
elif [ "$(cat /etc/issue | grep -i 'Fedora')" ]; then
|
||||
OS='fedora'
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
echo "unsupported unknown os (non-mac, non-linux)"
|
||||
exit 1
|
||||
|
||||
fi
|
||||
|
||||
case "${OS}" in
|
||||
fedora)
|
||||
echo "sudo yum"
|
||||
echo "wget --quiet ${BASE_URL}/setup-fedora.bash -O /tmp/install-iojs.bash || echo 'error downloading os setup script'"
|
||||
;;
|
||||
ubuntu)
|
||||
wget --quiet "${BASE_URL}/setup-ubuntu.bash" -O /tmp/install-iojs.bash || echo 'error downloading os setup script'
|
||||
;;
|
||||
yosemite)
|
||||
# mavericks
|
||||
curl --silent "${BASE_URL}/setup-mavericks.bash" -o /tmp/install-iojs.bash || echo 'error downloading os setup script'
|
||||
;;
|
||||
mavericks)
|
||||
curl --silent "${BASE_URL}/setup-mavericks.bash" -o /tmp/install-iojs.bash || echo 'error downloading os setup script'
|
||||
;;
|
||||
mountain)
|
||||
echo "wget cltools"
|
||||
echo "curl --silent ${BASE_URL}/setup-mountain.bash -o /tmp/install-iojs.bash || echo 'error downloading os setup script'"
|
||||
;;
|
||||
lion)
|
||||
echo "wget cltools"
|
||||
echo "curl --silent ${BASE_URL}/setup-lion.bash -o /tmp/install-iojs.bash || echo 'error downloading os setup script'"
|
||||
;;
|
||||
snow)
|
||||
echo "wget gcc-0.6.pkg"
|
||||
echo "curl --silent ${BASE_URL}/setup-snow.bash -o /tmp/install-iojs.bash || echo 'error downloading os setup script'"
|
||||
;;
|
||||
*)
|
||||
echo "unsupported unknown os ${OS}"
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
echo "${OS}" "${ARCH}"
|
||||
bash /tmp/install-iojs.bash "${IOJS_VER}"
|
||||
|
||||
# jshint
|
||||
if [ -z "$(which jshint | grep jshint)" ]; then
|
||||
echo "installing jshint..."
|
||||
npm install --silent jshint -g > /dev/null
|
||||
else
|
||||
echo "jshint already installed"
|
||||
fi
|
||||
|
||||
echo ""
|
Loading…
Reference in New Issue