-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathinstall-mgmt-hub.sh
66 lines (49 loc) · 1.57 KB
/
install-mgmt-hub.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
#!/bin/sh -i
set -e
# Install node and npm via nvm - https://github.com/nvm-sh/nvm
# Run this script like - bash script-name.sh
# Tested on Ubuntu, MacOS
# @playground
# Define versions
INSTALL_NODE_VER=20
INSTALL_NVM_VER=0.39.5
# You can pass argument to this script --version 8
if [ "$1" = '--version' ]; then
echo "==> Using specified node version - $2"
INSTALL_NODE_VER=$2
fi
echo "==> Ensuring .bashrc exists and is writable"
touch ~/.bashrc
echo "==> Installing node version manager (NVM). Version $INSTALL_NVM_VER"
# Removed if already installed
rm -rf ~/.nvm
# Unset exported variable
export NVM_DIR=
# Install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v$INSTALL_NVM_VER/install.sh | bash
# Make nvm command available to terminal
source ~/.nvm/nvm.sh
echo "==> Installing node js version $INSTALL_NODE_VER"
nvm install $INSTALL_NODE_VER
echo "==> Make this version system default"
nvm alias default $INSTALL_NODE_VER
nvm use default
#echo -e "==> Update npm to latest version, if this stuck then terminate (CTRL+C) the execution"
npm install -g npm
echo "==> Checking for versions"
nvm --version
node --version
npm --version
echo "==> Print binary paths"
which npm
which node
echo "==> List installed node versions"
nvm ls
nvm cache clear
echo "==> Now you're all setup and ready for development. If changes are yet to take effect in the current shell, try source ~/.bashrc or open a new shell"
echo "==> Installing oh cli"
npm i -g hzn-cli
echo "==> Checking oh version"
oh --version
echo "==> Setting up Management Hub environment..."
oh deploy setupManagementHub