-
Notifications
You must be signed in to change notification settings - Fork 0
/
installing_on_centos.txt
executable file
·157 lines (104 loc) · 4.85 KB
/
installing_on_centos.txt
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
Log in to CENTOS (Plesk on Parallels) using putty.exe
Log in as "root"
Run the following commands to install node.js and npm
====================================================================================
Install c++ compiler (note this is liable to change as node release move on and require newer compilers):
cd
sudo curl http://linuxsoft.cern.ch/cern/scl/slc6-scl.repo > /etc/yum.repos.d/slc6-scl.repo
sudo rpm --import http://ftp.mirrorservice.org/sites/ftp.scientificlinux.org/linux/scientific/51/i386/RPM-GPG-KEYs/RPM-GPG-KEY-cern
sudo yum install -y devtoolset-3
scl enable devtoolset-3 bash
# Make this setting permanent!
nano ~/.bashrc
# Add the following line at the end and save it
source scl_source enable devtoolset-3
====================================================================================
Now create node (at the time of writing there is no nice install for node on centos so we have to build it):
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=$HOME/local
make install
WARNING: The above takes AGES!
====================================================================================
Now install npm:
cd
curl -L https://www.npmjs.org/install.sh | sh
====================================================================================
Now for the node stuff we want:
Install forever: "npm install forever -g"
Install sails: "npm install sails -g"
Now install Git: "sudo yum install git"
get the nano editor: "yum install nano"
INSTALLS NOW COMPLETE
Plesk
=====
Ensure that nginx is installed. We need this to create a reverse proxy to the sails.js application in the
squareevents.org domain.
In Plesk, create the squareevents.org domain and add a MySql database and user - usually called
"squareevents" but double check the localhostMySqlServer settings in /usr/sails/projects/events/config/connections.js
In the squareevents.org domain settings take the "Apache and nginx settings" option.
Apache http overrides to allow lets-encrypt to work:
######## MOT NEEDED ON PLESK 17 ##########################################
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_URI} ^/.well-known/acme-challenge [NC]
RewriteRule .* - [L]
RewriteEngine on
RewriteCond %{HTTPS} !=on
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R,QSA]
</IfModule>
##################################################
In "Additional nginx directives" we need to reverse proxy to sails by adding the following (remembering to change the IP address):
######## MOT NEEDED ON PLESK 17 ##########################################
## Allow lets encrypt challenge through untouched
location ^~ /.well-known/acme-challenge/ {
allow all;
default_type "text/plain";
}
##########################################################################
## Set the location routing to our Sails.js application.
location ~ / {
proxy_pass http://31.193.132.43:1337;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
## Allow websockets
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
}
##################################################
First time in
=============
Make a new folder structure in /usr: /sails/projects
Clone the repo from github:
git clone https://github.com/kpturner/sails_events.git /usr/sails/projects/events
cd /usr/sails/projects/events
Install missing modules: "npm install"
Look in "events-service" file for instructions on installing a service to run this application.
run "sails lift" to fire everything up for the first time - this will also set up the database.
Install Redis (for sessions)
============================
# wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
# wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
# rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
# yum install redis php-pecl-redis
# service redis start
# chkconfig redis on
Now verify its set to start at boot
# chkconfig -–list redis
redis 0:off 1:off 2:on 3:on 4:on 5:on 6:off
To make sure redis is working, run command “redis-cli ping” from command line. If you get result “PONG”, that shows redis is working.
Not first time in
=================
cd /usr/sails/projects/events
Pull updates from GitHub using: "bash gitupdate.sh"
Stop the service: "service events-service stop"
If DB updates required: "sails lift" (after lift completes, cancel then "service events-service start")
otherwise start service: "service events-service start"
How to access the Centos file structure from your local windows PC
==================================================================
An excellent tool for mounting the drives remotely via SSH: https://igikorn.com/sshfs-windows-10/