forked from BohdanTkachenko/websockets-stress-test
-
Notifications
You must be signed in to change notification settings - Fork 0
/
initScript.sh
68 lines (44 loc) · 1.39 KB
/
initScript.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
67
# sh upstart/cloudlick
# install node
# install npm
# instal pm2
# set key
# clone form git
# instal dependencies
#!/bin/bash
MASTER_IP="23.253.119.91"
IP_ADDR=$(getent hosts `hostname` | awk '{print $1}')
sudo apt-get update
sudo apt-get install git
sudo apt-get install nodejs
sudo apt-get install npm
sudo ln -s /usr/bin/nodejs /usr/bin/node
sudo npm install pm2 -g
# get and set key from and to remote
scp [email protected]:.ssh/authorized_keys ~/.ssh
ssh-keygen -t rsa
ssh [email protected] ssh-copy-id root@$IP_ADDR
cat ~/.ssh/id_rsa.pub | ssh [email protected] 'umask 0077; mkdir -p .ssh; cat >> .ssh/authorized_keys && echo "Key copied"'
ssh [email protected] "echo \"`cat .ssh/id_rsa.pub`\" >> .ssh/authorized_keys"
#!/bin/bash
#
# Creates an SSH key on a client machine, applies the appropriate file permissions,
# copies to the local ~/.ssh directory, & copies to specified server
#
# parameters:
# ..1 newKeyFileName
# ..2 user@server
#
# usage :
# ./sshKeyGen.sh newKey [email protected]
#
ssh-keygen -t rsa -f $1
chmod 600 $1
chmod 600 $1.pub
mv $1 ~/.ssh/$1.pem
cp $1.pub ~/.ssh/$1
mv $1.pub ~/.ssh/$1.pub
ssh-copy-id -i ~/.ssh/$1.pub $2
# change pass # passwd