-
Notifications
You must be signed in to change notification settings - Fork 0
/
install.sh
59 lines (47 loc) · 2.09 KB
/
install.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
#!/bin/bash
########################## nginx ####################################
yum update -y
yum install epel-release -y
yum install nginx -y
sed "s@<path_to_front>@$(pwd)\/front@gm" nginx/www.yes.io.conf > /etc/nginx/conf.d/www.yes.io.conf
########################## install nodejs & yarn ####################
curl -sL https://rpm.nodesource.com/setup_10.x | bash -
yum install nodejs -y
curl --silent --location https://dl.yarnpkg.com/rpm/yarn.repo | tee /etc/yum.repos.d/yarn.repo
rpm --import https://dl.yarnpkg.com/rpm/pubkey.gpg
yum install yarn -y
########################## firewall #################################
firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --permanent --zone=public --add-service=https
firewall-cmd --reload
######################### selinux ###################################
setenforce 0
sed 's/SELINUX=\(.*\)/SELINUX=disabled/g' -i /etc/selinux/config
######################## config::go-server ##########################
chmod +x go/main
ln -s $(pwd)/go/main /usr/bin/go-server
####################### config::nodejs ##############################
NODE_PATH=$(which node)
sed "1 i\\#!$NODE_PATH " -i nodejs/main.js
chmod +x nodejs/main.js
ln -s $(pwd)/nodejs/main.js /usr/bin/node-server
cd nodejs
yarn install
cd ..
######################### service files #############################
sed "s@<path_to_binary>@$(pwd)\/go@gm" OS/services/go-server.service > /lib/systemd/system/go-server.service
sed "s@<path_to_binary>@$(pwd)\/nodejs@gm" OS/services/nodejs-server.service > /lib/systemd/system/nodejs-server.service
#cp services/go-server.service /etc/systemd/system/multi-user.target.wants/
#cp services/nodejs-server.service /etc/systemd/system/multi-user.target.wants/
######################## sysctl #####################################
cp OS/sysctl.conf /etc/sysctl.conf
sysctl -p
######################## running ####################################
systemctl daemon-reload
systemctl enable nginx
systemctl enable go-server
systemctl enable nodejs-server
systemctl restart go-server
systemctl restart nodejs-server
systemctl restart nginx
nginx -s reload